<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Ethereum Improvement Proposals - Core</title>
    <subtitle>Ethereum Improvement Proposals (EIPs &amp; ERCs) describe standards for the Ethereum platform, such as core protocol changes and application-level standards.</subtitle>
    <link href="https://wg-eips.ritovision.com/category/core/atom.xml" rel="self" type="application/atom+xml"/>
    <link rel="alternate" type="text/html" href="https://wg-eips.ritovision.com/category/core/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-02-11T14:49:29+00:00</updated>
    <id>https://wg-eips.ritovision.com/category/core/atom.xml</id>
    <entry xml:lang="en">
        <title>Multi KZG Point Evaluation Precompile</title>
        <published>2026-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Chris Mata</name><uri>https://github.com/protocolwhisper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8149/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8149-multi-kzg-point-evaluation-precompile/27671" />
        

        <id>https://wg-eips.ritovision.com/8149/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8149"
            label="EIP-8149" />
        

        
        

        
        <summary type="html">Verify multiple (z, y) evaluations against a single EIP-4844 blob commitment in one precompile call.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8149/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a precompile that verifies multiple KZG openings &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; for a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob commitment, returning the same 64-byte output as the existing point-evaluation precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; provides a point-evaluation precompile at &lt;code&gt;0x0A&lt;&#x2F;code&gt; costing 50,000 gas per opening. Contracts needing multiple blob values (e.g., fraud proofs) must pay this cost repeatedly. A batch interface verifies &lt;em&gt;k&lt;&#x2F;em&gt; openings in one call, reducing overhead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MULTI_POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_MULTI_POINTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;128&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;maximum number of evaluation points&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MULTI_POINT_EVALUATION_BASE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;base gas cost&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MULTI_POINT_EVALUATION_PER_POINT_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;gas cost per evaluation point&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce a precompile to perform multi KZG point evaluation:&lt;&#x2F;p&gt;
&lt;p&gt;It verifies multiple KZG openings &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; for a single EIP-4844 blob commitment in one call. The verification uses BLS12-381 pairing operations internally to check the multi-point opening proof. Gas cost is defined by &lt;code&gt;MULTI_POINT_EVALUATION_BASE_GAS + MULTI_POINT_EVALUATION_PER_POINT_GAS * n&lt;&#x2F;code&gt; where &lt;code&gt;n&lt;&#x2F;code&gt; is the number of evaluation points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;input&quot;&gt;Input&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;versioned_hash  : Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;commitment      : Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;n               : uint32 (big-endian)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pairs           : n × (z: Bytes32, y: Bytes32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;proof           : Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Total length: &lt;code&gt;132 + (n × 64)&lt;&#x2F;code&gt; bytes. All &lt;code&gt;z&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; MUST be strictly less than &lt;code&gt;BLS_MODULUS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output&quot;&gt;Output&lt;&#x2F;h3&gt;
&lt;p&gt;On success, return 64 bytes identical to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FIELD_ELEMENTS_PER_BLOB  : uint256 (big-endian)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BLS_MODULUS              : uint256 (big-endian)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;multi-point-evaluation-precompile&quot;&gt;Multi-point evaluation precompile&lt;&#x2F;h3&gt;
&lt;p&gt;Add a precompile at &lt;code&gt;MULTI_POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; that verifies multiple KZG openings &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; for a single EIP-4844 blob commitment.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile executes the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; multi_point_evaluation_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    versioned_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_MULTI_POINTS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 132&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    z_values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_values&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        z_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        y_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; z_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLS_MODULUS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; y_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLS_MODULUS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        z_values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;z_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        y_values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;y_i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 84&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; kzg_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; versioned_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; verify_kzg_proof_multi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z_values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLS_MODULUS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;verify_kzg_proof_multi&lt;&#x2F;code&gt; function performs multi-point opening verification using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; trusted setup and BLS12-381 pairing operations. Implementations typically use Lagrange interpolation to construct a polynomial through all &lt;code&gt;(z_i, y_i)&lt;&#x2F;code&gt; pairs, which has O(n²) complexity. When evaluation points align with roots of unity, FFT-based methods reduce this to O(n log n). The final verification step uses a single pairing check to verify all openings simultaneously.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for multi point evaluation is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTI_POINT_EVALUATION_BASE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTI_POINT_EVALUATION_PER_POINT_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Gas constants SHOULD ensure batching is cheaper than &lt;code&gt;n&lt;&#x2F;code&gt; separate &lt;code&gt;0x0A&lt;&#x2F;code&gt; calls for &lt;code&gt;n &amp;gt; 1&lt;&#x2F;code&gt;. The verification internally uses BLS12-381 pairing operations, which are computationally expensive but enable efficient batch verification of multiple openings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Preserves &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; versioned-hash model and return format.&lt;&#x2F;li&gt;
&lt;li&gt;Adds a new precompile rather than modifying &lt;code&gt;0x0A&lt;&#x2F;code&gt; to avoid compatibility risks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_MULTI_POINTS = 128&lt;&#x2F;code&gt; bounds input size while enabling meaningful savings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No changes to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; transactions, &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt;, or the existing precompile at &lt;code&gt;0x0A&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Reject non-canonical field elements (&lt;code&gt;&amp;gt;= BLS_MODULUS&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Implementations MUST use the same trusted setup and subgroup checks as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas pricing MUST reflect actual computational cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Custom sweep threshold for validators</title>
        <published>2026-02-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dmitry Gusakov</name><uri>https://github.com/dgusakov</uri>
	</author>
	
	<author>
		<name>Dmitry Chernukhin</name><uri>https://github.com/madlabman</uri>
	</author>
	
	<author>
		<name>Greg Koumoutsos</name><uri>https://github.com/gkoumout</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8148/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8148-custom-sweep-threshold-for-validators/27669" />
        

        <id>https://wg-eips.ritovision.com/8148/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8148"
            label="EIP-8148" />
        

        
        

        
        <summary type="html">Allow setting custom balance thresholds for sweep withdrawals for validators with compounding withdrawal credentials (`0x02, 0x03`).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8148/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an optional mechanism to set custom balance thresholds for sweep withdrawals for compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;) validators. This mechanism allows validators to specify above which balance they want their rewards to be swept to their withdrawal address, providing greater flexibility and control over their staking rewards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current default sweep threshold (2,048 ETH) for validators using compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;) may not meet the needs of all validators. Some validators may prefer to accumulate rewards on the validator balance, while others may want to sweep before reaching the current threshold of 2,048 ETH. By allowing optional custom sweep thresholds, validators can optimize their reward management according to their individual strategies and preferences.&lt;&#x2F;p&gt;
&lt;p&gt;Since the introduction of the &lt;code&gt;0x02&lt;&#x2F;code&gt; compounding withdrawal credentials type, we have observed a very low rate of validators transitioning to &lt;code&gt;0x02&lt;&#x2F;code&gt;. One reason is that many validators do not want to wait until they accumulate 2048 ETH in rewards before being able to participate in the automatic sweep of withdrawals. While partial withdrawals were considered a viable method for manually withdrawing portions of the validator balance, this approach was not widely adopted by staking protocols, node operators, and solo stakers for several reasons. First, it requires a user-initiated transaction to perform a withdrawal. Second, partial withdrawals utilize the general exit queue, which makes the time between partial withdrawal initiation and fulfillment unpredictable and heavily dependent on network conditions (see the recent spike in exit queue size in October 2025). This EIP aims to address this issue by allowing validators to set a custom threshold for sweep withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;A simple example illustrates the utility of this feature. Consider a validator who wishes to accumulate rewards on their validator balance until reaching 128 ETH, at which point they want to sweep the rewards to their withdrawal address. Without this feature, the validator would have to initiate partial withdrawals at certain intervals manually and wait in the partial withdrawals queue, which can be time-consuming and inconvenient. The first inconvenience is that if staking protocols widely adopt partial withdrawals at some point, the queue for these withdrawals might become long and unpredictable, similar to the exit queue. The second inconvenience is that the user must monitor the validator&#x27;s balance and manually initiate partial withdrawals, which adds complexity and overhead to the staking process. The third inconvenience is the frequency with which the validator can request partial withdrawals. A 128-ETH validator will receive approximately 0.07 ETH in rewards each week. Initiating partial withdrawals TX, for such a low amount might be considered unreasonable. At the same time, the sweep cycle will likely drop to a weekly cycle relatively soon, allowing the validator to automatically receive these 0.07 ETH of rewards on their withdrawal credentials. In general, with this EIP, the validator can set their desired sweep threshold and automatically benefit from sweep withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed mechanism is completely optional and does not change anything in the default registration &#x2F; withdrawal &#x2F; exit process for validators. It&#x27;s just an additional feature that could be ignored if not interesting, but provides a useful feature for many validators incentivizing switching to compounding validators.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for set sweep threshold request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about set sweep threshold request mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the head of the set sweep threshold request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the set sweep threshold request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The start storage slot of the in-state set sweep threshold request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of set sweep threshold requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_SET_SWEEP_THRESHOLD_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_SWEEP_THRESHOLD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;MIN_ACTIVATION_BALANCE + Gwei(1 * 10**9)&lt;&#x2F;code&gt; (33 ETH)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer-1&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain after this EIP has been activated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;set-sweep-threshold-request&quot;&gt;Set sweep threshold request&lt;&#x2F;h4&gt;
&lt;p&gt;The new set sweep threshold request is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request with type &lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_TYPE&lt;&#x2F;code&gt; consisting of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;source_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validator_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;threshold&lt;&#x2F;code&gt;: &lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a set sweep threshold request is computed as follows.
Note that &lt;code&gt;threshold&lt;&#x2F;code&gt; is returned by the contract little-endian, and must be encoded as such.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; read_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;set-sweep-threshold-request-contract&quot;&gt;Set sweep threshold request contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add set sweep threshold request - requires a 56-byte input: validator public key concatenated with a big-endian &lt;code&gt;uint64&lt;&#x2F;code&gt; threshold value.&lt;&#x2F;li&gt;
&lt;li&gt;Fee getter - if the input length is zero, return the current fee required to add a set sweep threshold request.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by the system address, pop off the set sweep threshold requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;add-set-sweep-threshold-request&quot;&gt;Add Set Sweep Threshold Request&lt;&#x2F;h5&gt;
&lt;p&gt;If call data input to the contract is exactly &lt;code&gt;56&lt;&#x2F;code&gt; bytes, perform the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure enough ETH was sent to cover the current set sweep threshold request fee (&lt;code&gt;msg.value &amp;gt;= get_fee()&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Increase set sweep threshold request count by 1 for the current block.&lt;&#x2F;li&gt;
&lt;li&gt;Insert a set sweep threshold request into the queue for the source address, validator public key, and the threshold.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Specifically, the functionality is defined in pseudocode as the function &lt;code&gt;add_set_sweep_threshold_request()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add_set_sweep_threshold_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Add a new request to the set sweep threshold request queue, provided a sufficient value to cover the fee was sent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sufficient value was provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Insufficient value for fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment the request count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert into the queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt; threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;fee-calculation&quot;&gt;Fee calculation&lt;&#x2F;h6&gt;
&lt;p&gt;The following pseudocode can compute the cost of an individual set sweep threshold request, given a certain number of excess set sweep threshold requests.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inhibitor still active&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_SET_SWEEP_THRESHOLD_REQUEST_FEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        SET_SWEEP_THRESHOLD_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fee-getter&quot;&gt;Fee Getter&lt;&#x2F;h5&gt;
&lt;p&gt;When the input to the contract has zero-length, interpret this as a get request for the current fee, i.e. the contract returns the result of &lt;code&gt;get_fee()&lt;&#x2F;code&gt;. The contract reverts if any value is sent to prevent loss of funds.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;system-call&quot;&gt;System Call&lt;&#x2F;h5&gt;
&lt;p&gt;At the end of processing any execution block starting from the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; (i.e. after processing all transactions), call &lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with no calldata. The invocation triggers the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract&#x27;s queue is updated based on set sweep threshold requests dequeued and the set sweep threshold requests queue head&#x2F;tail are reset if the queue has been cleared (&lt;code&gt;dequeue_set_sweep_threshold_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s excess set sweep threshold requests are updated based on usage in the current block (&lt;code&gt;update_excess_set_sweep_threshold_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s set sweep threshold requests count is reset to 0 (&lt;code&gt;reset_set_sweep_threshold_requests_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In response to the system call, the contract returns an opaque byte array of concatenated SSZ-serialized dequeued requests. There&#x27;s no specific reasoning behind it, except aligning with the existing behaviour of the similar EIP, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;, and possible simplification of the processing flow for client teams.
Each set sweep threshold request must appear in the EIP-7685 requests list in the exact order returned by &lt;code&gt;dequeue_set_sweep_threshold_requests()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the system call and the processing of that block must conform to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The call has a dedicated gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt; (&lt;code&gt;SYSTEM_TRANSACTION_GAS&lt;&#x2F;code&gt;) and is not subject to the transaction limit cap introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas consumed by this call does not count against the block’s overall gas usage.&lt;&#x2F;li&gt;
&lt;li&gt;Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The call does not follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee burn semantics — no value should be transferred as part of this call.&lt;&#x2F;li&gt;
&lt;li&gt;If there is no code at &lt;code&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, the corresponding block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If the call to the contract fails or returns an error, the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The functionality triggered by the system call is defined in pseudocode as the function &lt;code&gt;read_set_sweep_threshold_requests()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_excess_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_set_sweep_threshold_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ssz&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helpers #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidatorSetSweepThresholdRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dequeue_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_in_queue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_dequeued&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_in_queue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_dequeued&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        req&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorSetSweepThresholdRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            threshold&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;threshold&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reqs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;req&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; num_dequeued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queue is empty, reset queue pointers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_excess_set_sweep_threshold_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_SET_SWEEP_THRESHOLD_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_SET_SWEEP_THRESHOLD_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reset_set_sweep_threshold_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_SWEEP_THRESHOLD_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SET_SWEEP_THRESHOLD_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;p&gt;The following bytecode is produced by the geas compiler from the source code in the sys-asm repository.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xcb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0183&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffff00000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x06&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0195&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;The set sweep threshold requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sender: TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer-1&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The defining feature of this EIP is &lt;em&gt;&lt;strong&gt;allowing validators to set custom sweep thresholds for their withdrawals when using compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;)&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8148&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section contains an explanation for this proposed core feature. A sketch of the resulting changes to the consensus layer is included below.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container to include a &lt;code&gt;validator_sweep_thresholds&lt;&#x2F;code&gt; mapping.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;SetSweepThresholdRequest&lt;&#x2F;code&gt; container to represent the set sweep threshold requests dequeued from the execution layer contract.&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt; container to include a list of &lt;code&gt;SetSweepThresholdRequest&lt;&#x2F;code&gt; items.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_set_sweep_threshold_request&lt;&#x2F;code&gt; function to handle the processing of set sweep threshold requests from the execution layer.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; function to include the processing of set sweep threshold requests.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the &lt;code&gt;is_partially_withdrawable_validator&lt;&#x2F;code&gt; predicate to take into account the custom sweep threshold.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;get_effective_sweep_threshold&lt;&#x2F;code&gt; helper function to compute the effective sweep threshold for a validator.&lt;&#x2F;li&gt;
&lt;li&gt;Modify the &lt;code&gt;get_expected_withdrawals&lt;&#x2F;code&gt; function to use the custom sweep threshold when determining partial withdrawals.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By default, all validators will have their sweep thresholds set to the current default &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, both for existing validators and new ones. Validators can choose to set a custom threshold above their current balance by submitting a set sweep threshold request through the execution layer contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Most of the considerations regarding the messaging format, queue, and rate-limiting are similar to those discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt; for withdrawal requests, and so we refer the reader to that EIP for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;custom-sweep-thresholds&quot;&gt;Custom Sweep Thresholds&lt;&#x2F;h3&gt;
&lt;p&gt;The primary motivation for this EIP is to allow validators to set custom sweep thresholds for their withdrawals when using compounding withdrawal credentials (&lt;code&gt;0x02, 0x03&lt;&#x2F;code&gt;). This feature provides greater flexibility and control over how and when validators can access their staking rewards.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validator-sweep-thresholds-mapping-in-beaconstate&quot;&gt;&lt;code&gt;validator_sweep_thresholds&lt;&#x2F;code&gt; mapping in &lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;To store the custom sweep thresholds for each validator, we introduce a new mapping in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container called &lt;code&gt;validator_sweep_thresholds&lt;&#x2F;code&gt;. This mapping associates each validator index with its corresponding sweep threshold. This approach was chosen instead of adding a new field to the &lt;code&gt;Validator&lt;&#x2F;code&gt; container to avoid modification of this type, which had not been changed since phase-0. Modification of the &lt;code&gt;Validator&lt;&#x2F;code&gt; container would have required more extensive changes to the consensus layer and potentially affected existing implementations of the applications using this container. Also, this is the standard way of adding info about validators into the state (e.g., validator balance is stored in &lt;code&gt;balances&lt;&#x2F;code&gt; field of &lt;code&gt;BeaconState&lt;&#x2F;code&gt; and several other PoS-related info have their own lists where each item corresponds to validators&#x27; data)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;only-allowing-threshold-to-be-set-above-current-balance&quot;&gt;Only allowing threshold to be set above current balance&lt;&#x2F;h3&gt;
&lt;p&gt;This design decision is made to prevent usage of the custom sweep threshold mechanism to trigger immediate withdrawals. By enforcing that the threshold must be set above the current balance, we ensure that validators cannot use this feature to bypass the standard withdrawal process. Should a validator wish to set sweep threshold below current balance, they can first withdraw down to the desired level using partial withdrawals, and then set the sweep threshold accordingly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-requests-processing-instead-of-queuing-on-consensus-layer&quot;&gt;Immediate requests processing instead of queuing on consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike partial withdrawal requests, which are queued on the consensus layer, set sweep threshold requests are processed immediately upon being dequeued from the execution layer contract. This design choice simplifies the implementation and reduces the complexity of managing a separate queue on the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;min-sweep-threshold-of-33-eth&quot;&gt;&lt;code&gt;MIN_SWEEP_THRESHOLD&lt;&#x2F;code&gt; of 33 ETH&lt;&#x2F;h3&gt;
&lt;p&gt;To ensure that validators do not set sweep threshold equal to &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;, we introduce a minimum sweep threshold of &lt;code&gt;MIN_ACTIVATION_BALANCE + 1&lt;&#x2F;code&gt; ETH (33 ETH). This ensures that people will opt-in to compounding withdrawal credentials only if they really want to accumulate rewards on the validator balance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block structure and block validation rule set. But neither of these changes break anything related to the current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Most of the security considerations regarding fee overpayment, system call failure, and empty code failure are similar to those discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt; for withdrawal requests, and so we refer the reader to that EIP for more details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Frame Transaction</title>
        <published>2026-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8141/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/frame-transaction/27617" />
        

        <id>https://wg-eips.ritovision.com/8141/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8141"
            label="EIP-8141" />
        

        
        

        
        <summary type="html">Add frame abstraction for transaction validation, execution, and gas payment</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8141/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new transaction whose validity and gas payment can be defined abstractly. Instead of relying solely on a single ECDSA signature, accounts may freely define and interpret their signature scheme using any cryptographic system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This new transaction provides a native off-ramp from the elliptic curve based cryptographic system used to authenticate transactions today, to post-quantum (PQ) secure systems.&lt;&#x2F;p&gt;
&lt;p&gt;In doing so, it realizes the original vision of account abstraction: unlinking accounts from a prescribed ECDSA key and support alternative fee payment schemes. The assumption of an account simply becomes an address with code. It leverages the EVM to support arbitrary &lt;em&gt;user-defined&lt;&#x2F;em&gt; definitions of validation and gas payment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FRAME_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FRAME_TX_INTRINSIC_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;15000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0xaa)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_FRAMES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10^3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;APPROVE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xaa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXPARAMLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXPARAMSIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXPARAMCOPY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xb2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with type &lt;code&gt;FRAME_TX_TYPE&lt;&#x2F;code&gt; is introduced. Transactions of this type are referred to as &quot;Frame transactions&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;The payload is defined as the RLP serialization of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, sender, frames, max_priority_fee_per_gas, max_fee_per_gas, max_fee_per_blob_gas, blob_versioned_hashes]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frames = [[mode, target, gas_limit, data], ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If no blobs are included, &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; must be an empty list and &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; must be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;modes&quot;&gt;Modes&lt;&#x2F;h4&gt;
&lt;p&gt;There are three modes:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Summary&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DEFAULT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execute frame as &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VERIFY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Frame identifies as transaction validation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execute frame as &lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;default-mode&quot;&gt;&lt;code&gt;DEFAULT&lt;&#x2F;code&gt; Mode&lt;&#x2F;h5&gt;
&lt;p&gt;Frame executes as regular call where the caller address is &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;verify-mode&quot;&gt;&lt;code&gt;VERIFY&lt;&#x2F;code&gt; Mode&lt;&#x2F;h5&gt;
&lt;p&gt;Identifies the frame as a validation frame. Its purpose is to &lt;em&gt;verify&lt;&#x2F;em&gt; that a sender and&#x2F;or payer authorized the transaction. It must call &lt;code&gt;APPROVE&lt;&#x2F;code&gt; during execution. Failure to do so will result in the whole transaction being invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The execution behaves the same as &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, state cannot be modified.&lt;&#x2F;p&gt;
&lt;p&gt;Frames in this mode will have their data elided from signature hash calculation and from introspection by other frames.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;sender-mode&quot;&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt; Mode&lt;&#x2F;h5&gt;
&lt;p&gt;Frame executes as regular call where the caller address is &lt;code&gt;sender&lt;&#x2F;code&gt;. This mode effectively acts on behalf of the transaction sender and can only be used after explicitly approved.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constraints&quot;&gt;Constraints&lt;&#x2F;h4&gt;
&lt;p&gt;Some validity constraints can be determined statically. They are outlined below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_FRAMES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;receipt&quot;&gt;Receipt&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[cumulative_gas_used, payer, [frame_receipt, ...]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame_receipt = [status, gas_used, logs]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;payer&lt;&#x2F;code&gt; is the address of the account that paid the fees for the transaction. &lt;code&gt;status&lt;&#x2F;code&gt; is the return code of the top-level call.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signature-hash&quot;&gt;Signature Hash&lt;&#x2F;h4&gt;
&lt;p&gt;With the frame transaction, the signature may be at an arbitrary location in the frame list. In the canonical signature hash any frame with mode &lt;code&gt;VERIFY&lt;&#x2F;code&gt; will have its data elided:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_sig_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FrameTx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; frame&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; frame&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;mode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERIFY&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;frames&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;new-opcodes&quot;&gt;New Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;approve-opcode-0xaa&quot;&gt;&lt;code&gt;APPROVE&lt;&#x2F;code&gt; opcode (&lt;code&gt;0xaa&lt;&#x2F;code&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;APPROVE&lt;&#x2F;code&gt; opcode is like &lt;code&gt;RETURN (0xf3)&lt;&#x2F;code&gt;. It exits the current context successfully and updates the transaction-scoped approval context based on the &lt;code&gt;scope&lt;&#x2F;code&gt; operand. It can only be called when &lt;code&gt;CALLER == frame.target&lt;&#x2F;code&gt;, otherwise it results in an exceptional halt.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;stack&quot;&gt;Stack&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;scope&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;scope-operand&quot;&gt;Scope Operand&lt;&#x2F;h5&gt;
&lt;p&gt;The scope operand must be one of the following values:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;0x0&lt;&#x2F;code&gt;: Approval of execution - the sender contract approves future frames calling on its behalf. Only valid when &lt;code&gt;frame.target&lt;&#x2F;code&gt; equals &lt;code&gt;tx.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x1&lt;&#x2F;code&gt;: Approval of payment - the contract approves paying the total gas cost for the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x2&lt;&#x2F;code&gt;: Approval of execution and payment - combines both &lt;code&gt;0x0&lt;&#x2F;code&gt; and &lt;code&gt;0x1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Any other value results in an exceptional halt.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h5&gt;
&lt;p&gt;The behavior of &lt;code&gt;APPROVE&lt;&#x2F;code&gt; is defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;APPROVE&lt;&#x2F;code&gt; is called when &lt;code&gt;CALLER != frame.target&lt;&#x2F;code&gt;, revert.&lt;&#x2F;li&gt;
&lt;li&gt;For scopes &lt;code&gt;0&lt;&#x2F;code&gt;,&lt;code&gt;1&lt;&#x2F;code&gt;, and &lt;code&gt;2&lt;&#x2F;code&gt;, execute the following:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0&lt;&#x2F;code&gt;: Set &lt;code&gt;sender_approved = true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;sender_approved&lt;&#x2F;code&gt; was already set, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;CALLER&lt;&#x2F;code&gt; != &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, revert the frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x1&lt;&#x2F;code&gt;: Increment the sender&#x27;s nonce, collect the total gas cost of the transaction from the account, and set &lt;code&gt;payer_approved = true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If payer_approved` was already set, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;frame.target&lt;&#x2F;code&gt; has insufficient balance, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;sender_approved == false&lt;&#x2F;code&gt;, revert the frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x2&lt;&#x2F;code&gt;: &lt;code&gt;sender_approved = true&lt;&#x2F;code&gt;, increment the sender&#x27;s nonce, collect the total gas cost of the transaction from &lt;code&gt;frame.target&lt;&#x2F;code&gt;, and set &lt;code&gt;payer_approved = true&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;sender_approved&lt;&#x2F;code&gt; or &lt;code&gt;payer_approved&lt;&#x2F;code&gt; was already set, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;CALLER&lt;&#x2F;code&gt; != &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, revert the frame.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;frame.target&lt;&#x2F;code&gt; has insufficient balance, revert the frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;txparam-opcodes&quot;&gt;&lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;TXPARAMLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0xb0&lt;&#x2F;code&gt;), &lt;code&gt;TXPARAMSIZE&lt;&#x2F;code&gt; (&lt;code&gt;0xb1&lt;&#x2F;code&gt;), and &lt;code&gt;TXPARAMCOPY&lt;&#x2F;code&gt; (&lt;code&gt;0xb2&lt;&#x2F;code&gt;) opcodes follow the pattern of &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; opcode families. Gas cost follows standard EVM memory expansion costs.&lt;&#x2F;p&gt;
&lt;p&gt;Each &lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcode takes two extra stack input values before the &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; equivalent inputs. The values of these inputs are as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;in1&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;in2&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Return value&lt;&#x2F;th&gt;&lt;th&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;current transaction type&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x02&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x03&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x04&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x06&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;max cost (basefee=max, all gas used, includes blob cost and intrinsic cost)&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x07&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;len(blob_versioned_hashes)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x08&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;compute_sig_hash(tx)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x09&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;len(frames)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;must be 0&lt;&#x2F;td&gt;&lt;td&gt;currently executing frame index&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x11&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;target&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x12&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x13&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x14&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;mode&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x15&lt;&#x2F;td&gt;&lt;td&gt;frame index&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;status&lt;&#x2F;code&gt; (exceptional halt if current&#x2F;future)&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;0x03 and 0x04 have a possible future extension to allow indices for multidimensional gas.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;status&lt;&#x2F;code&gt; field (0x15) returns &lt;code&gt;0&lt;&#x2F;code&gt; for failure or &lt;code&gt;1&lt;&#x2F;code&gt; for success.&lt;&#x2F;li&gt;
&lt;li&gt;Out-of-bounds access for frame index (&lt;code&gt;&amp;gt;= len(frames)&lt;&#x2F;code&gt;) and blob index results in an exceptional halt.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid &lt;code&gt;in1&lt;&#x2F;code&gt; values (not defined in the table above) result in an exceptional halt.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;data&lt;&#x2F;code&gt; field (0x12) returns size 0 value when called on a frame with &lt;code&gt;VERIFY&lt;&#x2F;code&gt; set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;behavior-1&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;When processing a frame transaction, perform the following steps.&lt;&#x2F;p&gt;
&lt;p&gt;Perform stateful validation check:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure &lt;code&gt;tx.nonce == state[tx.sender].nonce&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Initialize with transaction-scoped variables:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;payer_approved = false&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sender_approved = false&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then for each call frame:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Execute a call with the specified &lt;code&gt;mode&lt;&#x2F;code&gt;, &lt;code&gt;target&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt;, and &lt;code&gt;data&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;target&lt;&#x2F;code&gt; is null, set the call target to &lt;code&gt;tx.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If mode is &lt;code&gt;SENDER&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sender_approved&lt;&#x2F;code&gt; must be &lt;code&gt;true&lt;&#x2F;code&gt;. If not, the transaction is invalid.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;caller&lt;&#x2F;code&gt; as &lt;code&gt;tx.sender&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If mode is &lt;code&gt;DEFAULT&lt;&#x2F;code&gt; or &lt;code&gt;VERIFY&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;Set the &lt;code&gt;caller&lt;&#x2F;code&gt; to &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode returns frame &lt;code&gt;caller&lt;&#x2F;code&gt; throughout all call depths.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If frame has mode &lt;code&gt;VERIFY&lt;&#x2F;code&gt; and the frame did successfully call &lt;code&gt;APPROVE&lt;&#x2F;code&gt;, the transaction is invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After executing all frames, verify that &lt;code&gt;payer_approved == true&lt;&#x2F;code&gt;. If it is, refund any unpaid gas to the gas payer. If it is not, the whole transaction is invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Note: it is implied by the handling that the sender must approve the transaction &lt;em&gt;before&lt;&#x2F;em&gt; the payer and that once &lt;code&gt;sender_approved&lt;&#x2F;code&gt; or &lt;code&gt;payer_approved&lt;&#x2F;code&gt; become &lt;code&gt;true&lt;&#x2F;code&gt; they cannot be re-approved or reverted.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;frame-interactions&quot;&gt;Frame interactions&lt;&#x2F;h4&gt;
&lt;p&gt;A few cross-frame interactions to note:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the purposes of gas accounting of warm &#x2F; cold state status, the journal of such touches is shared across frames.&lt;&#x2F;li&gt;
&lt;li&gt;Discard the &lt;code&gt;TSTORE&lt;&#x2F;code&gt; and &lt;code&gt;TLOAD&lt;&#x2F;code&gt; transient storage between frames.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;gas-accounting&quot;&gt;Gas Accounting&lt;&#x2F;h4&gt;
&lt;p&gt;The total gas limit of the transaction is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_limit = FRAME_TX_INTRINSIC_COST + calldata_cost(rlp(tx.frames)) + sum(frame.gas_limit for all frames)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;calldata_cost&lt;&#x2F;code&gt; is calculated per standard EVM rules (4 gas per zero byte, 16 gas per non-zero byte).&lt;&#x2F;p&gt;
&lt;p&gt;The total fee is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_fee = tx_gas_limit * effective_gas_price + blob_fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blob_fees = len(blob_versioned_hashes) * GAS_PER_BLOB * blob_base_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; is calculated per EIP-1559 and &lt;code&gt;blob_fees&lt;&#x2F;code&gt; is calculated as per EIP-4844.&lt;&#x2F;p&gt;
&lt;p&gt;Each frame has its own &lt;code&gt;gas_limit&lt;&#x2F;code&gt; allocation. Unused gas from a frame is &lt;strong&gt;not&lt;&#x2F;strong&gt; available to subsequent frames. After all frames execute, the gas refund is calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;refund = sum(frame.gas_limit for all frames) - total_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This refund is returned to the gas payer (the &lt;code&gt;target&lt;&#x2F;code&gt; that called &lt;code&gt;APPROVE(0x1)&lt;&#x2F;code&gt; or &lt;code&gt;APPROVE(0x2)&lt;&#x2F;code&gt;) and added back to the block gas pool. &lt;em&gt;Note: This refund mechanism is separate from EIP-3529 storage refunds.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;canonical-signature-hash&quot;&gt;Canonical signature hash&lt;&#x2F;h3&gt;
&lt;p&gt;The canonical signature hash is provided in &lt;code&gt;TXPARAMLOAD&lt;&#x2F;code&gt; to simplify the development of smart accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Computing the signature hash in EVM is complicated and expensive. While using the canonical signature hash is not mandatory, it is strongly recommended. Creating a bespoke signature requires precise commitment to the underlying transaction data. Without this, it&#x27;s possible that some elements can be manipulated in-the-air while the transaction is pending and have unexpected effects. This is known as transaction malleability. Using the canonical signature hash avoids malleability of the frames other than &lt;code&gt;VERIFY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;frame.data&lt;&#x2F;code&gt; of &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frames is elided from the signature hash. This is done for two reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It contains the signature so by definition it cannot be part of the signature hash.&lt;&#x2F;li&gt;
&lt;li&gt;In the future it may be desired to aggregate the cryptographic operations for data and compute efficiency reasons. If the data was introspectable, it would not be possible to aggregate the verify frames in the future.&lt;&#x2F;li&gt;
&lt;li&gt;For gas sponsoring workflows, we also recommend using a &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frame to approve the gas payment. Here, the input data to the sponsor is intentionally left malleable so it can be added onto the transaction after the &lt;code&gt;sender&lt;&#x2F;code&gt; has made its signature. Notably, the &lt;code&gt;frame.target&lt;&#x2F;code&gt; of &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frames is covered by the signature hash, i.e. the &lt;code&gt;sender&lt;&#x2F;code&gt; chooses the sponsor address explicitly.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;approve-calling-convention&quot;&gt;&lt;code&gt;APPROVE&lt;&#x2F;code&gt; calling convention&lt;&#x2F;h3&gt;
&lt;p&gt;Originally &lt;code&gt;APPROVE&lt;&#x2F;code&gt; was meant to extend the space of return statuses from 0 and j 1 today to 0 to 4. However, this would mean smart accounts deployed today would not beable to modify their contract code to return with a different value at the top level. For this reason, we&#x27;ve chosen behavior above: &lt;code&gt;APPROVE&lt;&#x2F;code&gt; terminates the executing frame successfully like &lt;code&gt;RETURN&lt;&#x2F;code&gt;, but it actually updates the transaction scoped values &lt;code&gt;sender_approved&lt;&#x2F;code&gt; and &lt;code&gt;payer_approved&lt;&#x2F;code&gt; during execution. It is still required that only the sender can toggle the &lt;code&gt;sender_approved&lt;&#x2F;code&gt; to &lt;code&gt;true&lt;&#x2F;code&gt;. Only the &lt;code&gt;frame.target&lt;&#x2F;code&gt; can call &lt;code&gt;APPROVE&lt;&#x2F;code&gt; generally, because it can allow the transaction pool and other frames to better reason about &lt;code&gt;VERIFY&lt;&#x2F;code&gt; mode frames.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payer-in-receipt&quot;&gt;Payer in receipt&lt;&#x2F;h3&gt;
&lt;p&gt;The payer cannot be determined statically from a frame transaction and is relevant to users. The only way to provide this information safely and efficiently over the JSON-RPC is to record this data in the receipt object.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-authorization-list&quot;&gt;No authorization list&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP-7702 authorization list heavily relies on ECDSA cryptography to determine the authority of accounts to delegate code. While delegations could be used in other manners later, it does not satisfy the PQ goals of the frame transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-access-list&quot;&gt;No access list&lt;&#x2F;h3&gt;
&lt;p&gt;The access list was introduced to address a particular backwards compatibility issue that was caused by EIP-2929. The risk-reward of using an access list successfully is high. A single miss, paying to warm a storage slot that does not end up getting used, causes the overall transaction cost to be greater than had it not been included at all.&lt;&#x2F;p&gt;
&lt;p&gt;Future optimizations based on pre-announcing state elements a transaction will touch will be covered by block level access lists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-value-in-frame&quot;&gt;No value in frame&lt;&#x2F;h3&gt;
&lt;p&gt;It is not required because the account code can send value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;example-1-simple-transaction&quot;&gt;Example 1: Simple Transaction&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Target&lt;&#x2F;td&gt;&lt;td&gt;Call data&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Frame 0 verifies the signature and calls &lt;code&gt;APPROVE(0x2)&lt;&#x2F;code&gt; to approve both execution and payment. Frame 1 executes and exits normally via &lt;code&gt;RETURN&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The mempool can process this transaction with the following static validation and call:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that the first frame is a &lt;code&gt;VERIFY&lt;&#x2F;code&gt; frame.&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the call of frame 0 succeeds, and does not violate the mempool rules (similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7562&#x2F;&quot;&gt;ERC-7562&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;example-1a-simple-eth-transfer&quot;&gt;Example 1a: Simple ETH transfer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Destination&#x2F;Amount&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;A simple transfer is performed by instructing the account to send ETH to the destination account. This requires two frames for mempool compatibility, since the validation phase of the transaction has to be static.&lt;&#x2F;p&gt;
&lt;p&gt;This is listed here to illustrate why the transaction type has no built-in value field.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-1b-simple-account-deployment&quot;&gt;Example 1b: Simple account deployment&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Deployer&lt;&#x2F;td&gt;&lt;td&gt;Initcode, Salt&lt;&#x2F;td&gt;&lt;td&gt;DEFAULT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Destination&#x2F;Amount&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This example illustrates the initial deployment flow for a smart account at the &lt;code&gt;sender&lt;&#x2F;code&gt; address. Since the address needs to have code in order to validate the transaction, the transaction must deploy the code before verification.&lt;&#x2F;p&gt;
&lt;p&gt;The first frame would call a deployer contract, like EIP-7997. The deployer determines the address in a deterministic way, such as by hashing the initcode and salt. However, since the transaction sender is not authenticated at this point, the user must choose an initcode which is safe to deploy by anyone.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-2-sponsored-transaction-fee-payment-in-erc-20&quot;&gt;Example 2: Sponsored Transaction (Fee Payment in ERC-20)&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Frame&lt;&#x2F;th&gt;&lt;th&gt;Caller&lt;&#x2F;th&gt;&lt;th&gt;Target&lt;&#x2F;th&gt;&lt;th&gt;Data&lt;&#x2F;th&gt;&lt;th&gt;Mode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Null (sender)&lt;&#x2F;td&gt;&lt;td&gt;Signature&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Sponsor&lt;&#x2F;td&gt;&lt;td&gt;Sponsor data&lt;&#x2F;td&gt;&lt;td&gt;VERIFY&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;ERC-20&lt;&#x2F;td&gt;&lt;td&gt;transfer(Sponsor,fees)&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;Target addr&lt;&#x2F;td&gt;&lt;td&gt;Call data&lt;&#x2F;td&gt;&lt;td&gt;SENDER&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;ENTRY_POINT&lt;&#x2F;td&gt;&lt;td&gt;Sponsor&lt;&#x2F;td&gt;&lt;td&gt;Post op call&lt;&#x2F;td&gt;&lt;td&gt;DEFAULT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;Frame 0: Verifies signature and calls &lt;code&gt;APPROVE(0x0)&lt;&#x2F;code&gt; to authorize execution from sender.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 1: Checks that the user has enough ERC-20 tokens, and that the next frame is an ERC-20 send of the right size to the sponsor. Calls &lt;code&gt;APPROVE(0x1)&lt;&#x2F;code&gt; to authorize payment.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 2: Sends tokens to sponsor.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 3: User&#x27;s intended call.&lt;&#x2F;li&gt;
&lt;li&gt;Frame 4 (optional): Check unpaid gas, refund tokens, possibly convert tokens to ETH on an AMM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-efficiency&quot;&gt;Data Efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Basic transaction sending ETH from a smart account:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Bytes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Tx wrapper&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Chain ID&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nonce&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max priority fee&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max fee&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max fee per blob gas&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blob versioned hashes (empty)&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Frames wrapper&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: target&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: gas&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: data&lt;&#x2F;td&gt;&lt;td&gt;65&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sender validation frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: target&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: gas&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: data&lt;&#x2F;td&gt;&lt;td&gt;20+5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Execution frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;134&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes: Nonce assumes &amp;lt; 65536 prior sends. Fees assume &amp;lt; 1099 gwei. Validation frame target is 1 byte because target is &lt;code&gt;tx.sender&lt;&#x2F;code&gt;. Validation gas assumes &amp;lt;= 65,536 gas. Calldata is 65 bytes for ECDSA signature. Blob fields assume no blobs (empty list, zero max fee).&lt;&#x2F;p&gt;
&lt;p&gt;This is not much larger than an EIP-1559 transaction; the extra overhead is the need to specify the sender and amount in calldata explicitly.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;First transaction from an account (add deployment frame):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Bytes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: data&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Deployment frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total additional&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;124&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes: Gas assumes cost &amp;lt; 2^24. Calldata assumes small proxy.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Trustless pay-with-ERC-20 sponsor (add these frames):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Bytes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: calldata&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor validation frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: calldata&lt;&#x2F;td&gt;&lt;td&gt;68&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Send to sponsor frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: target&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: gas&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: calldata&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Sponsor post op frame: mode&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total additional&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;140&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes: Sponsor can read info from other fields. ERC-20 transfer call is 68 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;There is some inefficiency in the sponsor case, because the same sponsor address must appear in three places (sponsor validation, send to sponsor inside ERC-20 calldata, post op frame), and the ABI is inefficient (~12 + 24 bytes wasted on zeroes). This is difficult to mitigate in a &quot;clean&quot; way, because one of the duplicates is inside the ERC-20 call, &quot;opaque&quot; to the protocol. However, it is much less inefficient than ERC-4337, because not all of the data takes the hit of the 32-byte-per-field ABI overhead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode behavior changes for frame transactions, returning the frame&#x27;s caller rather than the traditional transaction origin. This is consistent with the precedent set by EIP-7702, which already modified &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; semantics. Contracts that rely on &lt;code&gt;ORIGIN = CALLER&lt;&#x2F;code&gt; for security checks (a discouraged pattern) may behave differently under frame transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transaction-propagation&quot;&gt;Transaction Propagation&lt;&#x2F;h3&gt;
&lt;p&gt;Frame transactions introduce new denial-of-service vectors for transaction pools that node operators must mitigate. Because validation logic is arbitrary EVM code, attackers can craft transactions that appear valid during initial validation but become invalid later. Without any additional policies, an attacker could submit many transactions whose validity depends on some shared state, then submit one transaction that modifies that state, and cause all other transactions to become invalid simultaneously. This wastes the computational resources nodes spent validating and storing these transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;example-attack&quot;&gt;Example Attack&lt;&#x2F;h4&gt;
&lt;p&gt;A simple example is transactions that check &lt;code&gt;block.timestamp&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validateTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; SOME_DEADLINE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;expired&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... rest of validation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    APPROVE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Such transactions are valid when submitted but become invalid once the deadline passes, without any on-chain action required from the attacker.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;mitigations&quot;&gt;Mitigations&lt;&#x2F;h5&gt;
&lt;p&gt;Node implementations should consider restricting which opcodes and storage slots validation frames can access, similar to ERC-7562. This isolates transactions from each other and limits mass invalidation vectors.&lt;&#x2F;p&gt;
&lt;p&gt;It&#x27;s recommended that to &lt;em&gt;validate&lt;&#x2F;em&gt; the transaction, a specific frame structure is enforced and the amount of gas that is expended executing the validation phase must be limited. Once the frame calls &lt;code&gt;APPROVE(0x2)&lt;&#x2F;code&gt;, it can be included in the mempool and propagated to peers safely.&lt;&#x2F;p&gt;
&lt;p&gt;For deployment of the sender account in the first frame, the mempool must only allow specific and known deployer factory  contracts to be used as &lt;code&gt;frame.target&lt;&#x2F;code&gt;, to ensure deployment is deterministic and independent of chain state.&lt;&#x2F;p&gt;
&lt;p&gt;In general, it can be assumed that handling of frame transactions imposes similar restrictions as EIP-7702 on mempool relay, i.e. only a single transaction can be pending for an account that uses frame transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-in-Blobs (BiB)</title>
        <published>2026-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Jihoon Song</name><email>jihoon.song@ethereum.org</email>
	</author>
	
	<author>
		<name>Francesco Risitano</name><uri>https://github.com/frisitano</uri>
	</author>
	
	<author>
		<name>Thomas Thiery</name><uri>https://github.com/soispoke</uri><email>thomas.thiery@ethereum.org</email>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8142/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8142-block-in-blobs-bib/27621" />
        

        <id>https://wg-eips.ritovision.com/8142/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8142"
            label="EIP-8142" />
        

        
        

        
        <summary type="html">Ensures execution payload data availability via blobs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8142/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;zkEVMs allow validators to verify the correctness of an execution payload using a proof, without downloading or executing the payload itself. However, removing the requirement to download the execution payload, also removes the implicit data availability (DA) guarantee; a block producer can publish a valid proof and withhold the execution-payload data since attesters no longer need them for consensus.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP introduces Block-in-Blobs (BiB), a mechanism that requires the execution-payload data (transactions and BALs) to be published in blob data, in the same beacon block that carries the corresponding execution payload&#x27;s header. This ensures that execution payloads and their associated data are always published even when validators no longer require them to verify the state transition function (STF).&lt;&#x2F;p&gt;
&lt;p&gt;In short, BiB works by having the block producer encode the execution-payload data into blobs as part of the execution layer&#x27;s STF, requiring the beacon block’s blob KZG commitments to commit to those payload-blobs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Validation via re-execution&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Today, validators verify execution payloads by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Downloading the execution payload&lt;&#x2F;li&gt;
&lt;li&gt;Executing the payload locally&lt;&#x2F;li&gt;
&lt;li&gt;Checking the resulting state root and other fields against the fields in the header&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Implicitly this guarantees execution payload availability because the payload cannot be verified unless the node downloads it.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Validation with zkEVMs&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With zkEVMs, validators instead:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Download a proof attesting to the correctness of the execution payload&lt;&#x2F;li&gt;
&lt;li&gt;Download the execution payload header&lt;&#x2F;li&gt;
&lt;li&gt;Verify the proof with respects to the payload header (and other commitments)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In this model, validators no longer require access to the full execution payload data itself in order to verify its correctness.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The DA problem&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Removing the re-execution requirement in consensus removes the implicit requirement that consensus clients download the execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;A malicious or rational builder could:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Publish a valid proof for a valid execution payload&lt;&#x2F;li&gt;
&lt;li&gt;Withhold the execution-payload data entirely&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Builders&lt;&#x2F;em&gt;: Since builders will always need to re-execute in order to build blocks, a malicious builder would not publish the execution payload ensuring that they are the only ones that can build on top of the current chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;RPC and indexers&lt;&#x2F;em&gt;: Many nodes such as RPC providers and indexers cannot solely rely on execution proofs and must re-execute the execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;BiB addresses this by making the execution payload available via blobs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Type-3 transaction:&lt;&#x2F;strong&gt; Refers to EIP-4844 blob-carrying transactions (transaction type 0x03). These transactions include blob versioned hashes that commit to blobs carrying user data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview-and-invariants&quot;&gt;Overview and Invariants&lt;&#x2F;h3&gt;
&lt;p&gt;BiB ensures the proven payload is published:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The beacon block references a list of blob KZG commitments (via 4844&#x2F;PeerDas)&lt;&#x2F;li&gt;
&lt;li&gt;A prefix of those commitments is reserved for the execution-payload data encoded into blobs&lt;&#x2F;li&gt;
&lt;li&gt;A zkEVM proof for the block must bind the proven execution payload to those prefixed blob commitments.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Payload availability invariant:&lt;&#x2F;strong&gt; A valid block implies there exists an ordered list of blobs whose bytes decode to the canonical execution-payload data, and the KZG commitments for these blobs match the first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; blob commitments referenced by the block. The existing DAS mechanism will ensure that those blobs are available.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;referenced-parameters&quot;&gt;Referenced Parameters&lt;&#x2F;h4&gt;
&lt;p&gt;These parameters are defined in EIP-4844 and related specs:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Source&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;EIP-4844&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;EIP-4844&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;EIP-4844&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Network-specific&lt;&#x2F;td&gt;&lt;td&gt;EIP-7892&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Note on &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;:&lt;&#x2F;strong&gt; This constant represents the maximum number of blobs (both payload-blobs and type-3 transaction blobs) that can be included in a block. Per EIP-7892, the execution layer&#x27;s &lt;code&gt;blobSchedule.max&lt;&#x2F;code&gt; MUST equal the consensus layer&#x27;s &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt; configuration value at any given time. This value may change across forks (e.g., initially 6 in EIP-4844, potentially increased in subsequent blob throughput increase proposals).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;derived-constants&quot;&gt;Derived Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT - 1&lt;&#x2F;code&gt; (31)&lt;&#x2F;td&gt;&lt;td&gt;Usable bytes per field element (final byte must be zero to stay under BLS modulus)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;USABLE_BYTES_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB * USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Total usable bytes per blob&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Summary:&lt;&#x2F;strong&gt; The execution layer is modified in the following ways:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The ExecutionPayloadHeader now has a &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; field to track how many blobs are used for the execution payload data, enabling verification of the correct number of payload-blobs at the Engine API boundary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;engine_getPayload&lt;&#x2F;code&gt; computes the payload-blobs when building a block, sets &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; in the ExecutionPayloadHeader, and returns the payload blobs (with their commitments and proofs) alongside type-3 transaction blobs in the response.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;engine_newPayload&lt;&#x2F;code&gt; takes the ExecutionPayload and before passing it to the EL STF, it computes the payload-blobs, checks that the amount of blobs needed is equal to the &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; value in the ExecutionPayloadHeader and verifies that the expected version hashes match.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;referenced-helpers&quot;&gt;Referenced Helpers&lt;&#x2F;h4&gt;
&lt;p&gt;The execution layer uses methods and classes defined in the corresponding consensus 4844&#x2F;7594 specs.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, we use the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;46c1199d6b4584ba484dec807f03b8e6211dd725&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md?#introduction&quot;&gt;polynomial-commitments.md&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;46c1199d6b4584ba484dec807f03b8e6211dd725&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#L578&quot;&gt;verify_blob_kzg_proof_batch&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#blob_to_kzg_commitment&quot;&gt;blob_to_kzg_commitment&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#compute_blob_kzg_proof&quot;&gt;compute_blob_kzg_proof&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2938e1ad74cea54f1a24508a85704d5bd87837ad&#x2F;specs&#x2F;fulu&#x2F;polynomial-commitments-sampling.md&quot;&gt;polynomial-commitments-sampling.md&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2938e1ad74cea54f1a24508a85704d5bd87837ad&#x2F;specs&#x2F;fulu&#x2F;polynomial-commitments-sampling.md#compute_cells_and_kzg_proofs&quot;&gt;compute_cells_and_kzg_proofs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;And the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#introduction&quot;&gt;beacon-chain.md&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#kzg_commitment_to_versioned_hash&quot;&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;bytes-to-blobs&quot;&gt;bytes_to_blobs&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bytes_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Pack arbitrary bytes into one or more blobs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Remaining space in final blob is zero-padded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk_to_blob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blobs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chunk_to_blob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Pack up to USABLE_BYTES_PER_BLOB bytes into a single blob.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    If data is shorter than USABLE_BYTES_PER_BLOB, it is zero-padded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Each 31-byte chunk is stored in bytes [0:31] of a field element,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    with byte [31] (the final byte) set to zero to ensure value &amp;lt; BLS modulus.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pad to exactly USABLE_BYTES_PER_BLOB if needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;USABLE_BYTES_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chunk&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chunk_start&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; chunk_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store 31 data bytes in [0:31], the final byte [31] stays zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Blob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;blobs-to-bytes&quot;&gt;blobs_to_bytes&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blobs_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blobs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Unpack blobs back to bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns all usable bytes from all blobs (including any padding).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; blob&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; blobs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        raw&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob_to_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blob_to_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Blob&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Extract the 31 usable bytes from each field element.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Validates that the final byte is zero for each field element.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    result&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate final byte is zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; blob&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Invalid blob: final byte must be zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract usable data bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        result&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blob&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; USABLE_BYTES_PER_FIELD_ELEMENT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;get-execution-payload-data&quot;&gt;get_execution_payload_data&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Extract the data from an ExecutionPayload that must be made available via blobs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blockAccessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;execution-payload-data-to-blobs&quot;&gt;execution_payload_data_to_blobs&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Canonically encode the execution-payload data into an ordered list of blobs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Encoding steps:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      1. bal_bytes = data.blockAccessList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      2. transactions_bytes = RLP.encode(data.transactions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      3. Create 10-byte header: [2 bytes version][4 bytes BAL length][4 bytes tx length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      4. payload_bytes = header + bal_bytes + transactions_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      5. return bytes_to_blobs(payload_bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The first blob will contain (in order):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [2 bytes] Payload encoding version (currently 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [4 bytes] BAL data length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [4 bytes] Transaction data length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [variable] BAL data (may span multiple blobs)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      - [variable] Transaction data (may span multiple blobs)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    This allows extracting just the BAL data without transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Note: blockAccessList is already RLP-encoded per EIP-7928. Transactions are RLP-encoded as a list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create 10-byte header: [2 bytes version][4 bytes BAL length][4 bytes tx length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bal_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; txs_length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Combine header + data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; transactions_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bytes_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;blobs-to-execution-payload-data&quot;&gt;blobs_to_execution_payload_data&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; blobs_to_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;blobs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Canonically decode an ordered list of blobs into execution-payload data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Decoding steps:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      1. raw = blobs_to_bytes(blobs)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      2. Read 10-byte header: [2 bytes version][4 bytes BAL length][4 bytes tx length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      3. Validate version is 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      4. Split into bal_bytes and transactions_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      5. return ExecutionPayloadData(blockAccessList, transactions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract raw bytes from blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; blobs_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read 10-byte header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; f&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Unsupported payload encoding version: &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract data portions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; raw&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; bal_length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; txs_length&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;blockAccessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;bal_bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;extract-data-from-type-3-tx&quot;&gt;extract_data_from_type_3_tx&lt;&#x2F;h5&gt;
&lt;p&gt;This method will be used to implement the modified logic in engine_getPayload.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extract_data_from_type_3_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Blob&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGProof&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Extract blobs, KZG commitments, and cell proofs from type-3 (blob) transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns a tuple of (blobs, commitments, cell_proofs) in the order they appear&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    in the transaction list.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Implementation note: This is not new logic - a function(s) like this should already be available in your existing getPayload&#x2F;blob bundle implementation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Invertibility invariant:&lt;&#x2F;strong&gt; &lt;code&gt;execution_payload_data_to_blobs&lt;&#x2F;code&gt; and &lt;code&gt;blobs_to_execution_payload_data&lt;&#x2F;code&gt; are mutual inverses on valid execution-payload data.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-structures&quot;&gt;Data structures&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;executionpayloaddata&quot;&gt;ExecutionPayloadData&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Execution-payload data&lt;&#x2F;strong&gt; refers to the subset of the ExecutionPayload that must be made available via blobs. This includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;bals&lt;&#x2F;code&gt; (Block Access List added in EIP-7928)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transactions&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8142&#x2F;#what-is-included-in-execution-payload-data&quot;&gt;What is included in execution-payload data?&lt;&#x2F;a&gt; in the Rationale for details.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Block Access List (BAL) from EIP-7928, RLP-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blockAccessList&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of transactions, each transaction is RLP-encoded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This is not an SSZ Container - fields are RLP-encoded as described in the encoding functions. The &lt;code&gt;MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;code&gt; bound is inherited from the ExecutionPayload field limit defined in the consensus specification.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;executionpayloadheader&quot;&gt;ExecutionPayloadHeader&lt;&#x2F;h5&gt;
&lt;p&gt;This EIP adds a new field to the &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;payload_blob_count : uint64&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Semantics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; be the ordered list of kzg commitments referenced by the beacon block&lt;&#x2F;li&gt;
&lt;li&gt;The first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; entries of &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; are the payload-blob commitments (i.e. commitments to the blobs that correspond to the payload data)&lt;&#x2F;li&gt;
&lt;li&gt;The remaining entries (if any) are for type-3 blob transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;blobsbundle&quot;&gt;BlobsBundle&lt;&#x2F;h5&gt;
&lt;p&gt;For the zkEVM-optimized variant of &lt;code&gt;engine_getPayload&lt;&#x2F;code&gt;, this EIP extends &lt;code&gt;BlobsBundle&lt;&#x2F;code&gt; with an additional field:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;payload_kzg_proofs&lt;&#x2F;code&gt;: List[KZGProof]&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Semantics:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Contains random point KZG proofs for payload blobs only (not type-3 transaction blobs)&lt;&#x2F;li&gt;
&lt;li&gt;Used as private inputs to the zkEVM circuit for payload consistency verification via &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The length of this list equals &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h4&gt;
&lt;p&gt;This section specifies two equivalent formulations of &lt;code&gt;new_payload&lt;&#x2F;code&gt;. Implementers choose one based on their execution context:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Native execution variant&lt;&#x2F;strong&gt;: Uses &lt;code&gt;blob_to_kzg_commitment&lt;&#x2F;code&gt; directly. Suitable for pre mandatory proofs implementations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;zkEVM-optimized variant&lt;&#x2F;strong&gt;: Uses polynomial openings via &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;. Avoids the multiscalar multiplication (MSM) which is expensive to prove in a zkEVM circuit.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both variants enforce identical validity conditions. A block valid under one is valid under the other.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;engine-getpayload-native-variant&quot;&gt;engine_getPayload - Native Variant&lt;&#x2F;h5&gt;
&lt;p&gt;The builder must compute the payload blob count when constructing the block:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Build the block (select transactions, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; build_execution_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Compute payload blobs to determine count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Set the count in the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Compute blob commitments and cell proofs for payload blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;blob_to_kzg_commitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute cells and cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_cells_and_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 6. Extract type-3 transaction blobs, commitments, and cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extract_data_from_type_3_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 7. Combine: payload blobs first, then type-3 blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_versioned_hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        execution_payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blobs_bundle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;BlobsBundle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_cell_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;calculate_block_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: The builder must account for payload blob usage when selecting type-3 transactions to ensure the total blob count does not exceed &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;engine-getpayload-zkevm-optimized-variant&quot;&gt;engine_getPayload - zkEVM-Optimized Variant&lt;&#x2F;h5&gt;
&lt;p&gt;For the zkEVM-optimized variant, the builder must additionally compute random point KZG proofs for the payload blobs, which will be used as private inputs in the zkEVM circuit for payload consistency verification.&lt;&#x2F;p&gt;
&lt;p&gt;This variant extends &lt;code&gt;BlobsBundle&lt;&#x2F;code&gt; with an additional &lt;code&gt;payload_kzg_proofs&lt;&#x2F;code&gt; field containing random point KZG proofs for payload blobs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_payload_zk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadId&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Build the block (select transactions, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; build_execution_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Compute payload blobs to determine count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Set the count in the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Compute commitments, cell proofs, and random point proofs for payload blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;blob_to_kzg_commitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_cells_and_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_cells_and_proofs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random point proofs for payload consistency verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_random_point_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_blob_kzg_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 6. Extract type-3 transaction blobs, commitments, and cell proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extract_data_from_type_3_tx&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 7. Combine: payload blobs first, then type-3 blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload_cell_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_cell_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; GetPayloadResponse&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        execution_payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blobs_bundle&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;BlobsBundle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;all_cell_proofs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            payload_kzg_proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_random_point_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;calculate_block_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Note for implementors:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;payload_kzg_proofs&lt;&#x2F;code&gt; field contains KZG opening proofs for payload blobs only. It is used for payload consistency verification via &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The builder&#x2F;prover should extract the first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; commitments from &lt;code&gt;all_commitments&lt;&#x2F;code&gt; (i.e., &lt;code&gt;all_commitments[:payload_blob_count]&lt;&#x2F;code&gt;). This corresponds to the &lt;code&gt;payload_kzg_commitments&lt;&#x2F;code&gt; parameter in the zkEVM variant of &lt;code&gt;engine_newPayload&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;engine-newpayload-native-execution-variant&quot;&gt;engine_newPayload - Native Execution Variant&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PayloadStatus&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Derive payload blobs and commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;blob_to_kzg_commitment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_commitments&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Verify payload_blob_count matches header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; payload_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Extract type-3 tx versioned hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            type3_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Verify versioned hashes: payload blobs first, then type-3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; type3_versioned_hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 5. Run EL STF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; execute_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;engine-newpayload-zkevm-optimized-variant&quot;&gt;engine_newPayload - zkEVM-Optimized Variant&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; Once zkEVM proofs are required for consensus, &lt;code&gt;newPayload&lt;&#x2F;code&gt; will be executed inside a zkEVM to generate a proof, rather than being executed natively by validators. This variant is designed to be cheaper in that context.&lt;&#x2F;p&gt;
&lt;p&gt;This variant replaces the MSM in &lt;code&gt;blob_to_kzg_commitment&lt;&#x2F;code&gt; with polynomial opening proofs, which are cheaper to verify inside a zkEVM. The payload, commitments and KZG proofs are private inputs to the zkEVM circuit, while the corresponding versioned hashes (and payload header) are public inputs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; new_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BiB additions: prefix metadata for payload blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; private input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    payload_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGProof&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; private input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; PayloadStatus&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0. Declared payload blob count from the header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload_blob_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_proofs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Construct payload blobs from execution-payload data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_execution_payload_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_data_to_blobs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Check the commitments correspond to the expected versioned hash prefix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        kzg_commitment_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; payload_kzg_commitments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; expected_blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; payload_versioned_hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Verify blob–commitment consistency using batch KZG proof verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; verify_blob_kzg_proof_batch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        blobs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_blobs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        commitments&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        proofs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload_kzg_proofs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 4. Proceed with standard EL payload validation &#x2F; execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; execute_payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;The consensus layer does not introduce new blob specific validation rules for payload-blobs beyond what we have for EIP-4844&#x2F;EIP-7594.&lt;&#x2F;p&gt;
&lt;p&gt;The Consensus Layer relies on &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; in the ExecutionPayloadHeader to interpret the ordering of blob commitments, but otherwise treats payload blobs identically to other blobs for availability and networking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;&#x2F;h3&gt;
&lt;p&gt;BiB reuses the existing blob networking mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;We note the following for consideration:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Once proofs are made mandatory, a mechanism will be needed for execution payload retrieval.  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt; introduces an &lt;code&gt;execution_payload&lt;&#x2F;code&gt; gossip topic that we can use for this purpose. However, in the context of mandatory proofs where a super majority of stake operates zk validators (which only listen to header topics), a malicious builder could publish only the payload in blobs and gossip the execution payload header without gossiping on the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; topic. This would allow zk validators to attest, but other nodes depending on the full payload from the gossip topic would be unable to progress.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;To mitigate this, nodes can implement a fallback mechanism: if they don&#x27;t receive the payload on the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; topic, they reconstruct it from the first &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt; blobs and then seed the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; topic themselves. This creates a resilient system where every node acts as a &quot;bridge node&quot; when needed, similar to how rollups use L2 gossip as a fast path but fall back to L1 data availability.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Unlike most type-3 blob transactions, payload-blobs will not have been propagated to the network before a block is built. Depending on the deadlines imposed by ePBS, this may imply higher bandwidth requirements from block builders.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;fee-accounting&quot;&gt;Fee Accounting&lt;&#x2F;h3&gt;
&lt;p&gt;BiB introduces protocol mandated blob usage, rather than user initiated via type-3 transactions. Fee accounting for payload-blobs differ in nature from transaction blob fees as a result.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;who-pays&quot;&gt;Who pays?&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP does not mandate that payload-blobs pay a per-blob fee like transaction blobs.&lt;&#x2F;p&gt;
&lt;p&gt;Instead payload-blobs are treated as a protocol-accepted cost when constructing the block. In particular:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Payload-blobs do not correspond to a user transaction and therefore do not naturally map to a user-paid blob fee.&lt;&#x2F;li&gt;
&lt;li&gt;The cost of including payload-blobs, in terms of blob gas usage, is accepted by the protocol as a necessary cost for maintaining data availability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;do-payload-blobs-compete-with-transaction-blobs-for-capacity&quot;&gt;Do payload-blobs compete with transaction blobs for capacity?&lt;&#x2F;h4&gt;
&lt;p&gt;Because payload blobs consume blob gas, they directly influence blob congestion and the blob base fee.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;can-a-builder-artificially-inflate-blob-gas-usage&quot;&gt;Can a builder artificially inflate blob gas usage?&lt;&#x2F;h4&gt;
&lt;p&gt;A potential concern is whether a malicious builder could create artificially large execution payloads to inflate blob gas usage.&lt;&#x2F;p&gt;
&lt;p&gt;This attack is economically constrained: to increase the size of the execution payload, a builder must include additional transactions with calldata. Since calldata costs execution gas, the builder would need to pay for this additional data through the normal gas mechanism. The cost of including extra calldata makes it economically unfavorable to artificially inflate payload size solely to manipulate blob fees.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;open-questions-and-future-considerations&quot;&gt;Open questions and future considerations&lt;&#x2F;h4&gt;
&lt;!-- TODO --&gt;
&lt;ul&gt;
&lt;li&gt;Networking related: Payload-blobs require higher bandwidth due to the fact that they will not have been in the public mempool&lt;&#x2F;li&gt;
&lt;li&gt;Explicit protocol level pricing for payload blobs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;what-is-included-in-execution-payload-data&quot;&gt;What is included in execution-payload data?&lt;&#x2F;h3&gt;
&lt;p&gt;Execution-payload data includes &lt;code&gt;bals&lt;&#x2F;code&gt; (Block Access Lists from EIP-7928) and &lt;code&gt;transactions&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why transactions?&lt;&#x2F;strong&gt; Transaction data is the only component of the execution payload that cannot be derived from other components and is not provided by the consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why BALs?&lt;&#x2F;strong&gt; While BALs are technically the output of executing transactions and could be recomputed, once zkEVM proofs become mandatory for consensus, validators no longer execute payloads. A malicious builder could publish a valid proof and withhold both the execution payload data and the BALs. This would prevent other builders from constructing subsequent blocks and prevent RPC providers from serving the full state. Including BALs in payload-blobs ensures they remain available.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why not withdrawals?&lt;&#x2F;strong&gt; Withdrawals can be derived on the consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why not execution requests?&lt;&#x2F;strong&gt; Execution requests can be recomputed from transactions and do not suffer from the same withholding attack as BALs because they are required by the consensus layer for validation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why not the header?&lt;&#x2F;strong&gt; The header cannot be put into blobs because it contains &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt;, which depends on the number of blobs; causing a circular dependency.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Encoding optimization:&lt;&#x2F;strong&gt; The encoding includes an 8-byte header: &lt;code&gt;[4 bytes BAL length] [4 bytes transaction length]&lt;&#x2F;code&gt;. This allows extracting just the tx data after fetching the first blob.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TODO: We could also put the number of blobs that the BAL occupies in the execution payload header.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;builder-discretion-vs-reserving-k-blobs&quot;&gt;Builder discretion vs reserving &lt;code&gt;k&lt;&#x2F;code&gt; blobs&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP specifies that the block builder choose &lt;code&gt;payload_blob_count&lt;&#x2F;code&gt;, subject to the constraint imposed by &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative would have been to always reserve &lt;code&gt;k&lt;&#x2F;code&gt; blobs, where &lt;code&gt;k&lt;&#x2F;code&gt; corresponds to the worst case execution payload size. While this provides better predictability, it reduces flexibility under blob congestion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-encode-execution-payload-data-inside-the-core-el-execution-logic&quot;&gt;Why not encode execution-payload data inside the core EL execution logic?&lt;&#x2F;h3&gt;
&lt;p&gt;Doing it in the EL STF would require payload-blob commitments or versioned hashes to be made visible inside the core execution logic, rather than being handled at the Engine API boundary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;when-zkevm-proofs-become-mandatory-why-can-t-zk-attestors-download-the-full-execution-payload&quot;&gt;When zkEVM proofs become mandatory, why can&#x27;t zk-attestors download the full execution payload?&lt;&#x2F;h3&gt;
&lt;p&gt;The execution payload grows linearly with the gas limit. Requiring attesters to download the payload for DA would create an increasing bandwidth burden as the gas limit grows.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compression-algorithm-for-encoding-execution-payload-data&quot;&gt;Compression algorithm for encoding execution-payload data&lt;&#x2F;h3&gt;
&lt;p&gt;Compression can be used on the serialized execution-payload data. This (in theory) should allow the usage of less payload-blobs, depending on the compression ratio. The tradeoffs being:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;That we will use more CPU&#x2F;proving cycles for decompression&lt;&#x2F;li&gt;
&lt;li&gt;A breaking change since we want to decompress on the hot-path. What this means is that the transactions would need to be compressed in the payload, and then decompressed when we attempt to validate it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Whether we should use a compression algorithm and which one requires more investigation, in particular we need to investigate:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The average compression ratios achieved&lt;&#x2F;li&gt;
&lt;li&gt;The proving cycle overhead&lt;&#x2F;li&gt;
&lt;li&gt;The invasiveness of now requiring consensus aware objects to be compressed when passed for validation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For now we recommend using no compression algorithm and operating on uncompressed data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;serialization-algorithm-for-encoding-execution-payload-data&quot;&gt;Serialization algorithm for encoding execution-payload data&lt;&#x2F;h3&gt;
&lt;p&gt;Serialization of the execution-payload data uses RLP. Since transactions in the ExecutionPayload are already RLP-encoded, we simply RLP-encode the list of transaction bytes without any additional transformation.&lt;&#x2F;p&gt;
&lt;p&gt;While a more zk-friendly serialization algorithm could be beneficial in the future, this EIP uses RLP for simplicity. Once EIP-7807 (SSZ execution blocks) is implemented, the encoding can be updated to SSZ-serialize the list of SSZ-encoded transaction bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This requires changes to the execution payload header and the EL STF; so requires a fork. Nodes that do not implement BiB will not be able to validate blocks after activation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Interaction with blob congestion and denial-of-service&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Payload-blobs consume blob gas and therefore are subject to the same congestion control mechanisms and blob limits as transaction blobs.&lt;&#x2F;p&gt;
&lt;p&gt;As a byproduct, this ensures that a malicious block producer cannot make arbitrarily large execution payloads without accounting for blob gas limits. While a block producer could theoretically drive up the blob base fee by creating large payloads, this attack is economically constrained by calldata costs (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8142&#x2F;#fee-accounting&quot;&gt;Fee Accounting&lt;&#x2F;a&gt; for details).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Data withholding&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;An attacker cannot withhold execution payload data without also withholding blob data, which would violate existing DAS guarantees and cause the block to be rejected by the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Temporary Contract Storage</title>
        <published>2026-01-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8125/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip8125-temporary-contract-storage/27440" />
        

        <id>https://wg-eips.ritovision.com/8125/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8125"
            label="EIP-8125" />
        

        
        

        
        <summary type="html">Adds bounded-lifetime contract storage via TMPLOAD&#x2F;TMPSTORE opcodes that is automatically cleared on a fixed schedule.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8125/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces &lt;em&gt;temporary storage&lt;&#x2F;em&gt;: a new contract-accessible key-value store that persists across transactions and blocks, but is automatically cleared at a protocol-defined schedule. Two new opcodes are added:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TMPSTORE(key, value)&lt;&#x2F;code&gt; to write temporary storage for the executing contract.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TMPLOAD(key)&lt;&#x2F;code&gt; to read temporary storage for the executing contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Temporary storage is intended for data that does not need indefinite retention, providing a safer alternative to using permanent state for ephemeral data and enabling bounded growth of this class of state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8125&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Figure 1: Over 60% of the storage slots are written once and never accessed again onchain.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Permanent contract storage is costly because it increases long-term node resource requirements (disk, I&#x2F;O, state maintenance). However, many applications write data that is only valuable for a bounded time window.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bounded lifetime semantics&lt;&#x2F;strong&gt; without requiring explicit deletes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Predictable clearing&lt;&#x2F;strong&gt; that can be relied upon at the application layer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;A building block&lt;&#x2F;strong&gt; for reducing state growth created by ephemeral use cases.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants-and-parameters&quot;&gt;Constants and parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Activation block of this EIP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The number of blocks that the temporary storage holds for a given period&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;First reserved address used to store temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Second reserved address used to store temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TMPLOAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost of a warm read at temporary storage slot&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_TMPLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost surchage of a cold access at the temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TMPSTORE_SET_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost of setting a slot from zero to non-zero at the temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TMPSTORE_RESET_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The gas cost of changing a non-zero slot to another value at the temporary storage&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;temporary-storage-data-model&quot;&gt;Temporary storage data model&lt;&#x2F;h3&gt;
&lt;p&gt;Temporary storage is backed by &lt;strong&gt;two reserved system accounts&lt;&#x2F;strong&gt; at &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;code&gt; and &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The temporary storage keyspace is a mapping of &lt;code&gt;(contract_address, key) -&amp;gt; value&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;derived_slot_key = keccak256(contract_address || key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Temporary storage values are stored in the regular storage tries of the system accounts using &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; as the slot key.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;periodic-rollover-storage-reset&quot;&gt;Periodic rollover (storage reset)&lt;&#x2F;h3&gt;
&lt;p&gt;Temporary storage is organized into periods, each of length &lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt; blocks after activation.&lt;&#x2F;p&gt;
&lt;p&gt;For blocks with &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, define:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;period_index(block_number) = floor((block_number - FORK_BLOCK) &#x2F; TEMP_STORAGE_PERIOD)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Define the current and previous system accounts for a block &lt;code&gt;B&lt;&#x2F;code&gt; (where &lt;code&gt;B.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;) as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;current_index = period_index(B.number) % 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if current_index == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CURRENT_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PREVIOUS_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else if current_index == 1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CURRENT_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    PREVIOUS_SYSADDR = TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the first block of each new period, the protocol MUST clear the storage of the system account that becomes the current.&lt;&#x2F;p&gt;
&lt;p&gt;When processing a block &lt;code&gt;B&lt;&#x2F;code&gt; (with parent &lt;code&gt;P&lt;&#x2F;code&gt;) where both are &lt;code&gt;&amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, if &lt;code&gt;period_index(B.number) &amp;gt; period_index(P.number)&lt;&#x2F;code&gt;, then before executing transactions in &lt;code&gt;B&lt;&#x2F;code&gt;, the protocol MUST perform:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CURRENT_SYSADDR.storageRoot = EMPTY_TRIE_ROOT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;where &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt; is computed from &lt;code&gt;B.number&lt;&#x2F;code&gt; as specified above.&lt;&#x2F;p&gt;
&lt;p&gt;No other accounts are modified by the rollover.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Effect:&lt;&#x2F;strong&gt; After rollover, entries written in the immediately previous period remain readable via &lt;code&gt;PREVIOUS_SYSADDR&lt;&#x2F;code&gt; for one additional period, while entries older than one period are removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-opcodes&quot;&gt;New opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;Add 2 new opcodes as follows:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tmpload-key&quot;&gt;&lt;code&gt;TMPLOAD(key)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Compute &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;(contract_address, key)&lt;&#x2F;code&gt;. Then load &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt; first. If it doesn&#x27;t exist (i.e. &lt;code&gt;value == 0&lt;&#x2F;code&gt; ), then load &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;PREV_SYSADDR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tmpstore-key-value&quot;&gt;&lt;code&gt;TMPSTORE(key,value)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Compute &lt;code&gt;derived_slot_key&lt;&#x2F;code&gt; from &lt;code&gt;(contract_address, key)&lt;&#x2F;code&gt;. Then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;value != 0&lt;&#x2F;code&gt;, store in the storage of &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;value == 0&lt;&#x2F;code&gt;, delete slot from both &lt;code&gt;CURRENT_SYSADDR&lt;&#x2F;code&gt; and &lt;code&gt;PREV_SYSADDR&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Rationale:&lt;&#x2F;strong&gt; Because reads fall back from current to previous, clearing only the current store would allow an older previous-period value to be returned. Clearing both ensures &lt;code&gt;TMPSTORE(key,0)&lt;&#x2F;code&gt; makes subsequent &lt;code&gt;TMPLOAD(key)&lt;&#x2F;code&gt; return &lt;code&gt;0&lt;&#x2F;code&gt; (until a new non-zero is written).&lt;&#x2F;p&gt;
&lt;p&gt;The call rules should follow &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gas rules should follow the conventions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; referencing &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, except that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The gas costs should be much lower than &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, but higher than &lt;code&gt;TSLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;No refunds are given for clearing temporary storage&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TMPLOAD&lt;&#x2F;code&gt; MAY perform up to 2 storage reads (current then previous). Gas MUST account for this behaviour.&lt;&#x2F;li&gt;
&lt;li&gt;Deletion in &lt;code&gt;TMPSTORE&lt;&#x2F;code&gt; is more expensive than creation&#x2F;modification as the storage root of both system accounts are updated. Gas MUST account for this behaviour.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;activation-and-reserved-address&quot;&gt;Activation and reserved address&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, the chain MUST treat &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_0&lt;&#x2F;code&gt; and &lt;code&gt;TEMP_STORAGE_SYSTEM_ADDRESS_1&lt;&#x2F;code&gt; as reserved addresses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If either does not exist in the state trie, it is created with:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;nonce = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;balance = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;codeHash = EMPTY_CODE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;storageRoot = EMPTY_TRIE_ROOT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;No contract code is deployed at this address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-just-use-transient-storage-eip-1153&quot;&gt;Why not just use transient storage (EIP-1153)?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; (transient storage) is discarded after every transaction, which is ideal for intra-tx operations. This EIP targets a different class of use cases where data must persist across multiple transactions&#x2F;blocks, but does not need indefinite retention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-period-rollover&quot;&gt;Why two-period rollover?&lt;&#x2F;h3&gt;
&lt;p&gt;Two-period rollover provides a stronger usability guarantee:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An entry is retained for &lt;strong&gt;at least&lt;&#x2F;strong&gt; one full &lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt; after it is written (it will be readable in the next period via the previous-period system account).&lt;&#x2F;li&gt;
&lt;li&gt;An entry is retained for &lt;strong&gt;at most&lt;&#x2F;strong&gt; two periods (once the current-period system account is cleared and reused).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This provides a simple mental model for contract developers. That is, if an entry is stored in temporary storage, it will at least last for &lt;code&gt;TEMP_STORAGE_PERIOD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, a single global rollover makes effective lifetime depend on when data is written within the period: a write near the end of a period could be cleared almost immediately, which may not be developer-friendly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-system-accounts&quot;&gt;Why two system accounts?&lt;&#x2F;h3&gt;
&lt;p&gt;Using two reserved system accounts allows constant-time rollover:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At each period boundary, only the &lt;strong&gt;current-period&lt;&#x2F;strong&gt; system account is reset by setting a single &lt;code&gt;storageRoot = EMPTY_TRIE_ROOT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The previous-period system account remains intact for one more period.&lt;&#x2F;li&gt;
&lt;li&gt;Storage older than one period becomes unreachable and can be pruned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement.&lt;&#x2F;p&gt;
&lt;p&gt;It does not change behavior of any existing opcodes. Therefore, it is backward compatible with all existing contract accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;DoS surface&lt;&#x2F;strong&gt;: Temporary storage writes still create state that must be processed and stored for at least 1 period. Gas costs should be calibrated so that worst-case temp writes do not create new per-block disk I&#x2F;O DoS attack vectors beyond existing storage writes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Reorg safety&lt;&#x2F;strong&gt;: Clients should retain sufficient history to handle plausible reorg depths.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Application safety&lt;&#x2F;strong&gt;: Contracts MUST treat temp storage as ephemeral and handle the case where entries are unexpectedly missing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MLOAD8 and CALLDATALOAD8 Opcodes</title>
        <published>2026-01-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Helkomine</name><uri>https://github.com/Helkomine</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8120/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8120-mload8-and-calldataload8-opcodes/27396" />
        

        <id>https://wg-eips.ritovision.com/8120/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8120"
            label="EIP-8120" />
        

        
        

        
        <summary type="html">Adds EVM opcodes for efficient single-byte memory and calldata loads.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8120/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces new EVM opcodes that allow loading a single byte from memory or calldata in a single operation, reducing gas cost and bytecode size compared to existing patterns based on &lt;code&gt;MLOAD (0x51)&lt;&#x2F;code&gt; or &lt;code&gt;CALLDATALOAD (0x35)&lt;&#x2F;code&gt; followed by bit shifting.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the only way to read a single byte from calldata or memory is to use &lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt; or &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and then shift the loaded 32-byte word.
For example, reading the byte at offset x from calldata requires:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALLDATALOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH1 248&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This pattern increases runtime gas cost and adds three extra bytes to the deployed bytecode for each single-byte access. Contracts that frequently parse byte-oriented calldata or instruction streams incur unnecessary overhead.
This EIP proposes two new opcodes that allow loading a single byte directly in one operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;mload8-tbd&quot;&gt;MLOAD8 (TBD)&lt;&#x2F;h3&gt;
&lt;!-- TODO: Replace TBD with assigned opcode value --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stack input&lt;&#x2F;strong&gt;: &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stack output&lt;&#x2F;strong&gt;: &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Reads one byte from memory at position offset and pushes it onto the stack as a 32-byte word, with the byte placed in the least significant position.
Memory expansion occurs prior to the load, after which the loaded byte is read.
If the accessed byte lies beyond the previously allocated memory, the returned value is 0 due to zero-initialization.
Memory expansion rules apply in the same way as for &lt;code&gt;MSTORE8&lt;&#x2F;code&gt; (extending memory to at least &lt;code&gt;offset + 1&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calldataload8-tbd&quot;&gt;CALLDATALOAD8 (TBD)&lt;&#x2F;h3&gt;
&lt;!-- TODO: Replace TBD with assigned opcode value --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stack input&lt;&#x2F;strong&gt;: &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stack output&lt;&#x2F;strong&gt;: &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Reads one byte from calldata at position offset and pushes it onto the stack as a 32-byte word, with the byte placed in the least significant position.
If offset is greater than or equal to &lt;code&gt;CALLDATASIZE (0x36)&lt;&#x2F;code&gt;, the returned value is 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Base cost: 3 gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MLOAD8&lt;&#x2F;code&gt; additionally incurs memory expansion cost as defined by existing memory access rules.
The base gas cost matches &lt;code&gt;MLOAD&lt;&#x2F;code&gt;, &lt;code&gt;MSTORE8&lt;&#x2F;code&gt;, and &lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt;, ensuring consistency with existing EVM pricing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;exceptional-conditions&quot;&gt;Exceptional Conditions&lt;&#x2F;h3&gt;
&lt;p&gt;Execution results in an exceptional halt if:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There is insufficient gas to execute the instruction&lt;&#x2F;li&gt;
&lt;li&gt;There are insufficient stack items (stack underflow)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In both cases, execution halts and the current call frame is reverted, consistent with existing EVM behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcode-symmetry&quot;&gt;Opcode Symmetry&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MLOAD8&lt;&#x2F;code&gt; serves as a natural counterpart to &lt;code&gt;MSTORE8 (0x53)&lt;&#x2F;code&gt;: one stores exactly one byte from the stack to memory, while the other loads exactly one byte from memory to the stack. This symmetry improves conceptual clarity and developer ergonomics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficiency-for-byte-oriented-contracts&quot;&gt;Efficiency for Byte-Oriented Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Instruction-based architectures that interpret calldata as a sequence of byte-level commands benefit from reduced gas usage and smaller bytecode size when parsing instruction streams.
A common pattern for reading a single byte from calldata today consists of the following instruction sequence:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt; (3 gas)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PUSH1&lt;&#x2F;code&gt; (3 gas)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHR&lt;&#x2F;code&gt; (3 gas)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This results in a total cost of 9 gas per byte read, excluding additional stack manipulation overhead, and increases deployed bytecode size due to the extra instructions.
Replacing this sequence with a single &lt;code&gt;CALLDATALOAD8&lt;&#x2F;code&gt; instruction priced at 3 gas saves 6 gas per byte read and reduces deployed bytecode size by approximately 3 bytes per occurrence. These savings compound in contracts that repeatedly parse byte-oriented calldata or instruction streams.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-assignment&quot;&gt;Opcode Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;While the final opcode values are subject to allocation during review, this proposal suggests placing &lt;code&gt;MLOAD8&lt;&#x2F;code&gt; and &lt;code&gt;CALLDATALOAD8&lt;&#x2F;code&gt; in the &lt;code&gt;0x4X&lt;&#x2F;code&gt; opcode range. The &lt;code&gt;0x5X&lt;&#x2F;code&gt; range, which primarily contains stack, memory, storage, and control flow operations, is largely exhausted.
Tentative values of &lt;code&gt;0x4e&lt;&#x2F;code&gt; for &lt;code&gt;MLOAD8&lt;&#x2F;code&gt; and &lt;code&gt;0x4f&lt;&#x2F;code&gt; for &lt;code&gt;CALLDATALOAD8&lt;&#x2F;code&gt; are suggested to group these instructions near existing data access operations while minimizing the risk of opcode collisions. These assignments are intended to facilitate early client prototyping and collision checking and may be adjusted during the standardization process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces new opcodes and does not modify the semantics of existing instructions. No backwards compatibility issues are introduced beyond those inherent to any opcode-adding hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Assume:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;calldata = 0x0123456789abcdef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory = 0xfedcba9876543210&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Bytecode&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;5f &amp;lt;CALLDATALOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;PUSH0; CALLDATALOAD8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;pushes &lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;6002 &amp;lt;MLOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;PUSH1 0x02; MLOAD8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;pushes &lt;code&gt;0xba&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;lt;CALLDATALOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;missing stack operand&lt;&#x2F;td&gt;&lt;td&gt;exceptional halt&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;lt;MLOAD8&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;missing stack operand&lt;&#x2F;td&gt;&lt;td&gt;exceptional halt&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No new security considerations are introduced beyond those already known for memory and calldata access.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Batch priority fees at end of block</title>
        <published>2025-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8115/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8115-batch-priority-fees-at-end-of-block/27358" />
        

        <id>https://wg-eips.ritovision.com/8115/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8115"
            label="EIP-8115" />
        

        
        

        
        <summary type="html">Delay all priority fee credits from transactions to end of block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8115/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines how to optimize processing of priority fees from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee market transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Priority fees are credited at the end of each transaction, leading to these complications:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limited parallelization:&lt;&#x2F;strong&gt; Each transaction writes to the fee recipient account balance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Mempool complexities:&lt;&#x2F;strong&gt; A transaction sender may become solvent only after prior transactions in a block have been processed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Accounting complexities:&lt;&#x2F;strong&gt; The fee recipient gets hundreds of micropayments for what could logically be a single credit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inaccurate logs:&lt;&#x2F;strong&gt; Proposals to emit logs on ETH transfers either have to omit priority fees, limiting their usefulness due to inaccuracies, or have to emit an extra entry for each individual fee, making them expensive.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;priority-fee-processing&quot;&gt;Priority fee processing&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; priority fees SHALL no longer be credited after each individual transaction. Instead, they SHALL be summed up and credited after all transactions of a block are processed but before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawals are processed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is one step towards fully accurate ETH balance logs. Batched crediting of priority fees improves parallel execution of transactions, as a transaction can no longer start with insufficient fees and only become eligible for execution after incremental priority fees have been credited.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The fee recipient now receives priority fees at the end of the block rather than incrementally after each transaction, making it only possible to spend them in the next block. This may require updates to block builder infrastructure and change liquidity requirements for MEV use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security impact.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Replace cumulative receipt fields</title>
        <published>2025-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8116/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8116-replace-cumulative-receipt-fields/27359" />
        

        <id>https://wg-eips.ritovision.com/8116/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8116"
            label="EIP-8116" />
        

        
        

        
        <summary type="html">Replace cumulativeGasUsed with gasUsed in on-chain receipt</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8116/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes how to change the on-chain receipt data to track gas per transaction instead of cumulatively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, on-chain receipts track a &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; field which contains the running sum of all gas spent for all transactions in the block so far. This has a number of shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inefficient verification:&lt;&#x2F;strong&gt; RPC clients that want to verify individual transaction &lt;code&gt;gasUsed&lt;&#x2F;code&gt; requires computation based on &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; across consecutive receipts.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limited parallelism:&lt;&#x2F;strong&gt; Receipt contents are stateful, even for transactions accessing mutually exclusive state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;logIndex&lt;&#x2F;code&gt; field exposed via JSON-RPC is currently also tracking an incremental block level index instead of a per-receipt index, with similar shortcomings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipt-construction&quot;&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; construction&lt;&#x2F;h3&gt;
&lt;p&gt;All receipts emitted after this EIP activates track the individual transaction&#x27;s &lt;code&gt;gasUsed&lt;&#x2F;code&gt; instead of the incremental &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;Within &lt;code&gt;logs&lt;&#x2F;code&gt;, the &lt;code&gt;logIndex&lt;&#x2F;code&gt; field is changed to indicate the log index position in the individual receipt, rather than in the entire block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a step towards aligning on-chain data with the RPC data actually being consumed by client applications. Stateful components of receipts (&lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;logIndex&lt;&#x2F;code&gt;) are replaced with per-transaction equivalents.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications using verified &lt;code&gt;gasUsed&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;cumulativeGasUsed&lt;&#x2F;code&gt; values need to adapt to the new on-chain data semantics.&lt;&#x2F;p&gt;
&lt;p&gt;Applications relying on the per block &lt;code&gt;logIndex&lt;&#x2F;code&gt; need adaptation, as &lt;code&gt;logIndex&lt;&#x2F;code&gt; now refers to an index per receipt. Note that this is solely an RPC change. Relative log ordering can be emulated by estimating &lt;code&gt;logIndex&lt;&#x2F;code&gt; as &lt;code&gt;transactionIndex * 4 + logIndex&lt;&#x2F;code&gt; (guaranteed to have same order as before, but absolute index values may be higher than before).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Call and Return Opcodes for the EVM</title>
        <published>2025-12-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>John Max Skaller</name><email>skaller@internode.on.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7979/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7951-call-and-return-opcodes-for-the-evm/24615" />
        

        <id>https://wg-eips.ritovision.com/7979/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7979"
            label="EIP-7979" />
        

        
        

        
        <summary type="html">Three new instructions to support calls and returns, with optional validated control flow.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7979/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is the smallest possible change to the EVM to support calls and returns.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal introduces three new control-flow instructions to the EVM:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLSUB&lt;&#x2F;code&gt; transfers control to the &lt;code&gt;destination&lt;&#x2F;code&gt; on the &lt;code&gt;stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENTERSUB&lt;&#x2F;code&gt; marks a &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; returns to the &lt;code&gt;PC&lt;&#x2F;code&gt; after the most recent &lt;code&gt;CALLSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Code can also be prefixed with &lt;code&gt;MAGIC&lt;&#x2F;code&gt; bytes.  The complete control flow of &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code can be traversed in time and space linear in the size of the code, enabling tools for validation, static analysis, and AOT and JIT compilers.  On-chain, &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code is validated at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time to ensure that it cannot execute invalid instructions, jump to invalid locations, underflow stack, or, in the absence of recursion, overflow stack.&lt;&#x2F;p&gt;
&lt;p&gt;These changes are backwards-compatible: all instructions behave as specified whether or not they appear in &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In 2016 the lead author set out to write a compiler from the EVM to code for virtual or real register machines.  The design was simple -- traverse the EVM stack code in one pass, emitting register code for the target machine.  I was immediately stymied by the presence of dynamic jumps, which demand, worst case, a quadratic number of passes. &lt;em&gt;Dynamic jumps must die.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;How to kill them?  First, some history.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;babbage-1833-jumps-and-conditional-jumps&quot;&gt;Babbage, 1833: Jumps and conditional jumps&lt;&#x2F;h3&gt;
&lt;p&gt;In 1833 Charles Babbage began the design of a steam-powered, mechanical, Turing-complete computer.  Programs were to be encoded on punched cards which controlled a system of rods, gears and other machinery to implement storage, arithmetic, jumps, and conditional jumps.  Jumps were supported by a mechanism for shuffling forwards or backwards through the cards.  Its first published description was by L. F. Menabre, 1842&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.  The translator, Ada Augusta, Countess of Lovelace, made extensive notes.  The notes include her famous program for recursively computing Bernoulli numbers — arguably the world&#x27;s first complete computer program — which used conditional jumps to implement the required nested loops.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;turing-1945-calls-and-returns&quot;&gt;Turing, 1945: Calls and returns&lt;&#x2F;h3&gt;
&lt;p&gt;In 1945 Turing proposed his Automatic Computing Engine&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-3-1&quot;&gt;&lt;a href=&quot;#fn-3&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, where he introduced the concept of calls and returns:  &lt;em&gt;&quot;To start on a subsidiary operation we need only make a note of where we left off the major operation and then apply the first instruction of the subsidiary. When the subsidiary is over we look up the note and continue with the major operation.&quot;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The ACE supported calls directly with a stack of mercury-filled memory crystals holding return addresses.  Turing&#x27;s design was for a 32-bit RISC machine with vacuum tube integer hardware, floating point microcode, 32 registers, a 1024-entry return stack, and 32K of RAM on a 1 MHz bus.  The smaller Pilot ACE was for a while the world&#x27;s fastest computer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lovelace-turing-an-aside-on-machine-intelligence&quot;&gt;Lovelace &amp;amp; Turing: An aside on machine intelligence&lt;&#x2F;h4&gt;
&lt;p&gt;In Lady Lovelace&#x27;s notes we find her prescient recognition of the Analytic Engine&#x27;s power:  &quot;In enabling mechanism to combine together general symbols in successions of unlimited variety and extent, a uniting link is established between the operations of matter and the abstract mental processes of the most abstract branch of mathematical science.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;  Here also we find her recognition of its limits:  &quot;It can do whatever we know how to order it to perform. It can follow analysis; but it has no power of anticipating any analytical relations or truths. Its province is to assist us in making available what we are already acquainted with.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-3&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In 1950 Alan Turing answered &quot;Lady Lovelace&#x27;s Objection&quot; with a question of his own:  &quot;The majority of minds seem to be &#x27;subcritical&#x27; ... an idea presented to such a mind will on average give rise to less than one idea in reply. A smallish proportion are supercritical. An idea presented to such a mind that may give rise to a whole &#x27;theory&#x27; consisting of secondary, tertiary and more remote ideas... we ask, &#x27;Can a machine be made to be supercritical?&#x27;&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-2-1&quot;&gt;&lt;a href=&quot;#fn-2&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;industry-practice-1945-2025&quot;&gt;Industry practice: 1945 - 2025&lt;&#x2F;h3&gt;
&lt;p&gt;Call and return facilities of various levels of complexity have proven their worth across a long line of important machines over the last 80 years:  Burroughs&#x27; baroque ALGOL support, Intel&#x27;s simple &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;RET&lt;&#x2F;code&gt;, RISC-V&#x27;s subtly dynamic &lt;code&gt;JAL&lt;&#x2F;code&gt; and &lt;code&gt;JALR&lt;&#x2F;code&gt;, ARM&#x27;s bare mimimum &lt;code&gt;BL&lt;&#x2F;code&gt;, and some such facility on most every other machine we have programmed or implemented: physical machines including the, CDC 7600, IBM 360, PDP-11, VAX, Motorola 68000, and others, as well as virtual machines for Scheme, Forth, Pascal, Java, Wasm, .NET and others.&lt;&#x2F;p&gt;
&lt;p&gt;Especially relevant to the EVM&#x27;s design are the Java, Wasm, and .NET VMs.  They share some important features: their programs are all&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;represented with a portable bytecode that&lt;&#x2F;li&gt;
&lt;li&gt;can be directly interpreted and&lt;&#x2F;li&gt;
&lt;li&gt;can be validated before runtime&lt;&#x2F;li&gt;
&lt;li&gt;to have static control flow that&lt;&#x2F;li&gt;
&lt;li&gt;can be compiled to machine code&lt;&#x2F;li&gt;
&lt;li&gt;with a one-pass JIT.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We propose that the EVM should share these features.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-evm-control-flow-facility&quot;&gt;The EVM control-flow facility&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike these machines, the Ethereum Virtual Machine &lt;em&gt;does not&lt;&#x2F;em&gt; provide facilities for calls and returns. Instead, they must be synthesized using the dynamic &lt;code&gt;JUMP&lt;&#x2F;code&gt; instruction, which takes its argument on the stack. Further, the EVM provides &lt;em&gt;only&lt;&#x2F;em&gt; this jump.  The EVM&#x27;s dynamic jump causes problems. First, the need to synthesize static jumps and calls with dynamic jumps wastes some space and gas.  The much bigger problem is this: jumps that can dynamically branch to any destination in the program can cause quadratic &quot;path explosions&quot; when traversing the program&#x27;s flow of control.  We will give more detailed explanations in the Rationale.&lt;&#x2F;p&gt;
&lt;p&gt;Dynamic jumps are common enough in physical machines, whose instruction sets are of course optimized for physical performance, but less so in virtual machines, whose code is often the source for JIT compilers and other downstream tools — a JIT compiler that can take quadratic time is less than useful.  For this reason the Java, Wasm, and .NET VMs do not support dynamic jumps.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-dynamic-jumps-must-die&quot;&gt;Why dynamic jumps must die&lt;&#x2F;h3&gt;
&lt;p&gt;For Ethereum, quadratic traversal times are a denial-of-service vulnerability for any online static analysis, including validating EVM bytecode and translating its virtual stack code to other representations such as virtual register code and machine code -- whether AOT at initialization time, or JIT at runtime.&lt;&#x2F;p&gt;
&lt;p&gt;Even offline, dynamic jumps (and the lack of calls and returns) can cause static analyses of many contracts to become impractical, intractable or even impossible.  The following are quotes from the abstracts for just a few recent papers on the problem:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&quot;Ethereum smart contracts are distributed programs running on top of the Ethereum blockchain. Since program flaws can cause significant monetary losses and can hardly be fixed due to the immutable nature of the blockchain, there is a strong need of automated analysis tools which provide formal security guarantees. Designing such analyzers, however, proved to be challenging and error-prone.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-4-1&quot;&gt;&lt;a href=&quot;#fn-4&quot;&gt;4&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;The EVM language is a simple stack-based language ... with one significant difference between the EVM and other virtual machine languages (like Java Bytecode or CLI for .Net programs): the use of the stack for saving the jump addresses instead of having it explicit in the code of the jumping instructions. Static analyzers need the complete control-flow graph (CFG) of the EVM program in order to be able to represent all its execution paths.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-5-1&quot;&gt;&lt;a href=&quot;#fn-5&quot;&gt;5&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;Static analysis approaches mostly face the challenge of analyzing compiled Ethereum bytecode... However, due to the intrinsic complexity of Ethereum bytecode (especially in jump resolution), static analysis encounters significant obstacles.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-6-1&quot;&gt;&lt;a href=&quot;#fn-6&quot;&gt;6&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&quot;Analyzing contract binaries is vital ... comprising function entry identification and detecting its boundaries... Unfortunately, it is challenging to identify functions ... due to the lack of internal function call statements.&quot;&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-7-1&quot;&gt;&lt;a href=&quot;#fn-7&quot;&gt;7&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;There is an entire academic literature of complex, incomplete solutions to problems like these that this proposal, others before it, and the design of other VMs render trivial.&lt;&#x2F;p&gt;
&lt;p&gt;With so much at stake on the blockchain -- currently valued at over 6000 metric tonnes of gold -- deploying correct contracts is imperative — there is no reason for the EVM to make that job any more difficult than necessary.  Especially when it is so easy to fix.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;taming-the-evm&quot;&gt;Taming the EVM&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent control-flow traversal from &quot;going quadratic&quot; we must prevent the dynamic use of jumps.  On-chain, most uses of &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; are preceded by a &lt;code&gt;PUSH&lt;&#x2F;code&gt; — that is, they are effectively static.  So not quite dead, but provably paralyzed.  This proposal &lt;em&gt;requires&lt;&#x2F;em&gt; that in &lt;code&gt;valid&lt;&#x2F;code&gt; code &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; are &lt;em&gt;always&lt;&#x2F;em&gt; used statically.  Currently, the only places that jumps &lt;em&gt;must&lt;&#x2F;em&gt; be used dynamically are to support calls and returns.  For that purpose we propose &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; opcodes as replacements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;The key words MUST and MUST NOT in this Specification are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;callsub-0x&quot;&gt;&lt;code&gt;CALLSUB (0x..)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Transfers control to a subsidiary operation.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pop the &lt;code&gt;destination&lt;&#x2F;code&gt; on top on the &lt;code&gt;stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Push the current &lt;code&gt;PC + 1&lt;&#x2F;code&gt; to the &lt;code&gt;return stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;destination&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost is &lt;em&gt;mid&lt;&#x2F;em&gt; (&lt;code&gt;8&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;entersub-0x&quot;&gt;&lt;code&gt;ENTERSUB (0x..)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;destination&lt;&#x2F;code&gt; of every &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; MUST be an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;returnsub-0x&quot;&gt;&lt;code&gt;RETURNSUB (0x..)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Returns control to the caller of a subsidiary operation.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; to &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost is &lt;em&gt;low&lt;&#x2F;em&gt; (&lt;code&gt;5&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;magic-0xef&quot;&gt;&lt;code&gt;MAGIC (0xEF....)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;After this EIP has been activated code beginning with the &lt;code&gt;MAGIC&lt;&#x2F;code&gt; bytes MUST be a &lt;code&gt;valid&lt;&#x2F;code&gt; program.  Execution begins immediately after the &lt;code&gt;MAGIC&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Notes:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Values popped off the &lt;code&gt;return stack&lt;&#x2F;code&gt; do not need to be validated, since they are alterable only by &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The description above lays out the semantics of these instructions in terms of a &lt;code&gt;return stack&lt;&#x2F;code&gt;.  But the actual state of the &lt;code&gt;return stack&lt;&#x2F;code&gt; is not observable by EVM code or consensus-critical to the protocol.  (For example, a node implementer may code &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; to unobservably push &lt;code&gt;PC&lt;&#x2F;code&gt; on the &lt;code&gt;return stack&lt;&#x2F;code&gt; rather than &lt;code&gt;PC + 1&lt;&#x2F;code&gt;, which is allowed so long as &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; observably returns control to the &lt;code&gt;PC + 1&lt;&#x2F;code&gt; location.)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Opcode and &lt;code&gt;MAGIC&lt;&#x2F;code&gt; values are still to be determined.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;em&gt;mid&lt;&#x2F;em&gt; cost for &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; is justified by it taking very little more work than the &lt;em&gt;mid&lt;&#x2F;em&gt; cost of &lt;code&gt;JUMP&lt;&#x2F;code&gt; — just pushing an integer to the &lt;code&gt;return stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;jumpdest&lt;&#x2F;em&gt; cost for &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt; is justified by it being, like &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, a mere label.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;em&gt;low&lt;&#x2F;em&gt; cost for &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; is justified by needing only to pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; into the &lt;code&gt;PC&lt;&#x2F;code&gt; — less work than a jump.&lt;&#x2F;p&gt;
&lt;p&gt;Benchmarking will be needed to tell if the costs are well-balanced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;Execution is defined in the Yellow Paper as a sequence of changes to the EVM state. The conditions on &lt;code&gt;valid&lt;&#x2F;code&gt; code are preserved by state changes. At runtime, if execution of an instruction would violate a condition the execution is in an exceptional halting state and cannot continue. The Yellow Paper defines six such states.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;State modification during a static call&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;More than 1024 stack items&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient stack items&lt;&#x2F;li&gt;
&lt;li&gt;Invalid jump destination&lt;&#x2F;li&gt;
&lt;li&gt;Invalid instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We would like to consider EVM code &lt;code&gt;valid&lt;&#x2F;code&gt; iff no execution of the program can lead to an exceptional halting state. In practice, we must test at runtime for the first three conditions.  We don&#x27;t know whether we will be called statically.  We don&#x27;t know how much gas there will be, and we don&#x27;t know how deep a recursion may go.  (However, we can validate that non-recursive programs do not overflow stack.)  All of the remaining conditions MUST be validated statically.  To allow for efficient algorithms our validation does not consider the codes data and computations, only its control flow and stack use. This means we will reject programs with invalid code paths, even if those paths are not reachable.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constraints-on-valid-code&quot;&gt;Constraints on &lt;code&gt;valid&lt;&#x2F;code&gt; code&lt;&#x2F;h4&gt;
&lt;p&gt;Code beginning with &lt;code&gt;MAGIC&lt;&#x2F;code&gt; MUST be &lt;code&gt;valid&lt;&#x2F;code&gt;.  Constraints on &lt;code&gt;valid&lt;&#x2F;code&gt; code MUST be validated at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time, in time and space linear in the size of the code.  The constraints on &lt;code&gt;valid&lt;&#x2F;code&gt; code are as follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All executable opcodes must be &lt;code&gt;valid&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;They MUST have been defined in the Yellow Paper or a deployed EIP and&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT have been deprecated in a subsequent deployed EIP.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;INVALID&lt;&#x2F;code&gt; opcode is &lt;code&gt;valid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions MUST be preceded by a &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions MUST NOT address immediate data, and MUST address a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; instruction MUST be preceded by a &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; instruction MUST NOT address immediate data, and MUST address an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The number of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; MUST always be positive and less than or equal to 1024.&lt;&#x2F;li&gt;
&lt;li&gt;The number of items on the &lt;code&gt;return stack&lt;&#x2F;code&gt; MUST always be positive and less than or equal to 1024.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;stack height&lt;&#x2F;code&gt; is the absolute difference between the current &lt;code&gt;stack pointer&lt;&#x2F;code&gt; and the &lt;code&gt;stack pointer&lt;&#x2F;code&gt; at the most recent &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;During execution the &lt;code&gt;stack height&lt;&#x2F;code&gt; MUST be &lt;em&gt;the same&lt;&#x2F;em&gt; for every &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The guarantee of constant stack height prevents stack underflow, breaks cycles in the control flow, ensures finite stack use for non-recursive programs, enables one-pass recovery of control-flow, and allows virtual stack code to be directly serialized into virtual register code for faster interpretation and compilation to machine code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The JVM, Wasm and .NET VMs enforce similar constraints for similar reasons.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;The above is a purely semantic specification, placing no constraints on the syntax of bytecode beyond being an array of opcodes and immediate data.  &quot;Subsidiary operations&quot; here are not contiguous sequences of bytecode: they are subgraphs of the bytecode&#x27;s full control-flow graph.  The EVM is a simple state machine, and the control-flow graph for a program represents every possible change of state.  Each instruction simply advances the state machine one more step, and state has no syntactic structure.  We only promise that &lt;code&gt;valid&lt;&#x2F;code&gt; code will not, as it were, jam up the gears of the machine.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than enforce semantic constraints via syntax — as is done by higher-level languages — this proposal enforces them via validation: &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code is proven &lt;code&gt;valid&lt;&#x2F;code&gt; at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time. The constraints above MUST be proven true in time and space linear in the size of the code.  We provide a simple algorithm below for doing so -- there are better ones.&lt;&#x2F;p&gt;
&lt;p&gt;With no syntactic constraints and minimal semantic constraints we maximize opportunities for optimizations, including tail call elimination, multiple-entry calls, efficient register allocation, and inter-procedural optimizations.  Since we want to support online compilation of EVM code to native code it is crucial that the EVM code be as well optimized as possible by our HLL compilers — upfront and offline.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;how-can-dynamic-jumps-cause-quadratic-control-flow&quot;&gt;How can dynamic jumps cause quadratic control flow?&lt;&#x2F;h3&gt;
&lt;p&gt;Static analysis amounts to most anything you can do with a program without actually running it.  And traversing the flow of control — in a way that follows every possible path only once — is a fundamental first step for many static analyses, especially for recovering control-flow graphs.  When all jumps are static the number of steps is linear in the number of instructions: a fixed number of paths must be explored for each jump.  But with dynamic jumps every possible destination must be explored at every jump: at worst, the number of steps can be quadratic in the number of instructions.&lt;&#x2F;p&gt;
&lt;p&gt;Consider these three programs.  They make for nice exploits, especially as they get longer.  It&#x27;s not important that at runtime &lt;code&gt;gas&lt;&#x2F;code&gt; isn&#x27;t random or that the &lt;code&gt;jump&lt;&#x2F;code&gt; will most often fail -- what matters is that it is impossible to know at static analysis time where the jumps go, so every destination must be explored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jumpdest           jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   gas                gas               gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jump               jump              jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jumpdest           jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   gas                gas               gas      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jump               jump              jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   jumpdest           jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   stop               gas               gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      jump              jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      jumpdest          jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                      stop              gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                        stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And consider the control-flow graphs for these programs.  Each block of instructions in a graph is a sequence from the above programs with one entry (a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;) and one exit (a &lt;code&gt;JUMP&lt;&#x2F;code&gt;), and each arc is a transfer of control.  Arcs on the left are backwards branches, arcs on the right are forwards branches.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7979&#x2F;.&#x2F;assets&#x2F;control-flow.png&quot; alt=&quot;Control-Flow Graphs&quot; &#x2F;&gt;
&lt;em&gt;Graph may be outdated&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that the number of arcs in a graph is equal to the number of blocks minus one, squared.  That is, the number of possible paths of control flow, and thus the time needed to traverse them all, is quadratic in the size of the program.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;do-we-save-on-code-size-and-gas&quot;&gt;Do we save on code size and gas?&lt;&#x2F;h3&gt;
&lt;p&gt;The difference these instructions make can be seen in this very simple code for calling a routine that squares a number.  The distinct opcodes make it easier for both people and tools to understand the code, and there are modest savings in code size and gas costs as well.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:                           |       SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest       ; 1 gas        |           entersub       ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup            ; 3 gas        |           dup            : 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul            ; 5 gas        |           mul            ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1          ; 3 gas        |           returnsub      ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump           ; 8 gas        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:                      |       CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest       ; 1 gas        |           entersub       ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push RTN_CALL  ; 3 gas        |           push 2         ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 2         ; 3 gas        |           push SQUARE    ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE    ; 3 gas        |           callsub        ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump           ; 8 gas        |           returnsub      ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RTN_CALL:                         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1          ; 3 gas        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump           ; 8 gas        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Size in bytes: 18                 |      Size in bytes: 13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Consumed gas:  49                 |      Consumed gas:  38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;That&#x27;s 32% fewer bytes and 30% less gas using &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; versus using &lt;code&gt;JUMP&lt;&#x2F;code&gt;.  So we can see that these instructions provide a simpler, more efficient mechanism. As code becomes larger and better optimized the gains become smaller, but code using &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; always takes less space and gas than equivalent code without it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;do-we-improve-real-time-performance&quot;&gt;Do we improve real-time performance?&lt;&#x2F;h3&gt;
&lt;p&gt;Some real-time interpreter performance gains will be had, as reflected in the lower gas costs.  But large real-time gains will come from AOT and JIT compilers.  Crucially, the constraint that stack depths be constant means that in &lt;code&gt;MAGIC&lt;&#x2F;code&gt; code a very fast streaming JIT can traverse the control flow of the EVM code in one pass -- as it is executed -- generating machine code as it goes. &lt;em&gt;(Note again: the Wasm, JVM and .NET VMs share that property.)&lt;&#x2F;em&gt;  The EVM is a stack machine, but real machines are register machines.  So generating virtual register code for a faster interpreter is a win, (I have seen 4X speedups on JVM code) and generating good machine code gives orders of magnitude gains. But for most transactions storage dominates execution time, and gas counting and other overhead always take their toll.  So these gains would be most visible in contexts where this overhead is absent, such as for L1 precompiles, on some L2s, and on some EVM-compatible chains.  Code can also be compiled to a better instruction set for on-chain ZK work, such as RISC-V.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-immediate-arguments&quot;&gt;Why no immediate arguments?&lt;&#x2F;h3&gt;
&lt;p&gt;This would of course break the promise of &quot;the smallest possible change.&quot;  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8013&#x2F;&quot;&gt;EIP-8013: Static relative jumps and calls for the EVM&lt;&#x2F;a&gt; is available if we want its size and performance advantages. It proposes five new EVM jump instructions (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;, and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt;) which encode destinations as signed immediate values. These can be useful for almost all &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; use cases and offer improvements in cost, performance, and static analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-code-sections&quot;&gt;Why no code sections?&lt;&#x2F;h3&gt;
&lt;p&gt;Again, this would break the promise of &quot;the smallest possible change,&quot; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540: EOF - EVM Object Format&lt;&#x2F;a&gt; remains available. But note that restricting jumps to code sections impedes important optimizations, which EOF supported by adding special opcodes.  So if we want restricted code sections this becomes a much bigger change, and we should consider &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EOF - Functions&lt;&#x2F;a&gt; and related EIPs separately.  This proposal uses the same return-stack mechanism and poses no forwards compatability issues with EOF.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-the-return-stack-mechanism&quot;&gt;Why the return-stack mechanism?&lt;&#x2F;h3&gt;
&lt;p&gt;In our experience most stack machines have separate stacks for data and for returns from calls, whereas most register machines have one stack for both data and return addresses, registers for computation, and instructions to support returns from calls in coordination with registers and the stack.  The EVM is of course a stack machine, not a register machine.  As an industry and a team we have substantial experience with the return-stack mechanism proposed here.  It has been effectively used in many machines over the last eight decades since Turing invented it, and has been implemented, tested, and even ready to ship in many of our clients over the last nine years.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes are backwards compatible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are &lt;em&gt;no changes&lt;&#x2F;em&gt; to the semantics of existing EVM code.
&lt;ul&gt;
&lt;li&gt;With the caveat that code with unspecified behavior might behave in different, unspecified ways.  Such code was always broken.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Opcode semantics &lt;em&gt;are not&lt;&#x2F;em&gt; affected by whether the code begins with &lt;code&gt;MAGIC&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;What is affected is the &lt;em&gt;validity&lt;&#x2F;em&gt; of code.  &lt;code&gt;valid&lt;&#x2F;code&gt; code MUST execute identically in any contracts, but in &lt;code&gt;MAGIC&lt;&#x2F;code&gt; contracts the code MUST be &lt;code&gt;valid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;This proposal &lt;em&gt;does not&lt;&#x2F;em&gt; require maintaining two interpreters.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These changes do not foreclose EOF, RISC-V, or other changes; new &lt;code&gt;MAGIC&lt;&#x2F;code&gt; numbers would mark future EVMs.  Neither do these changes preclude running the EVM in zero knowledge; they would more likely help.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;(Note: these tests are known to be outdated and incorrect.)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simple-routine&quot;&gt;Simple routine&lt;&#x2F;h3&gt;
&lt;p&gt;This should jump into a subroutine, back out and stop.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x60045e005c5d&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1 0x04, CALLSUB, STOP, BEGINSUB, RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[4]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[ 2]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-levels-of-subroutines&quot;&gt;Two levels of subroutines&lt;&#x2F;h3&gt;
&lt;p&gt;This should execute fine, going into one two depths of subroutines&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x6800000000000000000c5e005c60115e5d5c5d&lt;&#x2F;code&gt; (&lt;code&gt;PUSH9 0x00000000000000000c, CALLSUB, STOP, BEGINSUB, PUSH1 0x11, CALLSUB, RETURNSUB, BEGINSUB, RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH9&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[12]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[10]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;15&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[17]&lt;&#x2F;td&gt;&lt;td&gt;[10]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;18&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[10,15]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[10]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;11&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;36&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failure-1-invalid-jump&quot;&gt;Failure 1: invalid jump&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail, since the given location is outside of the code-range. The code is the same as previous example,
except that the pushed location is &lt;code&gt;0x01000000000000000c&lt;&#x2F;code&gt; instead of &lt;code&gt;0x0c&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x6801000000000000000c5e005c60115e5d5c5d&lt;&#x2F;code&gt; (&lt;code&gt;PUSH9 0x01000000000000000c, CALLSUB, STOP, BEGINSUB, PUSH1 0x11, CALLSUB, RETURNSUB, BEGINSUB, RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH9&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[18446744073709551628]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=10, op=CALLSUB: invalid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;failure-2-shallow-return-stack&quot;&gt;Failure 2: shallow &lt;code&gt;return stack&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail at first opcode, due to shallow &lt;code&gt;return_stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5d5858&lt;&#x2F;code&gt; (&lt;code&gt;RETURNSUB, PC, PC&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=0, op=RETURNSUB: invalid retsub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;subroutine-at-end-of-code&quot;&gt;Subroutine at end of code&lt;&#x2F;h3&gt;
&lt;p&gt;In this example. the CALLSUB is on the last byte of code. When the subroutine returns, it should hit the &#x27;virtual stop&#x27; &lt;em&gt;after&lt;&#x2F;em&gt; the bytecode, and not exit with error&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x6005565c5d5b60035e&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1 0x05, JUMP, BEGINSUB, RETURNSUB, JUMPDEST, PUSH1 0x03, CALLSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;JUMP&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;[5]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;JUMPDEST&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;PUSH1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;CALLSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[3]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[ 8]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;9&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;30&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;(Note: this implementation is known to be incomplete and incorrect.)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The following is a pseudo-Python implementation of an algorithm for predicating code validity.  An equivalent algorithm MUST be run at &lt;code&gt;CREATE&lt;&#x2F;code&gt; time in space and time linear in the size of the code.  The following algorithm recursively traces the &lt;em&gt;code&lt;&#x2F;em&gt;, emulating its control flow and stack use and checking for violations of the rules above.  It runs in time proportional to the size of the code, and the possible depth of recursion is proportional to the size of the code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-function&quot;&gt;Validation Function&lt;&#x2F;h3&gt;
&lt;p&gt;We assume that instruction validation and destination analysis has been done, and that we have some constant-time helper functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;is_terminator(opcode)  returns true iff opcode is a terminator.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;previous_data(pc)      returns the immediate data for the instruction before pc (usually a PUSH.)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediate_size(opcode) returns the size of the immediate data for an opcode.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removed_items(opcode)  returns the number of items removed from the data_stack by the opcode.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;added_items(opcode)    returns the number of items added to the data_stack by the opcode.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # returns true iff code is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    int []stack_depths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    int []max_depths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    def validate_code(code: bytes, pc: int, sp: int, bp: int, max: int) -&amp;gt; int, boolean:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while pc &amp;lt; len(code):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # check stack height and return if we have been here before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stack_depth = sp - bp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_depth = max + stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if max_depth &amp;gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if stack_depths[pc] {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if stack_depth != stack_depths[pc]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return 0, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if opcode == ENTERSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return max_depths[pc], true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    stack_depths[pc] = stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if is_terminator(opcode):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == CALLSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # push return address and set pc to destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = previous_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                push(return_stack, pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # validate and track maximum height&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depth, valid = validate_code(jumpdest, 0, sp - bp, max)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !valid:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depths[jumpdest] = max_depth;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RETURNSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # pop return address and check for preceding call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = pop(return_stack)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depth = max + stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if opcode == JUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # set pc to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = previous_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == JUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = previous_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # recurse to validate true side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                max_depth, valid = validate_code(jumpdest, sp, bp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !valid:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # apply instructions to stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp -= removed_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if sp &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return so, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp += added_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # Skip opcode and any immediate data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pc += 1 + immediate_size(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_depth = max + stack_depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (max_depth &amp;gt; 1024)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return max_depth, false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return max_depth, true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;These changes introduce new flow control instructions.  They do not introduce any new security considerations. This EIP is intended to improve security by validating a higher level of safety for EVM code deployed on the blockchain.  The validation algorithm must use time and space linear in the size of the code so as not be a denial of service vulnerability.  The algorithm here makes one linear-time, recursive pass of the bytecode, whose depth cannot exceed the number of &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions in the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;!--

``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 4,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;Schneidewind&quot;,
         &quot;given&quot;: &quot;Clara&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2101.05735&quot;,
     &quot;title&quot;: &quot;The Good, the Bad and the Ugly: Pitfalls and Best Practices in Automated Sound Static Analysis of Ethereum Smart Contracts.,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2021, 1, 14]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2101.05735&quot;
   }
   ```

   ``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 5,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;Albert&quot;,
         &quot;given&quot;: &quot;Elvira&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2004.14437&quot;,
     &quot;title&quot;: &quot;Analyzing Smart Contracts: From EVM to a sound Control-Flow Graph.,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2020, 4, 29]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2004.14437&quot;
   }
   ```
   ``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 6,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;Contro&quot;,
         &quot;given&quot;: &quot;Filippo&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2103.09113&quot;,
     &quot;title&quot;: &quot;EtherSolve: Computing an Accurate Control-Flow Graph from Ethereum Bytecode.&quot;,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2021, 3, 16]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2103.09113&quot;
   }
   ```

   ``` csl-json
   {
     &quot;type&quot;: &quot;article&quot;,
     &quot;id&quot;: 7,
     &quot;author&quot;: [
       {
         &quot;family&quot;: &quot;He&quot;,
         &quot;given&quot;: &quot;Jiahao&quot;
       }
     ],
     &quot;DOI&quot;: &quot;arXiv:2301.12695&quot;,
     &quot;title&quot;: &quot;Neural-FEBI: Accurate Function Identification in Ethereum Virtual Machine Bytecode.&quot;,
     &quot;original-date&quot;: {
       &quot;date-parts&quot;: [
         [2023, 1, 30]
       ]
     },
     &quot;URL&quot;: &quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2301.12695&quot;
   }
   ```
--&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Menabre, L.F. Sketch of The Analytical Engine Invented by Charles Babbage. Bibliothque Universelle de Genve, No. 82, October 1842 &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-3&quot;&gt;↩3&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-3&quot;&gt;
&lt;p&gt;Carpenter, B.E. et al. The other Turing machine. The Computer Journal, Volume 20, Issue 3, January 1977 &lt;a href=&quot;#fr-3-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-2&quot;&gt;
&lt;p&gt;Turing, A.M. Computing Machinery and Intelligence. Mind, Volume LIX, Issue 236, October 1950 &lt;a href=&quot;#fr-2-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-4&quot;&gt;
&lt;p&gt;Schneidewind, Clara et al. The Good, the Bad and the Ugly: Pitfalls and Best Practices in Automated Sound Static Analysis of Ethereum Smart Contracts. DOI: 10.48550&#x2F;arXiv.2101.05735 &lt;a href=&quot;#fr-4-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-5&quot;&gt;
&lt;p&gt;Albert, Elvira et al. Analyzing Smart Contracts: From EVM to a sound Control-Flow Graph. DOI: 10.48550&#x2F;arXiv.2004.14437 &lt;a href=&quot;#fr-5-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-6&quot;&gt;
&lt;p&gt;Contro, Fillipo et al. EtherSolve: Computing an Accurate Control-Flow Graph from Ethereum Bytecode. DOI: 10.48550&#x2F;arXiv.2103.09113 &lt;a href=&quot;#fr-6-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li id=&quot;fn-7&quot;&gt;
&lt;p&gt;He, Jiahao et al. Neural-FEBI: Accurate Function Identification in Ethereum Virtual Machine Bytecode. DOI: 10.48550&#x2F;arxiv.2301.12695&quot; &lt;a href=&quot;#fr-7-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Gas Cost of Point Evaluation</title>
        <published>2025-12-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marcin Sobczak</name><uri>https://github.com/marcindsobczak</uri>
	</author>
	
	<author>
		<name>Kamil Chodoła</name><uri>https://github.com/kamilchodola</uri>
	</author>
	
	<author>
		<name>Marek Moraczyński</name><uri>https://github.com/MarekM25</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8096/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8096-point-evaluation-precompile-gas-cost-increase/26867" />
        

        <id>https://wg-eips.ritovision.com/8096/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8096"
            label="EIP-8096" />
        

        
        

        
        <summary type="html">Increases cost of point evaluation precompile</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8096/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies the gas cost of &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile is underpriced relative to its resource consumption. This EIP aims to address these discrepancies by adjusting the gas cost and making &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile sufficiently efficient to enable potential further increases in the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Upon activation of this EIP, the gas cost of calling the precompile at address &lt;code&gt;0x000000000000000000000000000000000000000A&lt;&#x2F;code&gt; will be doubled from &lt;code&gt;50_000&lt;&#x2F;code&gt; gas to &lt;code&gt;100_000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benchmarking the &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile revealed that its gas cost is significantly underestimated. This modification aim to ensure that the &lt;code&gt;point evaluation&lt;&#x2F;code&gt; precompile&#x27;s performance no longer impedes potential increases to the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change. However, similar gas repricings have occurred multiple times in the Ethereum ecosystem, and their effects are well understood.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any new functionality or make existing operations cheaper, therefore there are no direct security concerns related to new attack vectors or reduced cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Native rollups</title>
        <published>2025-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Luca Donno</name><uri>https://github.com/lucadonnoh</uri><email>donnoh@l2beat.com</email>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri><email>justin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8079/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8079-native-rollups/26565" />
        

        <id>https://wg-eips.ritovision.com/8079/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8079"
            label="EIP-8079" />
        

        
        

        
        <summary type="html">Expose Ethereum&#x27;s STF as a precompile for rollups to use</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8079/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Expose the state transition function to the execution layer via a new &lt;code&gt;EXECUTE&lt;&#x2F;code&gt; precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Today, EVM-equivalent rollups need to implement and maintain complex proof systems just to be able to replicate what Ethereum already provides on L1. Such complexity significantly increases the probability of encountering bugs and prevents projects from getting rid of security councils and from moving to Stage 2. EVM-equivalent projects are not similar enough and lack the proper incentives to benefit from each other efforts, significantly delaying multi-proof systems.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, to maintain feature parity with Ethereum, rollups need to implement bespoke governance systems that can&#x27;t be forced to follow Ethereum&#x27;s governance decisions, and thus are free to arbitrarily diverge from it. Because of this, the best that an EVM-equivalent rollup can do is to provide long exit windows for their users, to protect them from its governance going rogue. No finite (and reasonable) exit window can protect all use-cases, especially those that rely on timelocks (governance, staking contracts, vesting contracts). Longer exit windows protect more use-cases, at the cost of increase un-equivalence time.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides a way for rollups to reuse Ethereum&#x27;s state transition verification infrastructure, and as a consequence massively simplify their infrastructure and upgrade processes. This enables projects to better redirect resources towards user-facing features and products.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROOF_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(TBD)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXECUTE_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ANCHOR_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execute-precompile&quot;&gt;&lt;code&gt;EXECUTE&lt;&#x2F;code&gt; precompile&lt;&#x2F;h3&gt;
&lt;p&gt;Add a precompile at &lt;code&gt;EXECUTE_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; that verifies a state transition function with the provided inputs.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile executes the following logic:&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify a `state_transition(chain: BlockChain, block: Block)`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Disable blob transactions and perform anchoring to enable L1-&amp;gt;L2 messaging.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    anchor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Blob-carrying transactions are not supported&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; BlobTransaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; ExecuteError&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_block_env&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform anchoring&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_unchecked_system_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;     =&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        target_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ANCHOR_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;          =&lt;&#x2F;span&gt;&lt;span&gt;anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_transition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with a new 64-bit unsigned integer field representing the total amount of native tokens burned in the current block as part of the base fee.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_header_rlp = RLP([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  burned_fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cumulative value of &lt;code&gt;burned_fees&lt;&#x2F;code&gt; can be calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;burned_fees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_refund_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; transaction_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;By making the value available for L1, it is also automatically made available for native rollups too.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proof-carrying-transactions&quot;&gt;Proof-carrying transactions&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD: heavily depends on the ZK L1 design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;programmable-consensus-layer&quot;&gt;Programmable &quot;consensus layer&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;EXECUTE&lt;&#x2F;code&gt; precompile allows rollups to define their own inputs and constrained their behaviour through smart contract. For example, in contrast to Ethereum&#x27;s own consensus layer, a rollup can decide to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Restrict the use of transactions that are sequenced by a permissioned entity, allowing for centralized sequencing and fast pre-confirmations, or leaving it open to everyone (based sequencing), or restrict it to a staked sequencer network;&lt;&#x2F;li&gt;
&lt;li&gt;Fix the &lt;code&gt;coinbase&lt;&#x2F;code&gt; address to be a DAO-controlled treasury, independent from the proposer address;&lt;&#x2F;li&gt;
&lt;li&gt;Tweak gas limits or prices based on specific needs;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This allows projects to preserve most of their configurations they already benefits from.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-tokens&quot;&gt;Gas tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Several rollups implement new transaction types to be able to mint the rollup gas token when depositing funds on L1. We decide not to introduce complexity and instead rely on general L1-&amp;gt;L2 messaging to unlock pre-minted tokens, as other existing projects already do. As a consequence, projects are free to decide what type of L1 interaction triggers the release of the rollup gas token, trivially enabling custom gas tokens without the need to modify the EVM behaviour at all.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;anchoring&quot;&gt;Anchoring&lt;&#x2F;h3&gt;
&lt;p&gt;To support L1-&amp;gt;L2 messages, rollups need to be able to &quot;anchor&quot; information from L1 to the L2. Inspired by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and existing implementations, we make use of a system transaction to inject a &lt;code&gt;bytes32 anchor&lt;&#x2F;code&gt; in the rollup state in a predeploy. This &lt;code&gt;anchor&lt;&#x2F;code&gt; can be used to relay L1&#x27;s state root, a message root, or a rolling hash, or something completely different, based on design preferences.&lt;&#x2F;p&gt;
&lt;p&gt;The trade-off of this approach, compared to some existing ones based on custom transaction types, is that the L2 side of an L1-&amp;gt;L2 message cannot have the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; derived from the sender on L1, and therefore L1 access control-based smart contracts need to be adapted when deployed on L2 and used with cross-chain permissions. We believe this trade-off to be acceptable as the same scenario already exists when supporting L2-&amp;gt;L1 access controls, as Ethereum is already not natively aware of the L2 sender.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;basefee-collection&quot;&gt;Basefee collection&lt;&#x2F;h3&gt;
&lt;p&gt;While Ethereum burns the base fee, most rollups collect it for themselves, which enables opinionated funding models that are not possible on L1. To enable this use-case, and to minimize the code changes, we simply expose the amount of fees burned through the &lt;code&gt;burned_fees&lt;&#x2F;code&gt; block header value. Projects can now decide to ignore the value, burning the L2 base fee too, or credit the amount to some address, allowing for base fee collection from the L1-&amp;gt;L2 token escrow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;re-execution-vs-zk-proofs&quot;&gt;Re-execution vs ZK proofs&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing rollups can more or less easily migrate to being native based on their degree of equivalency, as native rollups do not support custom opcodes, custom precompiles or custom transaction types within the exposed state transition function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Let exits use the consolidation queue</title>
        <published>2025-11-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8080/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8080-let-exits-use-the-consolidation-queue/26552" />
        

        <id>https://wg-eips.ritovision.com/8080/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8080"
            label="EIP-8080" />
        

        
        

        
        <summary type="html">Allows exits to use consolidation queue, democratizing access to an unintended feature, improving liquidity while preserving security.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8080/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP allows exits to be routed through the consolidation queue when it is shorter than the exit queue, consuming churn that is allocated to consolidations. This democratizes access to a feature that is currently only available to validators with at least 2048 ETH through a loophole in the consolidation logic. The protocol then makes more efficient usage of the churn that its security parameters (weak subjectivity period) allow, and is able to process more exits without any security reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing design of consolidation mechanism allows validators with at least 2048 ETH to use the consolidation queue for exits through a loophole in the consolidation logic. When there is an imbalance between exit and consolidation queues favoring the latter, as has been the case since the introduction of the consolidation feature, this becomes an appealing way to speed up withdrawals. However, this feature is only available to a subset of validators, creating an unfair advantage.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than removing this unintended feature, this EIP democratizes it by making it available to all exits. This approach preserves fairness by ensuring equal access to this efficiency improvement, while also providing concrete benefits to the network. When consolidation activity is low, the consolidation churn would otherwise go unused. By allowing exits to use this churn, we ensure it is not wasted and can be put to productive use. This is particularly important given the current state of exit queue congestion, as the exit queue has been longer than forty days for an extended period of time. Long queues degrade user experience, slow operator response to market or operational events, and reduce the network&#x27;s ability to reconfigure stake more quickly after adverse events. Besides, solo stakers are arguably the participants that suffer the most from a lack of liquidity today, as they do not have the ability to issue a liquid staking token or maintain liquidity reserves.&lt;&#x2F;p&gt;
&lt;p&gt;By allowing exits to use consolidation churn when available, the maximum exit throughput increases significantly, without any security reduction since we are only reallocating churn that the protocol has already accounted for. In particular, the maximum exit churn that can be processed becomes &lt;code&gt;get_activation_exit_churn_limit(state) + 3 * get_consolidation_churn_limit(state) &#x2F;&#x2F; 2&lt;&#x2F;code&gt;, where the &lt;code&gt;3 &#x2F;&#x2F; 2&lt;&#x2F;code&gt; factor comes from the fact that one unit of exit churn corresponds to 2&#x2F;3 of a unit of consolidation churn. With current parameters and with the current total stake approximately 35.7M ETH, this results in 256 (the capped exit churn) + (544 - 256) * 3&#x2F;2 (the consolidation churn adjusted by the 3&#x2F;2 factor) = 688 ETH per epoch, representing approximately a 2.5x increase over the current maximum exit churn of 256 ETH per epoch.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Starting from the beginning of the epoch when this EIP is activated, Consensus Layer clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the modified &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; function which routes exits through the consolidation queue when it is shorter than the exit queue.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modified-compute-exit-epoch-and-update-churn&quot;&gt;Modified &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The only modification is this addition at the start of &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; compute_consolidation_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In particular, we route exits through the consolidation queue whenever &lt;code&gt;state.earliest_exit_epoch &amp;gt; state.earliest_consolidation_epoch&lt;&#x2F;code&gt;, by using &lt;code&gt;compute_consolidation_epoch_and_update_churn&lt;&#x2F;code&gt;. Note that the &lt;code&gt;exit_balance&lt;&#x2F;code&gt; passed to the latter is only &lt;code&gt;2 * exit_balance &#x2F;&#x2F; 3&lt;&#x2F;code&gt;, because each unit of exit churn corresponds to 2&#x2F;3 units of consolidation churn from a weak subjectivity perspective. This way, we keep the weak subjectivity impact of the consolidation queue the same regardless of whether it is used by consolidations or by exits, maximizing the amount of operations we can process while keeping the same security guarantees.&lt;&#x2F;p&gt;
&lt;p&gt;The full function is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_exit_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; exit_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    activation_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NEW in this EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; compute_consolidation_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; UNCHANGED FROM HERE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New epoch for exits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exit doesn&amp;#39;t fit in the current earliest epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the balance and update state variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The decision to democratize access to this unintended feature, rather than removing it or keeping it as is, is driven by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Fairness&lt;&#x2F;strong&gt;: All validators gain equal access to this efficiency improvement, rather than it being restricted to those with at least 2048 ETH who can exploit the loophole.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Efficiency&lt;&#x2F;strong&gt;: When consolidation activity is low, the consolidation churn would otherwise go unused. By allowing exits to use this churn, we ensure it is not wasted and can be put to productive use, improving staking liquidity with unchanged security guarantees.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To summarize, fairness is a strong motivation to either remove the feature or democratize it, and democratizing it is preferable to removing because we get a lot of efficiency benefits from it without any security cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards-incompatible changes to the Consensus Layer and must be activated via scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;weak-subjectivity-period&quot;&gt;Weak subjectivity period&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not impact the weak subjectivity period at all. The total churn remains the same, it is just allocated differently. In particular, the conversion factor (&lt;code&gt;exit_balance * 2 &#x2F;&#x2F; 3&lt;&#x2F;code&gt;) preserves the same weak subjectivity impact regardless of whether consolidation churn is allocated to exits or to consolidations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Prevent using consolidations as withdrawals</title>
        <published>2025-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8071/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8071-prevent-using-consolidations-as-withdrawals/26037" />
        

        <id>https://wg-eips.ritovision.com/8071/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8071"
            label="EIP-8071" />
        

        
        

        
        <summary type="html">Cancels consolidation if the max effective balance of the target validator will be exceeded, preventing the withdrawal of the unused balance</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8071/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Cancels a consolidation request if the effective balance of the target validator would exceed the max effective balance after processing it, which would result in the excess balance being withdrawn. This is an unintended way to speed up withdrawals when the consolidation queue is faster than the exit queue.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing design of consolidation mechanism leaves an opportunity to use consolidation queue for exits which becomes appealing to be abused when there is an imbalance between exit and consolidation queues favoring the latter.&lt;&#x2F;p&gt;
&lt;p&gt;At the date of writing this EIP, the consolidation flaw is being heavily exploited. There are public write ups on how to speed up withdrawals by using this vulnerability.&lt;&#x2F;p&gt;
&lt;p&gt;Even though this is a UX rather than security issue, consolidation queue was never meant to be used for withdrawals, which makes the fix introduced by this EIP an important modification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Starting from the beginning of the epoch when this EIP is activated, Consensus Layer client &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use the modified &lt;code&gt;process_consolidation_request&lt;&#x2F;code&gt; function which code is outlined below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-get-pending-balance-to-consolidate&quot;&gt;New &lt;code&gt;get_pending_balance_to_consolidate&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; target_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; pending_consolidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; pending_consolidation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; target_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            source_validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;modified-process-consolidation-request&quot;&gt;Modified &lt;code&gt;process_consolidation_request&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: This function is extended with the check of the target&#x27;s balance after consolidation and cancels consolidation request if the balance exceeds the max effective balance.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ConsolidationRequest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_valid_switch_to_compounding_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        request_source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        switch_to_compounding_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that source != target, so a consolidation cannot be used as an exit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the pending consolidations queue is full, consolidation requests are ignored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_CONSOLIDATIONS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If there is too little available consolidation churn limit, consolidation requests are ignored&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; get_consolidation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_ACTIVATION_BALANCE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify pubkeys exist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request_source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request_target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; request_source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; request_target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;source_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify source withdrawal credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; has_execution_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_correct_source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; is_correct_source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that target has compounding withdrawal credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the source and the target are active&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_active_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_validator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_active_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_validator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify exits for source and target have not been initiated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; target_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the source has been active long enough&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;activation_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SHARD_COMMITTEE_PERIOD&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify the source has no pending withdrawals in the queue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; get_pending_balance_to_withdraw&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in EIPXXXX]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the consolidating balance will&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; end up as active balance, not as excess balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_balance_after_consolidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_pending_balance_to_consolidate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; target_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; target_balance_after_consolidation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initiate source validator exit and append pending consolidation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_consolidation_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawable_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_VALIDATOR_WITHDRAWABILITY_DELAY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        PendingConsolidation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;source_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;source_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; target_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;target_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;iterating-over-pending-consolidations&quot;&gt;Iterating over pending consolidations&lt;&#x2F;h3&gt;
&lt;p&gt;The new design introduces an iteration over pending consolidations which increases complexity of consolidation processing.&lt;&#x2F;p&gt;
&lt;p&gt;This is done to handle the case when there are multiple consolidations with the same target and each of them doesn&#x27;t exceed the max effective balance while all of them together do.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards-incompatible changes to the Consensus Layer and must be activated via scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;test_single_consolidation_request_at_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_no_pending_consolidations_exceeding_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_single_pending_consolidation_exceeding_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_multiple_pending_consolidations_at_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_multiple_pending_consolidations_exceeding_max_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_exceeding_max_eb_with_the_target_balance_but_not_eb&lt;&#x2F;li&gt;
&lt;li&gt;test_exceeding_max_eb_with_the_source_eb_but_not_the_balance&lt;&#x2F;li&gt;
&lt;li&gt;test_multiple_pending_consolidations_exceeding_max_eb_with_the_source_eb_but_not_the_balance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All of the above test cases are implemented &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8071&#x2F;.&#x2F;assets&#x2F;test_process_consolidation_request.py&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When consolidation request results in max effective balance exceeded, it is cancelled on the Consensus Layer,
neither request fee nor transaction gas cost are refunded in this case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add sweep withdrawal fee for 0x01 validators</title>
        <published>2025-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8062/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8062-add-sweep-withdrawal-fee-for-0x01-validators/26003" />
        

        <id>https://wg-eips.ritovision.com/8062/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8062"
            label="EIP-8062" />
        

        
        

        
        <summary type="html">Improve stake consolidation and fairness by imposing a &quot;sweep&quot; withdrawal fee for `0x01` validators set to 0.05% of the withdrawn amount.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8062/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A fee is proposed on the partial &quot;sweep&quot; withdrawal of validators using &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials, to improve stake consolidation and fairness. Ethereum&#x27;s fast finality roadmap hinges on staking service providers migrating from &lt;code&gt;0x01&lt;&#x2F;code&gt; validators to &lt;code&gt;0x02&lt;&#x2F;code&gt; compounding validators. One roadblock is that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators receive free-of-charge partial skimming withdrawals for balances exceeding 32 ETH, which consume protocol resources that are not accounted for. To address this, a 0.05% fee is imposed on the partial &lt;code&gt;0x01&lt;&#x2F;code&gt; sweep using a minimal modification to &lt;code&gt;process_withdrawals()&lt;&#x2F;code&gt;, applying the new constant &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 2000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The roadmap for fast finality hinges on stake consolidation, where staking service providers (SSPs) transition from running 32-ETH validators with &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials to compounding validators with &lt;code&gt;0x02&lt;&#x2F;code&gt; credentials. A roadblock to this transition is that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators have been designed with close-to-ideal capital efficiency and free-of-charge partial withdrawals for balances exceeding 32 ETH (the &quot;sweep&quot; function). When factoring in switching costs, the incentives do not favor stake consolidation. At the same time, sweep withdrawals take up resources on both the consensus layer (CL) and execution layer (EL) that are not paid for. It is unsuitable to give &lt;code&gt;0x01&lt;&#x2F;code&gt; validators an accounting advantage over &lt;code&gt;0x02&lt;&#x2F;code&gt; validators when Ethereum&#x27;s roadmap hinges on stakers consolidating their stake in &lt;code&gt;0x02&lt;&#x2F;code&gt; validators.&lt;&#x2F;p&gt;
&lt;p&gt;To improve consolidation while upholding fairness, this EIP accounts for the resource load of the &lt;code&gt;0x01&lt;&#x2F;code&gt; partial withdrawal sweep by imposing a small withdrawal fee for it. The proposed fee is 0.05% of the withdrawn amount, imposed via &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 2000&lt;&#x2F;code&gt;. Since the average sweep withdrawal credits around 0.0235 ETH, the average expected fee per withdrawal is $0.0235;\mathrm{ETH} \times 0.0005 = 11,750;\mathrm{Gwei}$. The total expected fee over one year for a validator is 0.00048 ETH, corresponding to around $2 at the current ETH price. An SSP running 50,000 &lt;code&gt;0x01&lt;&#x2F;code&gt; validators (slightly below 5% of the stake) would thus need to pay around $100,000 per year in withdrawal fees.&lt;&#x2F;p&gt;
&lt;p&gt;The fee approximates the EL workload imposed by the sweep, calibrated against the average base fee over the last year (4.53 gwei). The withdrawal incurs equivalent to around 2204 gas (not accounting for CL work), implying a fee of $2204 \times 4.53 = 9,984;\mathrm{Gwei}$ (albeit, the base fee has been lower in recent months).&lt;&#x2F;p&gt;
&lt;p&gt;The fee is taken out on the CL as a percentage, since a fixed fee could produce extreme outcomes if the number of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators were to be drastically reduced due to consolidation. In such a scenario, the sweep will hit validators more frequently, and the fee will thus be taken out more frequently. Since validators then would also withdraw a lower balance each time, a percentage fee on the withdrawal keeps the burden on stakers fixed. The existing logic is kept intact to minimize complexity. As a result, a validator&#x27;s balance will dip just below 32 ETH after skimming (as also happens when receiving a penalty just after skimming).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_FEE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;In &lt;code&gt;process_withdrawals()&lt;&#x2F;code&gt;, take out a fee for skimmed &lt;code&gt;0x01&lt;&#x2F;code&gt; validators that did not perform a full exit, burning it on the CL:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; In this existing for-loop, calculate a fee before decreasing the balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        vi&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;vi&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;vi&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_FEE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decrease_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vi&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fast-finality&quot;&gt;Fast finality&lt;&#x2F;h3&gt;
&lt;p&gt;Fast finality is best realized through a reduction to the active validator set voting each round. Two paths have been envisioned. In one path referred to as Orbit SSF, the active set rotates in a weighted fashion, such that large consolidated validators always are active, and smaller validators are active less frequently. In another path, there is a fixed number of validator seats, with only the largest validators (e.g., the top 8,192) granted a seat. Both paths require consolidation to achieve a desirable stake weight and optimal performance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;level-of-the-proposed-fee&quot;&gt;Level of the proposed fee&lt;&#x2F;h3&gt;
&lt;p&gt;The cost per validator per year under 3% CL yield becomes $32 \times 0.03 &#x2F; 2000 = 0.00048$ ETH, corresponding to around $2 at a price of $4,167 per ETH. Table 1 summarizes outcomes under different numbers of validators. A solo staker running one &lt;code&gt;0x01&lt;&#x2F;code&gt; is unlikely to consider the $2 fee enough to tip the scale either way. A staking service provider (SSP) running 50,000 &lt;code&gt;0x01&lt;&#x2F;code&gt; validators (slightly below 5% of the stake) has at least a moderate incentive since the cost then is $100,000. Under perfect competition, the SSP will not be able to pass on this cost to their customers. The outcome under a higher fee is outlined in the Alternative specifications section.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Validators (stake %)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (ETH&#x2F;year)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (USD&#x2F;year)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1 (~0.0001%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.00048&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100 (~0.01%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.048&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10,000 (~1%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4.8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$20,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;50,000 (~5%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;24&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$100,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100,000 (~10%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;48&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$200,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Table 1.&lt;&#x2F;strong&gt; Cost to stakers under the proposed withdrawal fee.&lt;&#x2F;p&gt;
&lt;p&gt;The switching cost may still be greater than the yearly fee for an SSP. Some smart contracts requiring &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials may be frozen and others may require a full exit and entry, with associated opportunity costs. However, once the recurring fee is in place and there is a commitment from the protocol to phase out &lt;code&gt;0x01&lt;&#x2F;code&gt; validators for SSPs—potentially even raising the fee until such an outcome has been realized—then the switch will have to be done &lt;em&gt;eventually&lt;&#x2F;em&gt;. Ignoring other potential benefits of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators, a more accurate comparison is thus between the recurring fee and the capital cost for financing the switch, which of course is lower.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost accounting is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;500 gas – cold touch of an account known to have no code (as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;1000 gas – one account-leaf write in the account trie (as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;704 gas – an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawal {index: uint64, validator_index: uint64, address: bytes20, amount: uint64}, consisting of $8 + 8 + 20 + 8 = 44$ bytes, priced analogously to calldata at 16 gas&#x2F;byte.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It can be noted that we are not with this accounting charging for the CL work that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators impose due to the sweep. We are neither charging &lt;code&gt;0x02&lt;&#x2F;code&gt; validators for the CL work of EL-triggered partial withdrawals via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;, but they are charged more extensively on the EL for triggering the withdrawal. Further note that &lt;code&gt;2048&lt;&#x2F;code&gt;-ETH validators are exempted in the specification from the sweep withdrawal fee, to avoid harming consolidation, and as an acknowledgement that &lt;code&gt;2048&lt;&#x2F;code&gt; ETH is the maximum stake that the protocol currently is designed to handle.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;capital-efficiency-and-opportunity-cost&quot;&gt;Capital efficiency and opportunity cost&lt;&#x2F;h3&gt;
&lt;p&gt;Besides free withdrawals, another benefit of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators is the capital efficiency. A compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator will on average have 0.75 ETH sitting idle, not counting toward the effective balance (EB). This is due to the current hysteresis design, where a validator that gradually increases its balance will hold between 0.25 to 1.25 more ETH than their EB. A &lt;code&gt;0x01&lt;&#x2F;code&gt; validator will on average have just $0.0235&#x2F;2 = 0.01175$ ETH idle, and are thus much more capital-efficient, particularly when the compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator holds a moderate balance overall.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 1 illustrates the change in yield relative to a baseline with a neutral EB design, where, as the balance compounds, it is on average equal to the EB. The blue line is the yield of compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validators, which receive a lower yield due to the on average 0.75 ETH lower EB than the balance. The green circles are the yield that skimming 32-ETH and 2048-ETH validators receive. The orange line is the fee imposed on &lt;code&gt;0x01&lt;&#x2F;code&gt; validators proposed in the main specification. As evident, this fee does not fully offset the loss due to yield drag for &lt;code&gt;0x02&lt;&#x2F;code&gt; validators at validator balances below around 1,000 ETH.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8062&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; Relative change in staking yield due to differences in capital efficiency of different validator configurations. The proposed fee is shown in orange.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8068&#x2F;&quot;&gt;EIP-8068&lt;&#x2F;a&gt; addresses differences in capital efficiency between &lt;code&gt;0x01&lt;&#x2F;code&gt; and &lt;code&gt;0x02&lt;&#x2F;code&gt; validators with a neutral EB design, where the hysteresis threshold raises the EB at +0.5. This effectively shifts the blue line, positioning all compounding validators at the black line.&lt;&#x2F;p&gt;
&lt;p&gt;If EIP-8068 is not included in the same hardfork as this EIP, we could instead raise the withdrawal fee to compensate. The alternative specification below therefore outlines a higher fee. This will however not address the other concern addressed by EIP-8068: a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator can leverage the hysteresis and make a partial withdrawal once having reached 33 ETH EB, such that they only need to hold 32.75 ETH while keeping 33 ETH EB. This concern can, on the other hand, also be addressed on its own for minimal complexity, as outlined in the alternative specification of EIP-8068.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specification&quot;&gt;Alternative specification&lt;&#x2F;h3&gt;
&lt;p&gt;If EIP-8068 is not included in the same hardfork as this EIP, it is reasonable to compensate for the lower capital efficiency of &lt;code&gt;0x02&lt;&#x2F;code&gt; validators by setting a higher withdrawal fee. This way, stakers will be less likely to remain on their &lt;code&gt;0x01&lt;&#x2F;code&gt; validators just for the better capital efficiency. Figure 2 shows three different alternative fees with red lines. The white squares illustrate equal capital efficiency between a &lt;code&gt;0x01&lt;&#x2F;code&gt; validator under the proposed fee and a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator at some specific validator balance.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8062&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;Figure 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2.&lt;&#x2F;strong&gt; Relative change in staking yield due to differences in capital efficiency of different validator configurations. The main proposed fee is shown in orange, and alternative fees are shown in red.&lt;&#x2F;p&gt;
&lt;p&gt;The main option shown by the full red line is to raise the fee from 0.05% to 0.5%, setting &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 200&lt;&#x2F;code&gt;. This means that a 32-ETH &lt;code&gt;0x01&lt;&#x2F;code&gt; validator will have approximately the same capital efficiency as a 128-ETH &lt;code&gt;0x02&lt;&#x2F;code&gt; validator. A stronger option is to impose a 1% fee as shown by the dashed red line, setting &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 100&lt;&#x2F;code&gt;. Under this option, consolidating to a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator will always at least be neutral, if the staker runs more than one &lt;code&gt;0x01&lt;&#x2F;code&gt; validator. A less forceful option is shown by the red dotted line, instead setting &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 400&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Table 2 outlines the cost to stakers under the primary alternative specification with &lt;code&gt;WITHDRAWAL_FEE_FRACTION = 200&lt;&#x2F;code&gt;. Stakers then pay an additional $20 per validator. That means that an SSP running 5% of the stake would take a loss of around one million dollars per year, representing a much stronger incentive to consolidate.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Validators (stake %)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (ETH&#x2F;year)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost (USD&#x2F;year)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1 (~0.0001%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.0048&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100 (~0.01%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0.48&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$2k&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10k (~1%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;48&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$200k&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;50k (~5%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;240&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$1M&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;100k (~10%)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;480&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;$2M&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;Table 2.&lt;&#x2F;strong&gt; Cost to stakers under the alternative higher withdrawal fee of 0.5% (&lt;code&gt;WITHDRAWAL_FEE_FRACTION = 200&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To the best of the authors&#x27; knowledge, there are no security risks associated with the proposed fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Neutral effective balance design</title>
        <published>2025-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8068/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8068-neutral-effective-balance-design/26015" />
        

        <id>https://wg-eips.ritovision.com/8068/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8068"
            label="EIP-8068" />
        

        
        

        
        <summary type="html">Make the effective balance calculation neutral so that 0x01 and 0x02 validators receive the same yield, thus facilitating consolidation.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8068/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a neutral effective balance (EB) design to ensure &lt;code&gt;0x01&lt;&#x2F;code&gt; (skimming) and &lt;code&gt;0x02&lt;&#x2F;code&gt; (compounding) validators receive equal yields. Currently, validators that compound their balance have poor capital efficiency and lower yields as their idle balance (not contributing to EB) is 0.75 ETH, significantly higher than that of skimming validators at near-zero. This disincentivizes stake consolidation critical to Ethereum&#x27;s fast finality roadmap. Additionally, the current hysteresis rules allow &lt;code&gt;0x02&lt;&#x2F;code&gt; validators to game the hysteresis by keeping their balance below the EB. The increased profitability at lower balances could further harm consolidation. This proposal sets the EB hysteresis upward threshold to the neutral +0.5 and the downward threshold to +0.25. To prevent gaming after operations like partial withdrawals, the EB is reset to the floor of the balance, and a one-time &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; set. This threshold is derived from an integral equation that ensures the average idle balance is zero as the validator&#x27;s balance compounds up to the next integer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The roadmap for fast finality hinges on stake consolidation, where staking service providers (SSPs) transition from running 32-ETH validators with &lt;code&gt;0x01&lt;&#x2F;code&gt; credentials to compounding validators with &lt;code&gt;0x02&lt;&#x2F;code&gt; credentials. A roadblock to this transition is that &lt;code&gt;0x01&lt;&#x2F;code&gt; validators have close-to-ideal capital efficiency, whereas &lt;code&gt;0x02&lt;&#x2F;code&gt; validators have poor capital efficiency during compounding. Furthermore, the optimal configuration for a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator is to reduce its balance to 32.75 ETH and prevent it from compounding further. These incentives may lead Ethereum&#x27;s fast-finality roadmap to be delayed. To prevent this, a neutral effective balance calculation is proposed, that sees all validator configurations earn the same CL yield.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;0x02&lt;&#x2F;code&gt; validator that compounds its balance $b$ as intended will on average have 0.75 ETH of its balance not counting toward its effective balance (EB, or $E$ in equations). Specifically, with the current EB step bands, the idle remainder $r=b-E \in[0.25, 1.25)$ and $\bar{r}=(0.25+1.25)&#x2F;2=0.75$. A &lt;code&gt;0x01&lt;&#x2F;code&gt; validator operating at 32 ETH has a much lower idle remainder, on average half the withdrawal sweep of $0.0235&#x2F;2 = 0.01175$ ETH. A 32-ETH &lt;code&gt;0x01&lt;&#x2F;code&gt; validator will therefore earn around 2.3% more CL yield than a compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator that grows from 32.25 ETH to 34.25 ETH over around two years.&lt;&#x2F;p&gt;
&lt;p&gt;A separate issue is that &lt;code&gt;0x02&lt;&#x2F;code&gt; validators can make a partial withdrawal down to 32.75 ETH when having any EB &amp;gt;33 ETH, leveraging the hysteresis to retain a 33 ETH EB. The surplus capital can then be deployed to increase the staking yield, running multiple 32.75-ETH validators. Assuming a 3% CL yield, recurring partial withdrawals deployed at 33 ETH to bring down the balance to 32.75 ETH, and ignoring the exit queue capital drag, the approach is more profitable than running skimming 2048-ETH validators under current base fees.&lt;&#x2F;p&gt;
&lt;p&gt;To uphold fairness while not disrupting the current operation of &lt;code&gt;0x01&lt;&#x2F;code&gt; validators, the following changes are made:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The upward EB step from $E$ to $E+1$ is imposed at $E + 0.5$. During regular upward compounding, the EB is thus set as the balance rounded to the nearest integer. This leads a compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validator to on average have a $E=b$, just like a 32-ETH &lt;code&gt;0x01&lt;&#x2F;code&gt; validator.&lt;&#x2F;li&gt;
&lt;li&gt;The downward step to $E$ is imposed at $E+0.25$ ($E_{+1}-0.75$).&lt;&#x2F;li&gt;
&lt;li&gt;Partial withdrawals are prevented from gaming the protocol. The EB calculation is designed such that each partial withdrawal is treated neutrally: $E=b$. To achieve this, the following takes place after every partial withdrawal at epoch boundaries:
&lt;ul&gt;
&lt;li&gt;The EB is initiated to the integer floor of the balance: $E = \text{EB}(b_0) = \lfloor b_0 \rfloor$.&lt;&#x2F;li&gt;
&lt;li&gt;A new field &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; ($t$) is stored in the beacon state.&lt;&#x2F;li&gt;
&lt;li&gt;This threshold is computed as $t = E + \frac{1+(b_0-E)^2}{2}$, derived from the integral equation that stipulates that the validator will on average have $E=b$ when it smoothly grows its balance up until the next integer (see the Rationale).&lt;&#x2F;li&gt;
&lt;li&gt;To increase the EB, the balance must satisfy both the regular upward threshold &lt;em&gt;and&lt;&#x2F;em&gt; the &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt;, after which &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; is reset to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Change two existing constants:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HYSTERESIS_DOWNWARD_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HYSTERESIS_UPWARD_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;containers&quot;&gt;Containers&lt;&#x2F;h3&gt;
&lt;p&gt;Two new fields are added to the state:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Gwei&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;boolean&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;On upgrade, both lists are initialized to length &lt;code&gt;len(state.validators)&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;False&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;A new helper is added for re-initializing EB and the &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; for validators that have been marked for EB reset; this helper is invoked during epoch processing.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; initiate_effective_balance_and_threshold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The existing &lt;code&gt;process_effective_balance_updates()&lt;&#x2F;code&gt; is modified to call the new helper before updating the EB, and so that the EB update accounts for the &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt;. We show here the whole function for completeness:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_effective_balance_updates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update effective balances with hysteresis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        HYSTERESIS_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_QUOTIENT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        DOWNWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_DOWNWARD_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        UPWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYSTERESIS_UPWARD_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            initiate_effective_balance_and_threshold&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Then, adjust the existing if-clause to account for the temporary_upward_threshold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOWNWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;balance_floor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; UPWARD_THRESHOLD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_eb&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balance_floor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; balance_floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_eb&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; balance_floor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_eb&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;temporary_upward_threshold&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When processing partial withdrawal, the flag for reseting the EB is set.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decrease_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add a new if-clause and append withdrawals for which we reset the EB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reset_eb_flags&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relative-change-in-staking-yield&quot;&gt;Relative change in staking yield&lt;&#x2F;h3&gt;
&lt;p&gt;The figure shows the impact of the current EB bands and hysteresis design on validator yields for different validator configuations. The relative change in staking yield is plotted against a baseline 0 which corresponds to what compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validators would earn if $E=b$, as in the neutral effective balance design. Note that these are relative changes, so a validator at -0.01 under a CL yield of 3% would earn $0.99 \times 3 = 2.97$% in yield.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8068&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The blue line is compounding &lt;code&gt;0x02&lt;&#x2F;code&gt; validators, which on average will have 0.75 ETH not counting against their EB. A staker that runs a &lt;code&gt;0x02&lt;&#x2F;code&gt; validator instead of a &lt;code&gt;0x01&lt;&#x2F;code&gt; validator then earns $100\times0.75&#x2F;b$% lower staking yield. For example, at 32.25 ETH, that difference works out to 2.33%.&lt;&#x2F;p&gt;
&lt;p&gt;The red lines capture &lt;code&gt;0x02&lt;&#x2F;code&gt; validators that repeatedly withdraw down to the downward hysteresis threshold at $-0.25$ relative to an integer EB, thus achieving a surplus 0.25 EB relative to their actual balance. They let the balance grow until it is optimal to withdraw it, accounting for a partial withdrawal costing 84500 gas. So for example, starting at 32.75 ETH and with a 0.5 gwei base fee, that works out to making the withdrawal at around 32.80 ETH. The staker then earns 0.56% more staking yield than the baseline, factoring in a 4.5 days delay between when the withdrawn ETH stops earning yield and when it is available at the EL (dashed red line). This delay accounts for a 256 epoch withdrawal eligibility period and an average wait time until the sweep hits of 3.4 days (at a hypothetical future 770 000 active validators). Without the delay, that figure is 0.60%. When the base is 0 and there is a 4.5 days delay, the validator instead earns 0.72% more staking yield (full red line).&lt;&#x2F;p&gt;
&lt;p&gt;The green circles are sweeped &lt;code&gt;0x01&lt;&#x2F;code&gt; validators. They earn slightly less than the baseline due to the accruing balance in excess of 32 ETH and 2048 ETH not counting toward the EB, and being delayed by around 3.4 days.  (in this specific example where the delay )&lt;&#x2F;p&gt;
&lt;p&gt;This comparison could be nuanced further by potentially accounting for a deposit delay, but the ETH does not necessarily need to be deposited directly into the staking contract to bring value to its holder. Another nuance is that a slashing is driven by EB and not validator balance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;equation-for-the-temporary-upward-threshold&quot;&gt;Equation for the temporary upward threshold&lt;&#x2F;h3&gt;
&lt;p&gt;To prevent gaming after a partial withdrawal, the EB is first reset to $E = \lfloor b_0 \rfloor$, where $b_0$ is the new balance. This creates an initial idle remainder $r_0 = b_0 - E$.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;temporary_upward_threshold&lt;&#x2F;code&gt; ($t$) is then set to ensure the &lt;em&gt;average&lt;&#x2F;em&gt; idle balance is zero as the validator&#x27;s balance compounds from $b_0$ to the next integer, $E+1$.&lt;&#x2F;p&gt;
&lt;p&gt;This threshold $t$ is calculated to solve the &quot;zero-area&quot; problem: the positive idle balance accumulated while $\text{EB}=E$ (from $b_0$ to $t$) must exactly cancel the negative idle balance accumulated while $\text{EB}=E+1$ (from $t$ to $E+1$). This is expressed by the integral equation:&lt;&#x2F;p&gt;
&lt;p&gt;$\int_{b_0}^{t}(b-E) db + \int_{t}^{E+1}(b-(E+1)) db = 0.$&lt;&#x2F;p&gt;
&lt;p&gt;Solving for $t$ yields the formula used in the specification:&lt;&#x2F;p&gt;
&lt;p&gt;$t = E + \frac{1+r_0^2}{2},$&lt;&#x2F;p&gt;
&lt;p&gt;where $r_0 = b_0 - E$.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications&quot;&gt;Alternative specifications&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;simple-fix-of-eb-gaming-under-current-bands&quot;&gt;Simple fix of EB gaming under current bands&lt;&#x2F;h4&gt;
&lt;p&gt;An alternative minimal specification is to only fix the gaming incentive, and instead compensate for the lower yield of &lt;code&gt;0x02&lt;&#x2F;code&gt; validators by increasing the withdrawal fee in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8062&#x2F;&quot;&gt;EIP-8062&lt;&#x2F;a&gt;. Only the partial withdrawal is adjusted. For this specification, only the &lt;code&gt;pending_eb_resets&lt;&#x2F;code&gt; need to be stored in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_eb_resets&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_PARTIAL_WITHDRAWALS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Append the validator index to &lt;code&gt;pending_eb_resets&lt;&#x2F;code&gt; in &lt;code&gt;process_withdrawals()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        decrease_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add a new if-clause and append withdrawals for which we reset the EB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; has_compounding_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_eb_resets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify &lt;code&gt;process_effective_balance_updates()&lt;&#x2F;code&gt; to reset the effective balance upon a partial withdrawal. The balance is never allowed to increase during the reset.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_effective_balance_updates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Apply EB resets for executed withdrawals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_eb_resets&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            get_max_effective_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;effective_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_eb_resets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP would trigger a mass upward change of EBs at the specific hardfork boundary. The effect of this should be analyzed furher.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Bytecode Deduplication Discount</title>
        <published>2025-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Carlos Perez</name><uri>https://github.com/CPerezz</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8058/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8058-contract-bytecode-deduplication-discount/25933" />
        

        <id>https://wg-eips.ritovision.com/8058/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8058"
            label="EIP-8058" />
        

        
        

        
        <summary type="html">Reduces gas costs for deploying duplicate contract bytecode via access-list based mechanism</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8058/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a gas discount for contract deployments when the bytecode being deployed already exists in the state. By leveraging EIP-2930 access lists, any contract address included in the access list automatically contributes its code hash to a deduplication check. When the deployed bytecode matches an existing code hash from the access list, the deployment avoids paying &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; costs since clients already store the bytecode and only need to link the new account to the existing code hash.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP becomes particularly relevant with the adoption of EIP-8037, which increases &lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt; from 200 to 1,900 gas per byte. Under EIP-8037, deploying a 24kB contract would cost approximately 46.6M gas for code deposit alone, making the deduplication discount economically significant for applications that deploy identical bytecode multiple times.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, deploying duplicate bytecode costs the same as deploying new bytecode, even though execution clients don&#x27;t store duplicated code in their databases. When the same bytecode is deployed multiple times, clients store only one copy and have multiple accounts point to the same code hash. Under EIP-8037&#x27;s proposed gas costs, deploying a 24kB contract costs approximately 46.6M gas for code deposit alone (&lt;code&gt;1,900 × 24,576&lt;&#x2F;code&gt;). This charge is unfair for duplicate deployments where no additional storage is consumed.&lt;&#x2F;p&gt;
&lt;p&gt;A naive &quot;check if code exists in database&quot; approach would break consensus because different nodes have different database contents due to mostly Sync-mode differences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Full-sync nodes: Retain all historical code, including from reverted&#x2F;reorged transactions&lt;&#x2F;li&gt;
&lt;li&gt;Snap-sync nodes: initially, only store code referenced in the pivot state tries, and those accumulated past the start of the sync&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Empirical analysis reveals that approximately 27,869 bytecodes existed in full-synced node databases with no live account pointing to them (as of the Cancun fork). A database lookup &lt;code&gt;CodeExists(hash)&lt;&#x2F;code&gt; would yield different results on different nodes, causing different gas costs and breaking consensus.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal solves the problem by making deduplication checks implicit and deterministic through access lists, ensuring all nodes compute identical gas costs regardless of their database state. (Notice here that even if fully-synced clients have more codes, there are no accounts whose codeHash actually is referencing them. Thus, users can&#x27;t profit from such discounts which keeps consensus safe).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implicit-deduplication-via-access-lists&quot;&gt;Implicit Deduplication via Access Lists&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal leverages the existing EIP-2930 access list structure without any modifications. No new fields or protocol changes are required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;codehash-access-set-construction&quot;&gt;CodeHash Access-Set Construction&lt;&#x2F;h3&gt;
&lt;p&gt;Before transaction execution begins, build a set &lt;code&gt;W&lt;&#x2F;code&gt; (the &quot;CodeHash Access-Set&quot;) as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;W = { codeHash(a) | a ∈ accessList, a exists in state, a has code }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;W&lt;&#x2F;code&gt; is built from state at the &lt;strong&gt;start&lt;&#x2F;strong&gt; of transaction execution (before any state changes)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;All&lt;&#x2F;strong&gt; addresses in the access list are checked - if they exist in state and have deployed code, their code hash is added to &lt;code&gt;W&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Empty accounts or accounts with no code do not contribute to &lt;code&gt;W&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;contract-creation-gas-accounting&quot;&gt;Contract Creation Gas Accounting&lt;&#x2F;h3&gt;
&lt;p&gt;When a contract creation transaction or opcode (&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;) successfully completes and returns bytecode &lt;code&gt;B&lt;&#x2F;code&gt; of length &lt;code&gt;L&lt;&#x2F;code&gt;, compute &lt;code&gt;H = keccak256(B)&lt;&#x2F;code&gt; and apply the following gas charges:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Deduplication check:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;H ∉ W&lt;&#x2F;code&gt;: Bytecode is new
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Persist bytecode &lt;code&gt;B&lt;&#x2F;code&gt; under hash &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Link the new account&#x27;s &lt;code&gt;codeHash&lt;&#x2F;code&gt; to &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, link the new account&#x27;s &lt;code&gt;codeHash&lt;&#x2F;code&gt; to the existing code hash &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Gas costs:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The cost of reading &lt;code&gt;codeHash&lt;&#x2F;code&gt; for access-listed addresses is already covered by EIP-2929&#x2F;2930 access costs (intrinsic access-list cost and cold→warm state access charges).&lt;&#x2F;li&gt;
&lt;li&gt;No additional gas cost is introduced for the deduplication check itself.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;implementation-pseudocode&quot;&gt;Implementation Pseudocode&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Before transaction execution:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;W&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; tuple&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    warm&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tuple&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per EIP-2930&#x2F;EIP-2929 rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    acc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; load_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;tuple&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; acc&lt;&#x2F;span&gt;&lt;span&gt; exists&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; acc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; empty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        W&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;acc&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;codeHash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; On successful CREATE&#x2F;CREATE2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;B&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; H&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; W&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Duplicate: no deposit gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    link_codehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; H&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New bytecode: charge and persist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_CODE_DEPOSIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;B&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    persist_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;H&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; B&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    link_codehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; H&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;same-block-deployments&quot;&gt;Same-Block Deployments&lt;&#x2F;h3&gt;
&lt;p&gt;Sequential transaction execution ensures that a deployment storing new code makes it visible to later transactions in the same block:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Transaction &lt;code&gt;T_A&lt;&#x2F;code&gt; deploys bytecode &lt;code&gt;B&lt;&#x2F;code&gt; at address &lt;code&gt;X&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pays full &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; (no prior contract has this bytecode)&lt;&#x2F;li&gt;
&lt;li&gt;Code is stored under hash &lt;code&gt;H = keccak256(B)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Later transaction &lt;code&gt;T_B&lt;&#x2F;code&gt; in the same block deploys the same bytecode &lt;code&gt;B&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;T_B&lt;&#x2F;code&gt; includes address &lt;code&gt;X&lt;&#x2F;code&gt; in its access list&lt;&#x2F;li&gt;
&lt;li&gt;When &lt;code&gt;T_B&lt;&#x2F;code&gt; executes, &lt;code&gt;W&lt;&#x2F;code&gt; is built from the current state (including &lt;code&gt;T_A&lt;&#x2F;code&gt;&#x27;s changes)&lt;&#x2F;li&gt;
&lt;li&gt;Since &lt;code&gt;X&lt;&#x2F;code&gt; now exists and is in the access list, &lt;code&gt;W&lt;&#x2F;code&gt; contains &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;T_B&lt;&#x2F;code&gt;&#x27;s deployment gets the discount&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;While this only tries to formalize the behavior, it&#x27;s important to remark that this kind of behavior is complex. As it requires control over tx ordering in order to abuse. Builders can&#x27;t modify the access list as it is already signed with the transaction. Nevertheless, this could happen, thus is formalized here.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;edge-case-simultaneous-new-deployments&quot;&gt;Edge Case: Simultaneous New Deployments&lt;&#x2F;h3&gt;
&lt;p&gt;If two transactions in the same block both deploy identical new bytecode and neither references an existing contract with that bytecode in their access lists, both will pay full &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Example:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transaction &lt;code&gt;T_A&lt;&#x2F;code&gt; deploys bytecode &lt;code&gt;B&lt;&#x2F;code&gt; producing code hash &lt;code&gt;0xCA&lt;&#x2F;code&gt; at address &lt;code&gt;X&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Transaction &lt;code&gt;T_B&lt;&#x2F;code&gt; (later in same block) also deploys bytecode &lt;code&gt;B&lt;&#x2F;code&gt; producing code hash &lt;code&gt;0xCA&lt;&#x2F;code&gt; at address &lt;code&gt;Y&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;T_B&lt;&#x2F;code&gt;&#x27;s access list does NOT include address &lt;code&gt;X&lt;&#x2F;code&gt;, then &lt;code&gt;T_B&lt;&#x2F;code&gt; pays full deposit cost&lt;&#x2F;li&gt;
&lt;li&gt;Deduplication only occurs when the deploying address is included in the access list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is acceptable because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The first deployment cannot be known at transaction construction time&lt;&#x2F;li&gt;
&lt;li&gt;Deduplication requires implicit opt-in via access list&lt;&#x2F;li&gt;
&lt;li&gt;This scenario is extremely rare in practice&lt;&#x2F;li&gt;
&lt;li&gt;The complexity of special handling is not worth the minimal benefit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-access-list-based-deduplication&quot;&gt;Why Access-List Based Deduplication?&lt;&#x2F;h3&gt;
&lt;p&gt;The access-list approach provides several critical properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Deterministic behavior:
The result depends only on the transaction&#x27;s access list and current state, not on local database contents. All nodes compute the same gas cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No reverse index requirement:
Unlike other approaches, this doesn&#x27;t require maintaining a &lt;code&gt;codeHash → [accounts]&lt;&#x2F;code&gt; reverse index, which would add significant complexity and storage overhead.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Leverages existing infrastructure:
Builds on EIP-2930 access lists and EIP-2929 access costs, requiring minimal protocol changes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Implicit optimization:
Any address included in the access list automatically contributes to deduplication. This provides automatic gas optimization without requiring explicit flags or special handling.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoids chain split risks:
Since no new transaction structure is introduced, there&#x27;s no risk of nodes rejecting transactions with unknown fields. The same transaction format works before and after the fork, with only the gas accounting rules changing at fork activation.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Forward compatibility:
All nodes enforce identical behavior. Wallets can add addresses to access lists to optimize gas, but this doesn&#x27;t change transaction validity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoid having a code-root for state:
At this point, clients handle code storage on their own ways. They don&#x27;t have any consensus on the deployed existing codes (besides that all of the ones referenced in account&#x27;s codehash fields exist).
Changing this seems a lot more complex and unnecessary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal requires a scheduled network upgrade but is designed to be forward-compatible with existing transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Transaction compatibility:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;No changes to transaction structure - uses existing EIP-2930 access lists&lt;&#x2F;li&gt;
&lt;li&gt;Existing transactions with access lists automatically benefit from deduplication post-fork&lt;&#x2F;li&gt;
&lt;li&gt;Transactions without access lists behave identically to current behavior (no deduplication discount)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Wallet and tooling updates:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RPC methods like &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; SHOULD account for potential deduplication discounts when access lists are present&lt;&#x2F;li&gt;
&lt;li&gt;Wallets MAY provide UI for users to add addresses to access lists for deduplication&lt;&#x2F;li&gt;
&lt;li&gt;Transaction builders MAY automatically detect duplicate deployments and include relevant addresses in access lists&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Node implementation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;No changes to state trie structure or database schema required&lt;&#x2F;li&gt;
&lt;li&gt;No changes to transaction parsing or RLP encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;example-transaction&quot;&gt;Example Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Deploying a contract with the same bytecode as the contract at &lt;code&gt;0x1234...5678&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;from&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xabcd...ef00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x608060405234801561001...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1234567890123456789012345678901234567890&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;      &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;storageKeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the deployed bytecode hash matches &lt;code&gt;codeHash(0x1234...5678)&lt;&#x2F;code&gt; (which is automatically checked because the address is in the access list), the deployment receives the deduplication discount.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost-accuracy&quot;&gt;Gas Cost Accuracy&lt;&#x2F;h3&gt;
&lt;p&gt;The deduplication mechanism ensures that gas costs accurately reflect actual resource consumption. Duplicate deployments don&#x27;t consume additional storage, so they shouldn&#x27;t pay storage costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;denial-of-service&quot;&gt;Denial of Service&lt;&#x2F;h3&gt;
&lt;p&gt;The access-list mechanism prevents DoS attacks because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The cost of reading &lt;code&gt;codeHash&lt;&#x2F;code&gt; is already covered by EIP-2929&#x2F;2930&lt;&#x2F;li&gt;
&lt;li&gt;No additional state lookups or database queries are required&lt;&#x2F;li&gt;
&lt;li&gt;The deduplication check is O(1) (set membership test)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas Units Rebase for High-precision Metering</title>
        <published>2025-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8059/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8059-gas-rebase-for-high-precision-gas-metering/25945" />
        

        <id>https://wg-eips.ritovision.com/8059/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8059"
            label="EIP-8059" />
        

        
        

        
        <summary type="html">Gas parameters and variables are increased to a factor of `REBASE_FACTOR` to reduce rounding errors without major changes to the EVM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8059/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal rebases Ethereum’s gas unit to a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt; to enable high-precision metering without introducing fractional gas. All gas-related parameters and variables are increased to a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;. This reduces rounding errors that arise when repricing EVM operations and future-proofs gas costs as hardware improves and state access remains costly, while avoiding major changes in the internal logic of the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, most EVM compute operations (&lt;code&gt;ADD&lt;&#x2F;code&gt;, &lt;code&gt;SUB&lt;&#x2F;code&gt;, &lt;code&gt;MUL&lt;&#x2F;code&gt;, etc.) are significantly underpriced when compared with state operations (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, etc.). There are two factors contributing to this mismatch. On one hand, client optimizations and hardware improvements have made pure compute operations more efficient. On the other hand, with the growing size of the Ethereum state, the performance of I&#x2F;O operations touching this larger state has been deteriorating. Both of these trends are expected to continue, further worsening this mismatch.&lt;&#x2F;p&gt;
&lt;p&gt;There are a couple of proposals to reduce the cost of compute operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;&quot;&gt;EIP-7904&lt;&#x2F;a&gt;) and increase the cost of state operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;). However, given the current level of mismatch between these operations, there is an inherent trade-off in the anchor we use to reprice these operations.&lt;&#x2F;p&gt;
&lt;p&gt;If we make compute operations cheaper, we will introduce rounding errors, with most compute operations costing 1, when they should cost a fraction of that. These rounding errors impact scalability because we can now fit fewer of these cheaper operations in any given block. However, if we price all operations so that the fastest opcode is assigned 1 gas, we would need to make all other operations significantly more expensive, including both compute and state operations. Such a level of price increases would severely reduce throughput at current block limits.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate this point, let&#x27;s focus on the pure compute operations. As compute operations impact only block execution time, the chosen anchor will induce a specific million gas per second rate on all compute opcodes. For instance, if we anchor on &lt;code&gt;EcRecover&lt;&#x2F;code&gt; at the current price (3000 gas units), this induces a rate of 175Mgas&#x2F;s, based on the execution time estimated for this opcode on &lt;a href=&quot;..&#x2F;07904&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;EIP-7904&#x27;s empirical analysis&lt;&#x2F;a&gt;. The following plot shows the average rounding errors of compute operations for different anchors, using the same execution time estimates from EIP-7904.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8059&#x2F;.&#x2F;assets&#x2F;round_error_by_anchor.png&quot; alt=&quot;round_error_by_anchor&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As we can see, with an anchor of 50Mgas&#x2F;s (which would result in a gas limit of 100Mgas, assuming a 2-second block execution limit), we would get an average rounding error of 59.3%. This means that we could be 59.3% cheaper on average per opcode if we didn&#x27;t have to round to integer gas units. Only after a 400Mgas&#x2F;s anchor do we get to reasonably low rounding errors. Without fractional gas, which would introduce further complexity to the EVM gas calculation, this level of Mgas&#x2F;s anchor requires a major rebase of the gas model, where all opcodes become significantly more expensive, and both the transaction-level and block-level gas limits increase by the same factor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This proposal introduces a gas rebase such that all gas-related parameters and variables are increased by a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At fork boundary, &lt;code&gt;calculate_base_fee_per_gas&lt;&#x2F;code&gt; is updated so that both &lt;code&gt;parent_gas_used&lt;&#x2F;code&gt; and &lt;code&gt;parent_base_fee_per_gas&lt;&#x2F;code&gt; are also scaled by a factor of &lt;code&gt;REBASE_FACTOR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A rebase factor of 1000 has two advantages:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is large enough to completely remove rounding errors for compute operations now and to be future-proof. As we can see from the motivation, an anchor of 400Mgas&#x2F;s would be enough to reduce these errors. Assuming a 2-second block execution time, this results in a block limit of 800M gas units, which requires an increase of 22x over the current 36M block limit.&lt;&#x2F;li&gt;
&lt;li&gt;It makes reasoning about the new gas unit simpler. Block limits and targets move from million units to billion units, while gas costs move from units to thousand units.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Increasing the cost of state access operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, the increase in units in &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasUsed&lt;&#x2F;code&gt; will increase the size of the RLP representation the block header by 2 bytes. More analysis is needed to assess the bandwidth impacts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Inter-Block Temporal Locality Gas Discounts</title>
        <published>2025-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Amirul Ashraf</name><uri>https://github.com/asdacap</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8057/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8057-block-temporal-locality-gas-discounts/25912" />
        

        <id>https://wg-eips.ritovision.com/8057/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8057"
            label="EIP-8057" />
        

        
        

        
        <summary type="html">Multi‑block temporal locality discounts for state and account access</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8057/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a deterministic, multi-block discount for the first access to accounts and storage keys in a transaction. The discount depends on how many blocks have passed since the item was last accessed, decaying smoothly to zero over a fixed recent window. Intra-block warming semantics are unchanged - there is no warming across transactions within a block.&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism builds on block-level access lists (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;), which are committed in prior blocks. This allows a newly synced node to correctly price the first block it validates without replaying historical execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current warm and cold access pricing correctly models client state costs in the &lt;em&gt;worst case&lt;&#x2F;em&gt; but leaves a predictable efficiency gap in the &lt;em&gt;common case&lt;&#x2F;em&gt;. Clients maintain short-lived in-memory caches of recently accessed accounts and storage slots to handle short reorgs and pipeline execution across blocks. These caches make accesses from recent blocks materially cheaper than fully cold loads, yet the gas model does not reflect this.&lt;&#x2F;p&gt;
&lt;p&gt;As a result, Ethereum&#x27;s gas schedule is conservative: it prices every &quot;first access&quot; as if it were completely cold, even though for most active contracts those lookups are served from hot caches or SSD pages still in memory. The gap between average and worst-case cost limits how far the block gas limit can safely rise-clients must size for the worst case even if most blocks are far cheaper in practice.&lt;&#x2F;p&gt;
&lt;p&gt;We can adjust gas prices to surface this mechanical sympathy, rewarding patterns that align naturally with how hardware and clients already behave.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal narrows that gap in a deterministic and consensus-safe way. It introduces a smoothly decaying, per-item discount based solely on &lt;em&gt;publicly observable prior-block activity&lt;&#x2F;em&gt; recorded in block-level access lists (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;). That achieves three effects:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Predictability at submission time&lt;&#x2F;strong&gt; - Unlike same-block or cross-transaction warming, discounts depend only on past blocks, so users, builders, and wallets can compute exact costs deterministically from on-chain data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Behavioural alignment&lt;&#x2F;strong&gt; - The mechanism encourages natural temporal locality: dapps and operators who reuse state within a few blocks save gas, reflecting the real cost profile of client caching.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Improved L1 scalability&lt;&#x2F;strong&gt; - By reducing the &lt;em&gt;average&lt;&#x2F;em&gt; gas cost of realistic workloads without changing the &lt;em&gt;worst case&lt;&#x2F;em&gt;, 8057 effectively raises real execution throughput per gas, helping move toward the &quot;Scale L1&quot; goal of larger blocks and better hardware utilisation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Empirically, traces show that most hot contracts are touched repeatedly within a few blocks. A 32-block (≈6-minute) window captures the majority of these recurrences. In this regime, total gas usage per block can fall by several percent in steady state, freeing execution capacity without altering consensus rules or transaction semantics.&lt;&#x2F;p&gt;
&lt;p&gt;In short, 8057 aligns Ethereum&#x27;s gas economics with real execution cost, using already-available data (BALs) to make temporal locality explicit, deterministic, and beneficial.&lt;&#x2F;p&gt;
&lt;p&gt;As the saving depends only on publicly observable prior-block activity, it is knowable at submission time. Unlike same-block effects, it is therefore behaviour-shaping rather than incidental. It nudges workloads that naturally cluster accesses to keep doing so, matching how clients amortise repeated recent accesses.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal is intentionally scoped to per-transaction warming and does not apply intra-block warming across transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terminology-and-constants&quot;&gt;Terminology and constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Default&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of recent blocks over which a discount may apply.&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The block number of the transaction being executed.&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LAST_ACCESS_BLOCK_NUMBER(item)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The most recent block number strictly less than &lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt; in which &lt;code&gt;item&lt;&#x2F;code&gt; was accessed by an executed transaction. If unknown or older than &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;, it is treated as not found.&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(item)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;CURRENT_BLOCK_NUMBER - LAST_ACCESS_BLOCK_NUMBER(item)&lt;&#x2F;code&gt; when the latter is found, else a value greater than &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Gas constants from existing behaviour:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Discount caps (this EIP treats maximum as full cold surcharge, minimum as zero):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This means the closest prior-block usage allows the first access in a transaction to be charged at warm cost, and the far edge of the window trends to the normal cold-plus-warm cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scope-of-operations&quot;&gt;Scope of operations&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP applies the discount to the &lt;strong&gt;first access in a transaction&lt;&#x2F;strong&gt; of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage keys accessed by &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and by any operation that first reads a slot as part of its semantics (for example, &lt;code&gt;SSTORE&lt;&#x2F;code&gt;&#x27;s read step).&lt;&#x2F;li&gt;
&lt;li&gt;Account touches that incur the cold account access surcharge under the current gas schedule, including but not limited to: &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, and the target account of &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Writes are affected &lt;strong&gt;only&lt;&#x2F;strong&gt; to the extent they perform an initial read or account touch that would have been charged as cold. Write-specific costs and any refund semantics are unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Precompiles remain unchanged and are always warm. Because they do not pay a cold surcharge, no discount is applied to precompile calls.&lt;&#x2F;p&gt;
&lt;p&gt;Access lists per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; remain effective and, when present, pre-warm the listed addresses and storage keys at the start of the transaction. For items that are pre-warmed by an access list, this temporal discount does not apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;discount-function&quot;&gt;Discount function&lt;&#x2F;h3&gt;
&lt;p&gt;The discount decays smoothly with block distance, using a &lt;strong&gt;reversed Hermite smoothstep&lt;&#x2F;strong&gt; interpolation over the discount window.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8057&#x2F;.&#x2F;assets&#x2F;gas_discount_percentage.png&quot; alt=&quot;Gas discount percentage graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Mathematically:&lt;&#x2F;p&gt;
&lt;p&gt;$x = \mathrm{clamp}\left( \frac{D - 1}{W - 1}, 0, 1 \right)$&lt;&#x2F;p&gt;
&lt;p&gt;$f(D, W) = d_{\text{min}} + (d_{\text{max}} - d_{\text{min}})
\cdot \left( 1 - \left( 3x^2 - 2x^3 \right) \right)$&lt;&#x2F;p&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$D$ = block distance in blocks&lt;&#x2F;li&gt;
&lt;li&gt;$W$ = window size in blocks&lt;&#x2F;li&gt;
&lt;li&gt;$d_{\text{min}}$, $d_{\text{max}}$ = minimum and maximum discounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This form maps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$D = 1$ → full discount $(f = d_{\text{max}})$&lt;&#x2F;li&gt;
&lt;li&gt;$D = W$ → no discount $(f = d_{\text{min}})$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Programmatic form&lt;&#x2F;p&gt;
&lt;p&gt;Reference smoothstep helper:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; smoothstep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;edge0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; edge1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Scale and clamp x to [0, 1], then apply cubic Hermite smoothstep.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; edge0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;edge1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; edge0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Calculation steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NORMALIZED_DISTANCE = (BLOCK_DISTANCE_IN_BLOCKS - 1) &#x2F; (WINDOW_SIZE_BLOCKS - 1)&lt;&#x2F;code&gt; clamped to &lt;code&gt;[0, 1]&lt;&#x2F;code&gt;.  This maps distance &lt;code&gt;1&lt;&#x2F;code&gt; → &lt;code&gt;0&lt;&#x2F;code&gt; and distance &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; → &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SMOOTHSTEP_VALUE = smoothstep(0.0, 1.0, NORMALIZED_DISTANCE)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DISCOUNT_FACTOR = 1.0 - SMOOTHSTEP_VALUE&lt;&#x2F;code&gt; (equals &lt;code&gt;1.0&lt;&#x2F;code&gt; at distance &lt;code&gt;1&lt;&#x2F;code&gt;, and &lt;code&gt;0.0&lt;&#x2F;code&gt; at distance &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a given opcode family with parameters &lt;code&gt;DISCOUNT_MAX&lt;&#x2F;code&gt; and &lt;code&gt;DISCOUNT_MIN&lt;&#x2F;code&gt;, the integer discount applied to the &lt;strong&gt;cold surcharge&lt;&#x2F;strong&gt; is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DISCOUNT_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    NORMALIZED_DISTANCE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        0.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SMOOTHSTEP_VALUE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; smoothstep&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NORMALIZED_DISTANCE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DISCOUNT_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1.0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SMOOTHSTEP_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DISCOUNT_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DISCOUNT_MIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; round&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MAX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DISCOUNT_MIN&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DISCOUNT_FACTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All arithmetic must be implemented in &lt;strong&gt;integer space&lt;&#x2F;strong&gt; in consensus-critical code; floating point is shown here only for clarity. &lt;code&gt;round()&lt;&#x2F;code&gt; follows &lt;em&gt;round half up&lt;&#x2F;em&gt; semantics; any deterministic rule is acceptable if consistently applied across clients.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism is a &lt;strong&gt;discount&lt;&#x2F;strong&gt;, not a refund. It reduces gas charged upfront for a cold surcharge; it does not emit a rebate and does not affect refund accounting or receipts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;charging-rules-per-transaction&quot;&gt;Charging rules (per transaction)&lt;&#x2F;h3&gt;
&lt;p&gt;For the first access to an &lt;code&gt;ITEM&lt;&#x2F;code&gt; &lt;strong&gt;within a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;ITEM&lt;&#x2F;code&gt; is already warm in this transaction due to same-transaction rules or pre-warmed via a transaction access list, charge the warm cost defined today. No temporal discount applies.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Otherwise compute &lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(ITEM)&lt;&#x2F;code&gt;. If &lt;code&gt;1 &amp;lt;= BLOCK_DISTANCE_IN_BLOCKS(ITEM) &amp;lt;= WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;, apply the discount to the cold surcharge:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Storage read first access cost:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SLOAD_FIRST_ACCESS_COST = SLOAD_WARM_GAS_COST + max(0, SLOAD_COLD_SURCHARGE_GAS - DISCOUNT_SLOAD(BLOCK_DISTANCE_IN_BLOCKS))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Account-touch first access cost:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ACCOUNT_FIRST_ACCESS_COST = ACCOUNT_WARM_GAS_COST + max(0, ACCOUNT_COLD_SURCHARGE_GAS - DISCOUNT_ACCOUNT(BLOCK_DISTANCE_IN_BLOCKS))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(ITEM) &amp;gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; or not found, charge the unmodified cold surcharge plus the warm component as today.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Subsequent accesses to the same &lt;code&gt;ITEM&lt;&#x2F;code&gt; within the &lt;strong&gt;same transaction&lt;&#x2F;strong&gt; are warm as per existing rules. This EIP does not introduce block-level warming across transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initial-sync-and-pricing-with-block-level-access-lists&quot;&gt;Initial sync and pricing with block-level access lists&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP requires block-level access lists in blocks. Each block carries commitments to the sets of accounts and storage keys accessed during that block.&lt;&#x2F;p&gt;
&lt;p&gt;A newly synced node can price the very first block it validates as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For a block to validate at &lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt;, gather the BALs for the previous &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; blocks.&lt;&#x2F;li&gt;
&lt;li&gt;For each of those blocks, obtain the committed sets of accessed accounts and storage keys from the block body.&lt;&#x2F;li&gt;
&lt;li&gt;Build a local index mapping each seen &lt;code&gt;ITEM&lt;&#x2F;code&gt; to the most recent block number in which it appears within that window. This becomes &lt;code&gt;LAST_ACCESS_BLOCK_NUMBER(ITEM)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When validating &lt;code&gt;CURRENT_BLOCK_NUMBER&lt;&#x2F;code&gt;, for each first access to &lt;code&gt;ITEM&lt;&#x2F;code&gt;, compute
&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS(ITEM) = CURRENT_BLOCK_NUMBER - LAST_ACCESS_BLOCK_NUMBER(ITEM)&lt;&#x2F;code&gt;
when present, else treat as out-of-window. Apply the discount rules above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Reorgs longer than &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; fall back to the same procedure as initial resync. Items not present in the new canonical window are treated as cold.&lt;&#x2F;p&gt;
&lt;p&gt;No execution of historical transactions is required to compute the discount at validation time. Stateless verifiers can price gas using the current block plus compact proofs that an item appears in one of the previous &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; access lists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-gas-estimation-guidance&quot;&gt;Wallet gas estimation guidance&lt;&#x2F;h3&gt;
&lt;p&gt;Wallets and RPC endpoints should not assume that a temporal discount will apply at submission, because the exact landing block is uncertain. General-purpose estimators should price as if no temporal discount applies.&lt;&#x2F;p&gt;
&lt;p&gt;Operators who can predict landing with high confidence - for example via priority fees and private order flow - may account for the exact discount, but this is an advanced path and not the default.&lt;&#x2F;p&gt;
&lt;p&gt;Motivated operators who can reliably land transactions in a specific block - for example via private order flow and appropriately set priority fees - may account for the exact discount. This is an advanced use case and should not be the default behaviour for general-purpose wallets.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-guidance&quot;&gt;Implementation guidance&lt;&#x2F;h3&gt;
&lt;p&gt;Clients are expected to maintain a rolling in-memory index to avoid rescanning prior blocks for each block:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keep a ring buffer of &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; buckets, one per recent block. Each bucket stores first-touched accounts and first-touched storage keys for that block.&lt;&#x2F;li&gt;
&lt;li&gt;Maintain two maps, &lt;code&gt;LAST_SEEN_ACCOUNT&lt;&#x2F;code&gt; and &lt;code&gt;LAST_SEEN_STORAGE_KEY&lt;&#x2F;code&gt;, which track the most recent block index within the window where each item was present. On block advance, drop the oldest bucket and delete items that only appeared there, or mark them as out-of-window.&lt;&#x2F;li&gt;
&lt;li&gt;During execution, when an opcode is about to charge a cold surcharge for an item not yet warm in the current transaction, look up &lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt; from the &lt;code&gt;LAST_SEEN_*&lt;&#x2F;code&gt; map and charge using the rules above. Then record first touches for the current block in the current bucket and update the maps.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This design keeps memory bounded by &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; multiplied by the number of distinct first touches per block, which is itself bounded by the block gas limit divided by the minimum per-item cost.&lt;&#x2F;p&gt;
&lt;p&gt;This is one practical approach; clients may also implement this via existing caches or by embedding and pruning block-distance hints in their state trie.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test cases&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;example-parameters-and-results&quot;&gt;Example parameters and results&lt;&#x2F;h3&gt;
&lt;p&gt;Assume the following defaults:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_WARM_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MAX_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DISCOUNT_MIN_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;example-first-storage-read-in-a-transaction&quot;&gt;Example: first storage read in a transaction&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Equal to warm&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1827&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;373&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1099&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mid-window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;347&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1853&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fully cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;example-first-account-touch-in-a-transaction&quot;&gt;Example: first account touch in a transaction&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Equal to warm&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2262&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;438&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1363&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1337&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mid-window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;430&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2270&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fully cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Exact integer results are determined by the reference implementation&#x27;s rounding rule (&lt;code&gt;round_to_nearest&lt;&#x2F;code&gt;, half-up).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reference-implementation-python-integer-only&quot;&gt;Reference implementation (Python, integer only)&lt;&#x2F;h3&gt;
&lt;p&gt;This implementation is normative for rounding and scaling. It uses a power-of-two fixed-point scale so divisions by the scale are exact shifts in low-level implementations. All intermediates fit below 2**53 so a JavaScript client can mirror these steps without a big number library.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gas constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOAD_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCOUNT_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2600&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Temporal discount parameters&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MAX_SLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MIN_SLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MAX_ACCOUNT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;DISCOUNT_MIN_ACCOUNT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fixed-point scale (2^25 = 33,554,432)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SCALE_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;HALF_SCALE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SCALE_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; smooth_factor_scaled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                         window_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns round_to_nearest(SCALE_FACTOR * DISCOUNT_FACTOR) where:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      normalized_distance = (block_distance_in_blocks - 1) &#x2F; (window_blocks - 1),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      clamped to [0, 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      smoothstep_value = normalized_distance^2 * (3 - 2 * normalized_distance)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;      discount_factor = 1 - smoothstep_value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The result is in [0, SCALE_FACTOR].&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; window_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use exact rational form to minimize scaling multiplications:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Let t = block_distance_in_blocks - 1, d = window_blocks - 1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; discount_factor = (d^3 - 3*d*t^2 + 2*t^3) &#x2F; d^3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; window_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    d3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; d3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Round half up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SCALE_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;d3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; discount_gas_units&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                       discount_max&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                       discount_min&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Integer discount within the window using the smooth falloff.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns an integer number of gas units to subtract from the cold surcharge.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    factor_scaled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; smooth_factor_scaled&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WINDOW_SIZE_BLOCKS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    span&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; discount_max&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; discount_min&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    scaled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;span&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; factor_scaled&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HALF_SCALE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SCALE_FACTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; discount_min&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; scaled&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    disc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; discount_gas_units&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MAX_SLOAD&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MIN_SLOAD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; disc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    disc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; discount_gas_units&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MAX_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                              DISCOUNT_MIN_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_COLD_SURCHARGE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; disc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cold_part&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_WARM_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; cold_part&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Using lookup tables&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SLOAD first access cost per block distance (1-32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WINDOW_SIZE_BLOCKS = 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOAD_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 106&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 125&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 155&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 196&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 246&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 306&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 373&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    447&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 528&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 615&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 706&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 800&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 898&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 998&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1099&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    1201&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1302&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1402&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1500&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1594&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1685&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1772&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1853&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    1927&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1994&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2054&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2104&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2145&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2175&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2194&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account first access cost per block distance (1-32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; WINDOW_SIZE_BLOCKS = 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCOUNT_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 108&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 131&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 168&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 219&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 281&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 354&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 438&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    530&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 630&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 737&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 850&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 967&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1088&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1212&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1337&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    1463&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1588&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1712&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1833&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1950&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2063&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2170&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2270&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    2362&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2446&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2519&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2581&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2632&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2669&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2692&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sload_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOAD_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2200&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fully cold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account_first_access_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCOUNT_FIRST_ACCESS_COST_LUT&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;block_distance_in_blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2700&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fully cold&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Determinism: discounts depend only on prior blocks, so users can predict costs at submission time. The block-level access lists in headers remove bootstrap ambiguity for new nodes. Intra-block dependent savings are inherently unknowable and non-actionable at submission, so they do not change behaviour; prior-block based savings do.&lt;&#x2F;li&gt;
&lt;li&gt;Smooth curve: the chosen polynomial keeps strong incentive for very recent history and eases toward zero, aligning with how caches deliver benefit for temporal locality. Linear ramps are simpler but produce harsher edges.&lt;&#x2F;li&gt;
&lt;li&gt;Window of 32: this captures longer-lived temporal locality without turning the feature into a long-term subsidy, and keeps proof and index sizes small.&lt;&#x2F;li&gt;
&lt;li&gt;Discount not refund: reduces upfront charge only; does not change refund semantics or receipts.&lt;&#x2F;li&gt;
&lt;li&gt;No correlation: simple to implement and reason about. The model is explicitly about last-access distance, not frequency.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Builder rotation and similar operational concerns are out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behavioural-effects&quot;&gt;Behavioural effects&lt;&#x2F;h3&gt;
&lt;p&gt;The smoothstep curve over 32 blocks is gentle. Discount remains close to maximum for roughly the first 12 to 16 blocks and decays toward zero near the far edge of the window.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;storage-slot-sload-first-access-pricing&quot;&gt;Storage slot (SLOAD) first-access pricing&lt;&#x2F;h4&gt;
&lt;p&gt;(warm = 100, cold surcharge = 2100, window = 32)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully warm equivalent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2045&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;155&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;almost full discount&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1827&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;373&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1494&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;706&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1099&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;midpoint of window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;898&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1302&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1500&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;347&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1853&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;28&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;96&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2104&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;near-cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2200&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully cold access&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;account-access-first-access-pricing&quot;&gt;Account access first-access pricing&lt;&#x2F;h4&gt;
&lt;p&gt;(warm = 100, cold surcharge = 2600, window = 32)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;BLOCK_DISTANCE_IN_BLOCKS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Discount&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Charge&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully warm equivalent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2532&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;168&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;almost full discount&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2262&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;438&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1850&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;850&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1363&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1337&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;midpoint of window&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1588&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;867&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;1833&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;430&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2270&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;28&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;119&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2581&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;near-cold&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;window edge&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;&amp;gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;code&gt;2700&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;fully cold access&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;observations&quot;&gt;Observations&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Accesses 1-6 blocks apart remain effectively warm, typically under 300-400 gas total.&lt;&#x2F;li&gt;
&lt;li&gt;Around 16 blocks (≈3.2 minutes), costs reach roughly half the cold surcharge.&lt;&#x2F;li&gt;
&lt;li&gt;By 28-32 blocks (≈5.5-6.4 minutes, one finalisation epoch), costs are nearly cold again.&lt;&#x2F;li&gt;
&lt;li&gt;The transition is smooth and monotone; there are no cliffs or discontinuities to game.&lt;&#x2F;li&gt;
&lt;li&gt;Both account and storage families charge exactly the warm rate for items accessed in the immediately preceding block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As the discount depends only on &lt;strong&gt;prior blocks&lt;&#x2F;strong&gt;, users and dapps can plan around it. Unlike same-block effects, these savings are predictable: they are visible before submission and can be incorporated into automation or fee-scheduling logic.&lt;&#x2F;p&gt;
&lt;p&gt;If an operator wants to maintain most of the discount while sending as few transactions as possible, a practical cadence for items touched repeatedly is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Maintain about &lt;strong&gt;80 percent&lt;&#x2F;strong&gt; of the maximum discount by ensuring the item is touched again within &lt;strong&gt;8-9 blocks&lt;&#x2F;strong&gt; (around two minutes).&lt;&#x2F;li&gt;
&lt;li&gt;Maintain about &lt;strong&gt;50 percent&lt;&#x2F;strong&gt; of the maximum discount by touching again within &lt;strong&gt;16 blocks&lt;&#x2F;strong&gt; (half an epoch).&lt;&#x2F;li&gt;
&lt;li&gt;Beyond roughly &lt;strong&gt;28 blocks&lt;&#x2F;strong&gt;, the discount fades almost entirely; by &lt;strong&gt;32 blocks&lt;&#x2F;strong&gt;, the access is fully cold again.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In short, a &lt;strong&gt;maintenance touch every 8-12 blocks&lt;&#x2F;strong&gt; is an efficient balance: high retained discount with modest transaction frequency. Applications seeking tighter control-such as bridges, keepers, or batching relayers-can choose shorter cadences, while ordinary usage patterns will keep frequently accessed state warm naturally.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;smooth decay curve&lt;&#x2F;strong&gt; is important. It means missing the ideal block due to a temporary spike in gas prices or unexpected congestion doesn&#x27;t abruptly forfeit the entire discount-costs rise gradually, not cliff-edge. This avoids brittle strategies that depend on exact timing and makes the mechanism more forgiving in volatile network conditions.&lt;&#x2F;p&gt;
&lt;p&gt;From a UX standpoint, humans are unlikely to act precisely within these timeframes, but automated systems can. Many popular contract surfaces-AMM reserves, token balances, or oracle feeds-stay warm simply through organic activity, letting users benefit indirectly.&lt;&#x2F;p&gt;
&lt;p&gt;Each account or storage key&#x27;s discount remains &lt;strong&gt;independent&lt;&#x2F;strong&gt;. Repeated touches within the window only update the item&#x27;s last-access block; they do not stack or correlate across different items.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;coordinated-multi-eoa-warm-up-behaviour&quot;&gt;Coordinated multi-EOA warm-up behaviour&lt;&#x2F;h4&gt;
&lt;p&gt;Because the temporal discount depends only on &lt;strong&gt;prior-block access&lt;&#x2F;strong&gt;, a coordinated actor controlling multiple EOAs or contracts can sequence transactions to capture the maximum discount. For example, a lightweight &quot;warm-up&quot; transaction from one EOA in block &lt;code&gt;N&lt;&#x2F;code&gt; can touch a set of storage keys or accounts, allowing one or more follow-up transactions in block &lt;code&gt;N+1&lt;&#x2F;code&gt; to execute those same accesses at &lt;strong&gt;warm-equivalent cost&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This &lt;strong&gt;inter-block pipelining&lt;&#x2F;strong&gt; remains predictable, verifiable, and legitimate. It does not distort consensus or introduce hidden state; it simply rewards actors who cluster related work in adjacent blocks. The discount gained is bounded by the cold surcharge itself, while the overhead of coordination, additional priority fees, and builder inclusion uncertainty all limit how aggressively this pattern can be used. In practice, it is most relevant for highly automated systems-keepers, rollup bridges, or arbitrage bundles-that already coordinate sequencing across blocks.&lt;&#x2F;p&gt;
&lt;p&gt;With the &lt;strong&gt;32-block window&lt;&#x2F;strong&gt;, the value of pipelining falls off much faster. Missing a single block only slightly reduces the discount because of the smooth decay curve, but missing several in a row quickly erodes it. That makes warm-ups more predictable yet self-limiting: actors can&#x27;t cheaply &quot;bank&quot; state heat far ahead, only maintain it across a short epoch-length horizon.&lt;&#x2F;p&gt;
&lt;p&gt;Builders and MEV searchers may still find minor advantage in chaining related operations across consecutive blocks, but this behaviour is &lt;strong&gt;constructive&lt;&#x2F;strong&gt;: it improves temporal locality in state access and lowers aggregate load on clients. The overall effect is a gentle nudge toward efficient state reuse, not a new coordination game.&lt;&#x2F;p&gt;
&lt;p&gt;If desired, protocol parameters could trim the incentive surface further-for example, by setting &lt;code&gt;DISCOUNT_MAX_*&lt;&#x2F;code&gt; slightly below the full cold surcharge so that even &lt;code&gt;D = 1&lt;&#x2F;code&gt; accesses remain marginally above the intra-transaction warm price. This specification treats that as optional tuning rather than a security necessity, accepting the small and predictable incentive as a reasonable trade-off for encouraging block-to-block efficiency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relationship-to-block-level-warming-proposals&quot;&gt;Relationship to block-level warming proposals&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not introduce intra-block warming across transactions. If a block-level warming proposal is active, its semantics are unchanged. The temporal discount defined here applies only to the first access to an item in a transaction based on prior-block history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes gas charging and therefore requires a hard fork. It only decreases or equalises costs for affected opcodes and does not introduce new failure modes for existing contracts. Warm and cold cost upper bounds do not increase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Determinism and consensus safety:&lt;&#x2F;strong&gt;
All discounts are derived from &lt;em&gt;previously committed block data&lt;&#x2F;em&gt;. No client-local or probabilistic state (like caches or heuristics) affects consensus. Any node-stateless or fully synced-can price gas deterministically using the current block and the prior &lt;code&gt;WINDOW_SIZE_BLOCKS&lt;&#x2F;code&gt; access-list commitments. This preserves verifiability and supports stateless validation with compact proofs referencing recent blocks only.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Index growth and memory bounds:&lt;&#x2F;strong&gt;
Clients must maintain a rolling index of recently accessed items. With a 32-block window, memory use scales with the number of distinct first-accessed items per block-bounded by the block gas limit divided by the minimum per-item cost. This fits comfortably within existing cache budgets, and entries naturally expire as blocks advance.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reorg handling:&lt;&#x2F;strong&gt; Reorgs shorter than the window are cheap to recompute: nodes rebuild the index from the new canonical access lists. Longer reorgs fall back to initial resync behaviour. No historical transaction replay is required. Because discounts depend on committed data only, there is no ambiguity or consensus divergence across reorgs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Abuse and incentive surface:&lt;&#x2F;strong&gt; The design intentionally makes &quot;warm-up&quot; transactions unprofitable. Since the maximum discount equals the cold surcharge, warming a slot in block &lt;em&gt;N&lt;&#x2F;em&gt; and using it in &lt;em&gt;N+1&lt;&#x2F;em&gt; costs slightly &lt;em&gt;more&lt;&#x2F;em&gt; than a single cold access (e.g. &lt;code&gt;2200 + 100 &amp;gt; 2200&lt;&#x2F;code&gt;). Thus there is no economic gain from spamming to maintain heat. The smooth decay curve further discourages exact-block timing games: adjacent blocks differ by only a handful of gas units at small distances.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Economic neutrality:&lt;&#x2F;strong&gt; The mechanism reduces &lt;em&gt;average&lt;&#x2F;em&gt; per-access cost but leaves &lt;em&gt;worst-case&lt;&#x2F;em&gt; costs unchanged. Builders and block producers still target the same gas limit under EIP-1559, so total basefee burn and priority-fee dynamics remain stable. The network simply fits more real execution into the same gas target, improving efficiency without altering incentives for congestion or inclusion.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Stateless compatibility:&lt;&#x2F;strong&gt;
Earlier multi-block warming ideas were considered incompatible with stateless validation because pricing depended on uncommitted or ephemeral state. By tying discounts to BAL commitments, this proposal makes the pricing rule provable and verifiable. Stateless verifiers need only one compact proof of inclusion in a recent BAL-no historical execution replay, no private cache dependency.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for Falcon support</title>
        <published>2025-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Renaud Dubois</name><uri>https://github.com/rdubois-crypto</uri>
	</author>
	
	<author>
		<name>Simon Masson</name><uri>https://github.com/simonmasson</uri>
	</author>
	
	<author>
		<name>Antonio Sanso</name><uri>https://github.com/asanso</uri>
	</author>
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/mariusvanderwijden</uri>
	</author>
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Zhenfei Zhang</name><uri>https://github.com/zhenfeizhang</uri>
	</author>
	
	<author>
		<name>Nicolas Consigny</name><uri>https://github.com/nconsigny</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8052/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8052-precompile-for-falcon-support/25860" />
        

        <id>https://wg-eips.ritovision.com/8052/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8052"
            label="EIP-8052" />
        

        
        

        
        <summary type="html">Proposal to add a precompiled contract that performs signature verifications using the Falcon signature scheme.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8052/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal creates a precompiled contract that performs signature verifications using the Falcon-512 signature scheme by given parameters of the message hash, signature, and public key. This allows any EVM chain -- principally Ethereum roll-ups -- to integrate this precompiled contract easily.&lt;&#x2F;p&gt;
&lt;p&gt;The signature scheme can be instantiated in two version:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Falcon, the standard signature scheme, fully compliant with the algorithm recommended by the NIST,&lt;&#x2F;li&gt;
&lt;li&gt;An EVM-friendly version where the hash function is efficiently computed in the Ethereum Virtual Machine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Three precompiled contracts are specified (formerly called &lt;code&gt;ETH_HASH_TO_POINT&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;HASH_TO_POINT_ETH&lt;&#x2F;code&gt; in drafts):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt; — NIST-compliant Hash-to-Point using SHAKE256.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt; — EVM-friendly Hash-to-Point using a Keccak-based XOF&#x2F;PRNG.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt; — the core algorithm of Falcon, that verifies the signature from the obtained (HashToPoint) challenge.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Quantum computers pose a long-term risk to classical cryptographic algorithms. In particular, signature algorithms based on the hardness of the Elliptic Curve Discrete Logarithm Problem (ECDLP) such as secp256k1, are widely used in Ethereum and threaten by quantum algorithms. This exposes potentially on-chain assets and critical infrastructure to quantum adversaries.&lt;&#x2F;p&gt;
&lt;p&gt;Integrating post-quantum signature schemes is crucial to future-proof Ethereum and other EVM-based environments. It shall be noted that infrastructure for post-quantum signatures should be deployed &lt;em&gt;before&lt;&#x2F;em&gt; quantum adversaries are known to be practical because it takes on the order of years for existing applications to integrate.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon, a lattice-based scheme standardized by NIST, offers high security against both classical and quantum adversaries. Its compact signature size (666 bytes for Falcon-512) and its efficient verification algorithm make it well-suited for blockchain applications, where gas usage and transaction throughput are critical considerations.&lt;&#x2F;p&gt;
&lt;!-- When the public key is also stored together with the signature, it leads to 666 + 896 = 1562 bytes.
Using the recovery mode, it can be reduced to 1292 + 32 = 1324 bytes. --&gt;
&lt;!--
For Falcon,
    σ=666 (40 bytes of salt, ~626 bytes for s2)
    pk = 896,
    TOTAL=1562
For FalconRec,
    σ=1292 (40 bytes of salt, ~626 bytes for s1, ~626 bytes for s2),
    pk = 32,
    TOTAL=1324
--&gt;
&lt;p&gt;In the context of the Ethereum Virtual Machine, a precompile for Keccak256 hash function is already available, making Falcon verification much faster when instantiated with an extendable output function derived from Keccak than with SHAKE256, as specified in NIST submission. This EIP specifies a split of the signature verification into two sub procedures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt; or &lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt;, instantiated with a different extendable Output Function: the first with SHAKE256 (as recommended by NIST), the second with Keccak-PRNG (a version that is more efficient when computed in the EVM). In the future, it is possible to define it for SNARK&#x2F;STARK circuits. An appropriated hash function choice reduces drastically the circuit size and the proving time in the context of ZK applications.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt;, that does not require any hash computation. This sub-algorithm follows the NIST recommendation so that:
&lt;ul&gt;
&lt;li&gt;using the SHAKE256 &lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt;, the signature is fully compliant with the NIST standard,&lt;&#x2F;li&gt;
&lt;li&gt;using the KeccakPRNG &lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt;, the verification can be efficient even in the EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Using this separation, two important features are provided: one version being fully compliant with the NIST specification, the other deviating from the standard in order to reduce the gas cost, and opening up to possible computations of Falcon signature ZK proofs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon can be instantiated with polynomials of degree $512$ or $1024$, leading to a different security level.  Falcon-512 is chosen, leading to a security level equivalent to RSA2048.
This setting leads to the following size for signatures and keys:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Falcon&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;n&lt;&#x2F;strong&gt; (lattice dimension)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;512&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;q&lt;&#x2F;strong&gt; (modulus)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;12289&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Padded signature size&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;666&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Public Key size&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;896&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Private key size&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1281&lt;&#x2F;code&gt; bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;From a high level, a signature verification can be decomposed in two steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;challenge computation&lt;&#x2F;strong&gt;, that involves the message and the salt, and computes a challenge polynomial using a XOF (instantiated with SHAKE256 and a Keccak-base PRNG here),&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;strong&gt;core algorithm&lt;&#x2F;strong&gt;, that compute polynomial arithmetic (with the challenge, the public key and the signature), and finally verify the shortness of the full signature $(s_1,s_2)$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following pseudo-code highlights how these two algorithms are involved in a Falcon verification, and how the modularity of the challenge computation opens up to two version of Falcon:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; falcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify a Falcon Signature following NIST standard&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes): The message to sign.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): The signature containing 40 bytes of salt and 626 bytes of compressed signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        pubkey (bytes): The Falcon public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bool: True if the signature is valid, False otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Compute the Hash To Point Challenge (see 3.1.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; HASH_TO_POINT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Verify Falcon Core Algorithm (see 3.2.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; FALCON_CORE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ethfalcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify a Falcon Signature (EVM-friendly mode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes): The message to sign.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): The signature containing 40 bytes of salt and 626 bytes of compressed signature.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        pubkey (bytes): The Falcon public key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bool: True if the signature is valid, False otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Compute the Hash To Point Challenge (see 3.1.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ETH_HASH_TO_POINT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Verify Falcon Core Algorithm (see 3.2.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; FALCON_CORE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The functions &lt;code&gt;falcon512_verify&lt;&#x2F;code&gt; and &lt;code&gt;ethfalcon512_verify&lt;&#x2F;code&gt; call the precompiles specified in the next sections: &lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt;, &lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt; and &lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-to-point-challenge-normative&quot;&gt;Hash-to-Point challenge (normative)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Parse Input Data:&lt;&#x2F;strong&gt; Check the byte sizes and then extract the message and the signature. The parsed signature is a tuple of values $(r, s_2)$. $r$ is denoted as the salt and contains bytes, and $s_2$ is denoted as the signature vector, a vector of elements mod $q$.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify Well-formedness:&lt;&#x2F;strong&gt; Verify that the signature contains a 40-byte salt $r$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- See the `Required Checks in Verification` section for more details. --&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;&lt;strong&gt;Compute the challenge $c$:&lt;&#x2F;strong&gt; the challenge is obtained from hash-to-point on the salt $r$ of the signature and the message. The output $c$ is a polynomial of degree 512, stored in 896 bytes.
The hash-to-point function computes extendable Output from a hash Function (XOF). This EIP provides two instantiations of a XOF:
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;SHAKE256 is the XOF provided in NIST submission, a sponge construction derived from SHA256. Extracting bytes using SHAKE256 calls the &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; permutation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create&lt;&#x2F;span&gt;&lt;span&gt; an&lt;&#x2F;span&gt;&lt;span&gt; empty&lt;&#x2F;span&gt;&lt;span&gt; sponge&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    absorb&lt;&#x2F;span&gt;&lt;span&gt; into&lt;&#x2F;span&gt;&lt;span&gt; Keccak&lt;&#x2F;span&gt;&lt;span&gt; sponge&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_flip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pad&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; finalize&lt;&#x2F;span&gt;&lt;span&gt; sponge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span&gt;no&lt;&#x2F;span&gt;&lt;span&gt; fixed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt; digest&lt;&#x2F;span&gt;&lt;span&gt; yet&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SHAKE256_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Keccak_f&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; apply permutation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_part&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; take r-bit &amp;quot;rate&amp;quot; portion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While this construction is standardized, it is expensive when computed in the Ethereum Virtual Machine because &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; has no EVM opcode.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Keccak-PRNG is a XOF that is build from a counter-mode PRNG based on Keccak256. Generating new chunks of bytes requires an incrementing counter.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create&lt;&#x2F;span&gt;&lt;span&gt; an&lt;&#x2F;span&gt;&lt;span&gt; empty&lt;&#x2F;span&gt;&lt;span&gt; buffer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    buffer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_flip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;buffer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; fixed 32-byte state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; KeccakPRNG_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Precompile of &lt;code&gt;Keccak256&lt;&#x2F;code&gt; are available in the Ethereum Virtual Machine, making this XOF very efficient in the EVM.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Using one of the XOFs above (SHAKE256 or Keccak-PRNG), it is possible to instantiate two (precompiles) algorithms for hashing into points:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Compute the Hash To Point Falcon Challenge.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes32): The original message (hash).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): containing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - r (40 bytes): The salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - s (626 bytes): The compressed signature vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        c: The Hash To Point polynomial challenge as a vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12289&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 1: Parse Input Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s2_compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract salt and compressed signature vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 2: Verify Well-formedness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_signature_format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 3: Compute the challenge vector HashToPoint(r || message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SHAKE256_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SHAKE256_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; SHAKE256_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 61445&lt;&#x2F;span&gt;&lt;span&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            c_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt; mod&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Compute the Hash To Point Falcon Challenge using Keccak-PRNG.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        message (bytes32): The original message (hash).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        signature (666 bytes): containing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - r (40 bytes): The salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - s (626 bytes): The compressed signature vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        c: The Hash To Point polynomial challenge as a vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12289&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 1: Parse Input Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s2_compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract salt and compressed signature vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 2: Verify Well-formedness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_signature_format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 3: Compute the challenge vector HashToPoint(r || message)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    KeccakPRNG_init&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    KeccakPRNG_inject&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span&gt; do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; KeccakPRNG_extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 61445&lt;&#x2F;span&gt;&lt;span&gt; then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            c_i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt; mod&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;encoding-of-the-challenge-polynomial-c-896-bytes-normative&quot;&gt;Encoding of the challenge polynomial &lt;code&gt;c&lt;&#x2F;code&gt; (896 bytes, normative)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Domain: degree-512 polynomial with coefficients in &lt;code&gt;[0, q)&lt;&#x2F;code&gt;, &lt;code&gt;q = 12289&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Order: coefficients are serialized in index order &lt;code&gt;c[0], c[1], …, c[511]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Bit-packing: each coefficient is a 14-bit &lt;strong&gt;big-endian&lt;&#x2F;strong&gt; unsigned integer. Concatenate all 512 encodings into a bitstring of exactly &lt;strong&gt;896 bytes&lt;&#x2F;strong&gt;. Consumers MUST reject encodings that are not exactly 896 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;core-algorithm&quot;&gt;Core algorithm&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Parse Input Data:&lt;&#x2F;strong&gt; Check the byte sizes and then extract the public key, the Hash To Point Challenge and the signature.
&lt;ul&gt;
&lt;li&gt;The parsed public key  $h$, interpreted as a vector of elements mod $q$,&lt;&#x2F;li&gt;
&lt;li&gt;The parsed signature  $(r, s_2)$. $r$ is denoted as the salt and $s_2$ is denoted as the signature vector, made of elements mod $q$.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Verify Well-formedness:&lt;&#x2F;strong&gt; Verify that the signature, Hash To Point Challenge and public key have the correct number of elements and is canonical.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- See the `Required Checks in Verification` section for more details. --&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compute $s_1$ from $s_2$ and $h$.&lt;&#x2F;strong&gt; $s_1 = c - h * s_2$ where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$c$ is the Hash To Point challenge,&lt;&#x2F;li&gt;
&lt;li&gt;$h$ is the public key, represented in the ntt domain&lt;&#x2F;li&gt;
&lt;li&gt;$s_2$ is the signature vector.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: since $h$ and $s_2$ are polynomials, the operation $*$ is the polynomial multiplication and can be sped up using the Number Theoretic Transform (NTT).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Check $L^2$ norm Bound:&lt;&#x2F;strong&gt; Verify that the signature is &lt;em&gt;short&lt;&#x2F;em&gt; by checking the following equation:
$$ ||(s_1, s_2) ||_2^2 &amp;lt; \lfloor\beta^2\rfloor$$
where $\beta^2$ is the acceptance bound. For Falcon-512, it is $\lfloor\beta^2\rfloor = 34034726$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The following code illustrates Falcon core algorithm:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FALCON_CORE&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; challenge&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify Falcon Core Algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - signature (666 bytes): containing:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - r (40 bytes): The salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;            - s (626 bytes): The compressed signature vector.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - h (bytes): The Falcon public key in the ntt domain, computed as h=ntt(pubkey) externally.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - challenge (bytes): The Falcon Hash To Point Challenge.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        bool: True if the signature is valid, False otherwise.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Constants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12289&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ACCEPTANCE_BOUND&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 34034726&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon-512 acceptance bound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 1: Parse Input Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s2_compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extract salt and compressed signature vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 2: Verify Well-formedness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_signature_format&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 3: Decompress Signature Vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decompress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_compressed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert compressed signature to full form&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; s2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reject invalid encodings &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 4: Convert to Evaluation domain (NTT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s2_ntt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ntt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 5: Compute the Verification Equation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tmp_ntt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hadamard_product&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_ntt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Element-wise product&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tmp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tmp_ntt&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert back to coefficient form (INTT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; challenge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tmp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 6: Normalize s1 coefficients to be in the range [-q&#x2F;2, q&#x2F;2]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; normalize_coefficients&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 7: Compute Norm Bound Check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s1_squared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; square_each_element&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s2_squared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; square_each_element&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_norm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s1_squared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s2_squared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Step 8: Compare with Acceptance Bound&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; To ensure signature is short&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; total_norm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCEPTANCE_BOUND&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon-512: β² = 34,034,726&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;required-checks-in-falcon-verification&quot;&gt;Required Checks in Falcon Verification&lt;&#x2F;h3&gt;
&lt;p&gt;The following requirements MUST be checked by the precompiled contract to verify signature components are valid:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Raw Input data&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that the message is 32-bytes long,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the public key is 896-bytes long,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the signature is 666-bytes long.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Parsed Input data&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that the public key consists of 512 elements, where each element is between $[0, q-1]$,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the signature vector in the signature consists of 512 elements, where each element is between $[0, q-1]$,&lt;&#x2F;li&gt;
&lt;li&gt;Verify that the salt in the signature is 40-bytes long.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Gas burning on error&lt;&#x2F;strong&gt;
if one of the above condition is not met then all the gas supplied along with a CALL or STATICCALL is burned.
it shall also be burned if an error happens during decompression (incorrect encodings).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompiled-contract-specification&quot;&gt;Precompiled Contract Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The precompiled contracts are proposed with the following input and outputs, which are big-endian values:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;falcon-hash-to-point-shake256&quot;&gt;&lt;code&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;32 bytes: message hash &lt;code&gt;m&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;666 bytes: salt &lt;code&gt;r&lt;&#x2F;code&gt; (40 bytes), Falcon-512 compressed signature &lt;code&gt;s2_compressed&lt;&#x2F;code&gt; (626 bytes) concatenated: &lt;code&gt;r || s2_compressed&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Output&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;896 bytes: packed challenge polynomial &lt;code&gt;c&lt;&#x2F;code&gt; (see §3.1 encoding)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;falcon-hash-to-point-keccakprng&quot;&gt;&lt;code&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Same I&#x2F;O as §4.1, but the XOF is Keccak-PRNG. The construction is normative and MUST define: state initialization, domain-separation (if any), counter width and endianness, and block concatenation order.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;falcon-core&quot;&gt;&lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input data&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;666 bytes for Falcon-512 signature&lt;&#x2F;li&gt;
&lt;li&gt;896 bytes for Falcon-512 public key&lt;&#x2F;li&gt;
&lt;li&gt;896 bytes for the Hash To Point Challenge&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output data&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the core algorithm process succeeds, it returns 1 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;li&gt;If the core algorithm process fails, it does not return any output data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;error-cases&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Invalid input length (not compliant to described input)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ q)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid signature decompression&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that a well-formed but invalid signature does not produce an error, but &lt;code&gt;FALCON_CORE&lt;&#x2F;code&gt; invalidates the signature (and it does not return any output data).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;precompiled-contract-gas-usage&quot;&gt;Precompiled Contract Gas Usage&lt;&#x2F;h4&gt;
&lt;p&gt;The cost of the &lt;strong&gt;FALCON_HASH_TO_POINT_SHAKE256&lt;&#x2F;strong&gt; and &lt;strong&gt;FALCON_HASH_TO_POINT_KECCAKPRNG&lt;&#x2F;strong&gt; is set to 1000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of &lt;strong&gt;FALCON_CORE&lt;&#x2F;strong&gt; is set to 2000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the total cost of the signature is 3000 gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Falcon signature scheme was selected as a NIST-standardized post-quantum cryptographic algorithm due to its strong security guarantees and efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon is a signature algorithm build from lattice-based cryptography. Specifically, its hardness relies on the Short Integer Solution (SIS) problem over NTRU lattices, which is believed to be hard for both classical and quantum computers.&lt;&#x2F;p&gt;
&lt;p&gt;Falcon offers several advantages over traditional cryptographic signatures such as secp256k1 and secp256r1:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Efficiency&lt;&#x2F;strong&gt;: Falcon is highly optimized for constrained environments, offering small signature sizes (666 bytes for Falcon-512) and fast verification time. This makes it well-suited for Ethereum, where gas costs and computational efficiency are critical factors.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;NIST Standardization&lt;&#x2F;strong&gt;: Falcon was selected as part of NIST Post-Quantum Cryptography Standardization process, ensuring that it meets rigorous security and performance criteria.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enabling Future-Proof Smart Contracts&lt;&#x2F;strong&gt;: With the integration of Falcon, Ethereum roll-ups and smart contract applications can start adopting quantum-secure schemes that remain secure even when we have quantum computers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Compatibility with Existing EVM Designs&lt;&#x2F;strong&gt;: While Falcon operates on fundamentally different cryptographic assumptions than elliptic curves, its verification process can be efficiently implemented as a precompiled contract with similar APIs to classical signature schemes like secp256r1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given the increasing urgency of transitioning to quantum-resistant cryptographic primitives or even having them ready in the event that research into quantum computers speeds up.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-explanations&quot;&gt;Gas cost explanations&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of the &lt;strong&gt;HASH_TO_POINT&lt;&#x2F;strong&gt; and &lt;strong&gt;HASH_TO_POINT_ETH&lt;&#x2F;strong&gt; functions is dominated by the call to the underlying hash function. It represents in average 35 calls to the hash function. Taking linearly the cost of keccak256, and avoiding the context switching it represents 1000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of &lt;strong&gt;FALCON_CORE&lt;&#x2F;strong&gt; function is dominated by performing 2 NTTs and 1 inverse NTT. One of these NTTs is for the public key and can be precomputed so that the contract requires to perform only 1 NTT and 1 inverse NTT. An estimation of the cost is given by 2000 gas.&lt;&#x2F;p&gt;
&lt;p&gt;The cost is interpolated using rule of thumb from SUPERCOPS signatures benchmark results.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;In compliance with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;,  the necessary parameters and structure for its integration are provided. &lt;code&gt;ALG_TYPE = 0xFA&lt;&#x2F;code&gt;  uniquely identifies Falcon-512 transactions, set MAX_SIZE = 667 bytes to accommodate the fixed-length signature_info container (comprising a 1-byte version tag and a 666-byte Falcon signature), and recommend a &lt;code&gt;GAS_PENALTY&lt;&#x2F;code&gt; of approximately &lt;code&gt;3000&lt;&#x2F;code&gt; gas subject to benchmarking. The verification function follows the EIP-7932 model, parsing the signature_info, recovering the corresponding Falcon public key, verifying the signature against the transaction payload hash, and deriving the signer&#x27;s Ethereum address as the last 20 bytes of keccak256(pubkey). This definition ensures that Falcon-512 can be cleanly adopted within the &lt;code&gt;AlgorithmicTransaction&lt;&#x2F;code&gt; container specified by EIP-7932.&lt;&#x2F;p&gt;
&lt;p&gt;As per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;, this EIP defines two Falcon algorithm types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ALG_TYPE = 0xFA&lt;&#x2F;code&gt; — Falcon-512 with SHAKE256 H2P&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ALG_TYPE = 0xFB&lt;&#x2F;code&gt; — Falcon-512 with Keccak-PRNG H2P&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Container and sizes.&lt;&#x2F;strong&gt; The &lt;code&gt;signature_info&lt;&#x2F;code&gt; container omits any pubkey hash; the public key is recovered by &lt;code&gt;verify(...)&lt;&#x2F;code&gt; and the 7932 sig-recover precompile derives the address as &lt;code&gt;keccak(ALG_TYPE || pubkey)[12:]&lt;&#x2F;code&gt;. Therefore:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAX_SIZE = 667&lt;&#x2F;code&gt; bytes (1-byte &lt;code&gt;ALG_TYPE&lt;&#x2F;code&gt; + 666-byte Falcon compressed signature).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xFA Falcon-512 (SHAKE H2P), 0xFB Falcon-512 (Keccak H2P)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Falcon-512 signature (compressed). If an implementation produces a shorter form, it MUST be left-padded to 666 bytes.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;666&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the format of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For the NIST-compliant version:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 699&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;667&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; falcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For the EVM-friendly version:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 699&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;667&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; ethfalcon512_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;addresses&quot;&gt;Addresses&lt;&#x2F;h3&gt;
&lt;!-- TODO: backward compatibility --&gt;
&lt;p&gt;&lt;strong&gt;TBD by ACD.&lt;&#x2F;strong&gt; Final precompile addresses will be selected within the EIP-managed range of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;, explicitly &lt;strong&gt;avoiding &lt;code&gt;0x0100–0x01FF&lt;&#x2F;code&gt; reserved for RIPs&lt;&#x2F;strong&gt; by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7587&#x2F;&quot;&gt;EIP-7587&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A set of test vectors for verifying implementations is located in a separate file (to be provided for each opcode). For the NIST compliant version, KATs are reproduced for HashToPoint (with a provided salt &lt;code&gt;r&lt;&#x2F;code&gt;) as well as for the compressed signature vector s2 (with a provided &lt;code&gt;HashToPoint&lt;&#x2F;code&gt; input). Note that &lt;code&gt;s2&lt;&#x2F;code&gt; is not padded with zeroes, leading to a maximum size of 626 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An implementation is provided by the NIST. An implementation of the EVM-friendly version ETHFALCON is provided by ZKNOX.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: We can modify geth to include falcon-512 as a reference. (Similar to secp256r1 signature verification)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The derivation path to obtain the private key from the seed is (tbd). Hash-to-Point functions MUST follow the specified XOFs byte-for-byte; domain separation and padding are normative.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Milli-gas for High-precision Gas Metering</title>
        <published>2025-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8053/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8053-milli-gas-counter-for-high-precision-gas-metering/25946" />
        

        <id>https://wg-eips.ritovision.com/8053/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8053"
            label="EIP-8053" />
        

        
        

        
        <summary type="html">Adds `milli-gas` as the EVM’s internal gas accounting unit, reducing rounding errors without impacting UX</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8053/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the &lt;code&gt;milli-gas&lt;&#x2F;code&gt; counter as the EVM&#x27;s internal gas accounting. Gas costs are defined in &lt;code&gt;milli_gas&lt;&#x2F;code&gt; and internal EVM gas accounting is entirely carried out in &lt;code&gt;milli_gas&lt;&#x2F;code&gt;. At the end of transaction execution, &lt;code&gt;milli_gas&lt;&#x2F;code&gt; is rounded up to &lt;code&gt;gas&lt;&#x2F;code&gt;. Gas limits and transaction fees are still computed and verified using the current &lt;code&gt;gas_used&lt;&#x2F;code&gt; counter. This new counter enables a more precise accounting of cheap compute without impacting UX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, most EVM compute operations (&lt;code&gt;ADD&lt;&#x2F;code&gt;, &lt;code&gt;SUB&lt;&#x2F;code&gt;, &lt;code&gt;MUL&lt;&#x2F;code&gt;, etc.) are significantly underpriced when compared with state operations (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, etc.). There are two factors contributing to this mismatch. On one hand, client optimizations and hardware improvements have made pure compute operations more efficient. On the other hand, with the growing size of the Ethereum state, the performance of I&#x2F;O operations touching this larger state has been deteriorating. Both of these trends are expected to continue, further worsening this mismatch.&lt;&#x2F;p&gt;
&lt;p&gt;There are a couple of proposals to reduce the cost of compute operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;&quot;&gt;EIP-7904&lt;&#x2F;a&gt;) and increase the cost of state operations (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt;, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;). However, given the current level of mismatch between these operations, there is an inherent trade-off in the anchor we use to reprice these operations.&lt;&#x2F;p&gt;
&lt;p&gt;If we make compute operations cheaper, we will introduce rounding errors, with most compute operations costing 1, when they should cost a fraction of that. These rounding errors impact scalability because we can now fit fewer of these cheaper operations in any given block. However, if we price all operations so that the fastest opcode is assigned 1 gas, we would need to make all other operations significantly more expensive, including both compute and state operations. Making everything more expensive would require a rebase on the concept of gas units to users, thus impacting UX.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate this point, let&#x27;s focus on the pure compute operations. As compute operations impact only block execution time, the chosen anchor will induce a specific million gas per second rate on all compute opcodes. For instance, if we anchor on &lt;code&gt;EcRecover&lt;&#x2F;code&gt; at the current price (3000 gas units), this induces a rate of 175Mgas&#x2F;s, based on the execution time estimated for this opcode on &lt;a href=&quot;..&#x2F;07904&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;EIP-7904&#x27;s empirical analysis&lt;&#x2F;a&gt;. The following plot shows the average rounding errors of compute operations for different anchors, using the same execution time estimates from EIP-7904.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8053&#x2F;.&#x2F;assets&#x2F;round_error_by_anchor.png&quot; alt=&quot;round_error_by_anchor&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As we can see, with an anchor of 50Mgas&#x2F;s (which would result in a gas limit of 100Mgas, assuming a 2-second block execution limit), we would get an average rounding error of 59.3%. This means that we could be 59.3% cheaper on average per opcode if we didn&#x27;t have to round to integer gas units. Only after a 400Mgas&#x2F;s anchor do we get to reasonably low rounding errors. However, this level of Mgas&#x2F;s would require a major rebase of the gas model, where all opcodes become significantly more expensive, and both the transaction-level and block-level gas limits increase by a factor of 100.&lt;&#x2F;p&gt;
&lt;p&gt;The way around this trade-off is to allow cheap opcodes to have fractional gas costs, thus avoiding both the scalability limits introduced by rounding errors and the significant UX change of increasing gas costs and limits 100x.&lt;&#x2F;p&gt;
&lt;p&gt;A similar argument was made in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;&quot;&gt;EIP-2045&lt;&#x2F;a&gt;, which served as inspiration to this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a new &lt;code&gt;Uint&lt;&#x2F;code&gt; counter to the EVM, &lt;code&gt;milli_gas_left&lt;&#x2F;code&gt;. Gas costs are defined in &lt;code&gt;milli_gas&lt;&#x2F;code&gt; and internal EVM gas accounting is entirely carried out in &lt;code&gt;milli_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction fees, transaction gas limits, and block gas limits are still computed and verified using the current &lt;code&gt;gas_used&lt;&#x2F;code&gt; counter. There are no changes to blob gas accounting, refunds, or call data gas accounting.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm-environment&quot;&gt;EVM environment&lt;&#x2F;h3&gt;
&lt;p&gt;The current &lt;code&gt;gas_left&lt;&#x2F;code&gt; variable from the internal state of the EVM is replaced by &lt;code&gt;milli_gas_left&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;The internal state of the virtual machine.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pc&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stack&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;U256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    memory&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    milli_gas_left&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    valid_jump_destinations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    refund_counter&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    running&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accounts_to_delete&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;EthereumException&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All references to &lt;code&gt;evm.gas_left&lt;&#x2F;code&gt; are replaced by &lt;code&gt;evm.milli_gas_left&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;end-of-transaction-conversion&quot;&gt;End-of-transaction conversion&lt;&#x2F;h3&gt;
&lt;p&gt;At the end of each transaction execution, the gas left in the transaction output is updated to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ceil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;milli_gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the same time, after the transaction is executed, &lt;code&gt;evm.milli_gas_used&lt;&#x2F;code&gt; is rounded up to &lt;code&gt;evm.gas_used = ceil(evm.milli_gas_used &#x2F; 1000)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-costs&quot;&gt;Opcode costs&lt;&#x2F;h3&gt;
&lt;p&gt;Opcode gas parameters as defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;abd7612d2f4d6fcd9f628330f38884b300f0d89f&#x2F;src&#x2F;ethereum&#x2F;forks&#x2F;osaka&#x2F;vm&#x2F;gas.py&quot;&gt;Ethereum Execution Client Specifications&lt;&#x2F;a&gt; that are not updated at the same time or after the introduction of this proposal, are increased by 1000x:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;GAS_PARAM = GAS_PARAM * 1000&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-opcode&quot;&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;GAS&lt;&#x2F;code&gt; opcode reports the available gas in &lt;code&gt;milli-gas&lt;&#x2F;code&gt; units.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;call-opcodes&quot;&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes receive the amount of gas to send to the sub context to execute in &lt;code&gt;gas&lt;&#x2F;code&gt;. &lt;code&gt;gas&lt;&#x2F;code&gt; is converted to &lt;code&gt;milli-gas&lt;&#x2F;code&gt; at the start of the call&#x27;s execution:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; STACK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-counter-vs-new-variable-type&quot;&gt;New counter vs. new variable type&lt;&#x2F;h3&gt;
&lt;p&gt;A possible approach to allow for fractional gas would be to change the variable type of all gas-related variables from an integer to a float or a base fractional. Although simple in concept, the implementation of such a change in the EVM is not trivial. In addition, introducing fractional variables would make moving to a zkEVM significantly more complex.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, introducing a new counter is the option that least disrupts the current EVM implementation, while allowing for expressive gas costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rounding-at-transaction-level&quot;&gt;Rounding at transaction-level&lt;&#x2F;h3&gt;
&lt;p&gt;With the introduction of a new counter, there are two levels at which we could convert &lt;code&gt;milli_gas&lt;&#x2F;code&gt; to &lt;code&gt;gas&lt;&#x2F;code&gt;: at the transaction level or the block level. Conversion at the block level results in the fewest rounding errors in block utilization. However, it requires a bigger change to implement, as &lt;code&gt;milli_gas&lt;&#x2F;code&gt; will need to be used when computing transaction fees and limits, and &lt;code&gt;milli_gas&lt;&#x2F;code&gt; will need to be incorporated in the block environment.&lt;&#x2F;p&gt;
&lt;p&gt;The question is whether a conversion at the transaction level is sufficient to reduce rounding errors. To estimate this, we extracted the opcode counts per transaction for 1000 mainnet blocks and computed the new gas prices of all compute operations assuming an anchor of 50Mgas&#x2F;s and the estimated execution times from &lt;a href=&quot;..&#x2F;07904&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;EIP-7904&#x27;s empirical analysis&lt;&#x2F;a&gt;. With this repricing, the fastest opcode (&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;) would be priced at 90 milli-gas units (i.e., 0.09 gas units). We also assumed that the non-compute operations and precompiles would have the same price, and we excluded any other transaction costs, such as intrinsic costs and calldata.&lt;&#x2F;p&gt;
&lt;p&gt;Then, we computed the rounding error of each transaction, assuming a conversion at both the transaction and opcode levels. The opcode-level conversion is equivalent to not using fractional gas and rounding all opcodes to an integer. The following plot shows the distribution for both errors. The x-axis is on a logarithmic scale.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8053&#x2F;.&#x2F;assets&#x2F;round_err_tx.png&quot; alt=&quot;round_error_by_anchor&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In this sample of 1000 blocks, a transaction-level conversion has already successfully reduced the rounding errors from an average of 4% to 0.05% per transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Deployed bytecode that compares &lt;code&gt;gas_left&lt;&#x2F;code&gt; to constants or that uses explicit gas-limited calls will suddenly forward 1000× less gas, causing unexpected reverts or logic flip. Further analysis on how widespread this behavior is required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase exit and consolidation churn</title>
        <published>2025-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8061/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8061-increase-churn-limits/25991" />
        

        <id>https://wg-eips.ritovision.com/8061/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8061"
            label="EIP-8061" />
        

        
        

        
        <summary type="html">Increase the exit and consolidation churn and create a separate consolidation churn limit parameter.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8061/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP roughly doubles the consolidation churn, as well as quadrupling the exit churn and restoring its proportionality to total stake (though maintaining the existing cap on activations). The choice of parameters balances maintaining a sufficiently long weak subjectivity period (~7 days, roughly halving the current period) with achieving two goals: allowing for faster consolidation of the validator set, in turn accelerating the timeline to faster finality, and relieving exit queue congestion, improving staking liquidity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt; introduced an activation cap of 8 validators per epoch (now 256 ETH per epoch) to prevent overly rapid validator set growth. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;&quot;&gt;EIP-7251&lt;&#x2F;a&gt; extended this cap to exits, to make room for the newly introduced consolidation operations, without increasing the weak subjectivity period. However, the fixed cap prevents the exit churn limit from being proportional to total stake, which, all else being equal, leads to longer queues as stake grows. Moreover, the
&lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; is set quite conservatively in the first place, requiring more than 3 months for 1&#x2F;3 of the validator set to exit, a time which is now be more than doubled due to the cap. Recent episodes have stressed for more headroom to improve liquidity and staking user experience, as the exit queue has stretched beyond forty days as a consequence of the mass exit of Kiln validators. Long queues degrade user experience, and slow operator response to market or operational events. They also reduce the network’s ability to reconfigure stake more quickly after adverse events, for example to regain finality by having a large amount of stake exit (a double-edged sword, as preventing double finality is the reason these queues exist in the first place, as discussed in the security section). Finally, centralized forms of staking are those that (in relative terms) benefit the most from a lack of liquidity today, as they have the ability to issue a liquid staking token, maintain liquidity reserves or more generally build products that get around the limitations of the protocol.&lt;&#x2F;p&gt;
&lt;p&gt;The conservative setting of the &lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; affects consolidations as well. Increasing the consolidation churn limit can shorten the path to a smaller validator set and, in turn, the path to a protocol with much faster finality. Under today’s parameters, even the best-case timelines are long: using only activations and exits, fully saturated around the clock, shrinking the roughly 32M ETH of 0x01 stake would take on the order of ~1.5 years; a fully saturated consolidation queue would still take ~1.3 years. Moreover, deposit capacity is also needed for new stake and is thus far from guaranteed to be available for consolidations, as evidenced by the recent inflow of &amp;gt; 1M ETH, fully occupying the queue for ~20 days.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP proposes to address these issues by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;removing the cap on exits, restoring the proportionality of exit churn limit to total stake&lt;&#x2F;li&gt;
&lt;li&gt;increasing the churn limit on exits&lt;&#x2F;li&gt;
&lt;li&gt;introducing a separate consolidation churn limit, since there is no more &quot;excess churn&quot; from having an exit cap, and increase it compared to the current (implicitly defined) one. This also lets us more independently adjust it in the future, for example to increase it if we want to allow for faster consolidation of the validator set or decrease it when this process has already run its course.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The EIP does &lt;em&gt;not&lt;&#x2F;em&gt; propose to lift the cap on the deposit churn, as part of the motivation for introducing it in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt; still holds today: though &lt;em&gt;active validator set&lt;&#x2F;em&gt; growth is mostly solved by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;&quot;&gt;EIP-7251&lt;&#x2F;a&gt;, the &lt;em&gt;validator array in the BeaconState&lt;&#x2F;em&gt; (including inactive validators) is very large and still growing, and too rapid &lt;em&gt;stake&lt;&#x2F;em&gt; growth continues to be a concern as well.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; is halved, from &lt;code&gt;2**16&lt;&#x2F;code&gt; to &lt;code&gt;2**15&lt;&#x2F;code&gt;, and fully dedicated to activations and exits. However, the cap on activations introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt; is maintained via &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;, while exits are freed from this cap. Consolidations now have their own dedicated churn, determined by &lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;. This is set here to &lt;code&gt;2**16&lt;&#x2F;code&gt;, so that consolidations are allocated half as much churn as activations and exits combined, and a third of the total churn. Finally, &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt; is adjusted to account for the asymmetry between exit and activation churn: a unit of exit churn has twice the weak subjectivity effect ($\frac{4}{3}$) of a unit of activation churn $\frac{2}{3}$, and a unit of consolidation churn has an effect equivalent to the sum of the other two ($2$).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt; replaces the existing &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT&lt;&#x2F;code&gt;, also &lt;code&gt;256&lt;&#x2F;code&gt;, as the cap now only applies to activations. We introduce the new &lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt; and update the &lt;code&gt;CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CHURN_LIMIT_QUOTIENT_GLOAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**15)&lt;&#x2F;code&gt; (= 32,768)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**16)&lt;&#x2F;code&gt; (= 65,536)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**8)&lt;&#x2F;code&gt;  (=256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;churn-computations&quot;&gt;Churn computations&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the intended asymmetry in activation and exit churn, we replace &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; with &lt;code&gt;get_activation_churn_limit&lt;&#x2F;code&gt;, capped at  &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;, and &lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt;, uncapped. &lt;code&gt;get_consolidation_churn_limit&lt;&#x2F;code&gt; uses the new &lt;code&gt;CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;code&gt;, without either a minimum or a maximum value.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_activation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Per-epoch churn limit for activations, rounded to EFFECTIVE_BALANCE_INCREMENT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHURN_LIMIT_QUOTIENT_GLOAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Per-epoch churn limit for activations, rounded to EFFECTIVE_BALANCE_INCREMENT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_PER_EPOCH_CHURN_LIMIT_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHURN_LIMIT_QUOTIENT_GLOAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_consolidation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Per-epoch churn limit for consolidations (EIP-7521), rounded to EFFECTIVE_BALANCE_INCREMENT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_CHURN_LIMIT_QUOTIENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EFFECTIVE_BALANCE_INCREMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt; we only replace &lt;code&gt;delta = get_balance_churn_limit(state)&lt;&#x2F;code&gt; with an explicit calculation taking into account the different weak subjectivity effect of each type of operation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_weak_subjectivity_period&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns the weak subjectivity period for the current ``state``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    This computation takes into account the effect of validator set churn, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    bounded by the three churn_limit functions used below.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_total_active_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effect of exit churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; get_activation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effect of activation churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; get_consolidation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effect of consolidation churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    epochs_for_validator_set_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SAFETY_DECAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_VALIDATOR_WITHDRAWABILITY_DELAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; epochs_for_validator_set_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deposit-processing&quot;&gt;Deposit processing&lt;&#x2F;h3&gt;
&lt;p&gt;The only modification is replacing &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; with &lt;code&gt;get_activation_churn_limit&lt;&#x2F;code&gt;, maintaing the current cap on deposit churn respects, while removing the cap from exits. This reverts to the pre-Electra status quo, when activations were capped but exits were not.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP-8061]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    available_for_processing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; get_activation_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    processed_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposits_to_postpone&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_start_slot_at_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not process deposit requests if Eth1 bridge deposits are not yet applied.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Is deposit request&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENESIS_SLOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There are pending Eth1 bridge deposits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;eth1_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_requests_start_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if deposit has been finalized, otherwise, stop processing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if number of processed deposits has not reached the limit, otherwise, stop processing.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; next_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PENDING_DEPOSITS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Read validator state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is_validator_exited&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is_validator_withdrawn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_validator_exited&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FAR_FUTURE_EPOCH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_validator_withdrawn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawable_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; next_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_validator_withdrawn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deposited balance will never become active. Increase balance but do not consume churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            apply_pending_deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; is_validator_exited&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validator is exiting, postpone the deposit until after withdrawable epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            deposits_to_postpone&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if deposit fits in the churn, otherwise, do no more deposit processing in this epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; processed_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; available_for_processing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume churn and apply deposit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            processed_amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            apply_pending_deposit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; deposit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Regardless of how the deposit was handled, we move on in the queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        next_deposit_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_deposits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;next_deposit_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; deposits_to_postpone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accumulate churn only if the churn limit has been hit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_churn_limit_reached&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; available_for_processing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; processed_amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;exit-processing&quot;&gt;Exit processing&lt;&#x2F;h3&gt;
&lt;p&gt;We replace &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; with &lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_exit_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; exit_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP-8061]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New epoch for exits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exit doesn&amp;#39;t fit in the current earliest epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the balance and update state variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Independent parameters:&lt;&#x2F;strong&gt; a separate churn consolidation is easy to independently tune, in particular adjusted upward if we want to speed up the consolidation process further, and later downward, when the primary wave of validator set consolidation has already happened and the consolidation operation becomes less crucial.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Scaling with stake&lt;&#x2F;strong&gt;: the exit churn regains proportionality to the total stake, and the consolidation churn maintains it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Preserving the activation cap&lt;&#x2F;strong&gt;: the activation churn limit maintains the cap from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7514&#x2F;&quot;&gt;EIP-7514&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Balancing security and functionality&lt;&#x2F;strong&gt;: the exit churn limit is increased by ~4x compared to the current cap, and exactly 2x compared to previous uncapped version, while the consolidation churn limit is increased by ~2x. Activations remain capped at the existing limit. As we see later in more detail, accounting for the asymmetric impact of exits and activations on safety degradation, this results in a decrease of the weak subjectivity period from ~15.7 days to ~7 days (see detailed calculations below), or ~6 days if we were to later remove the activation cap, in either case still on the order of a week. Moreover, were consolidations to be removed later, the weak subjectivity period would go up to ~11 days, or ~8.4 days without the activation cap.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change to the consensus rules and MUST be activated as part of a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;weak-subjectivity-period&quot;&gt;Weak subjectivity period&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;code&gt;MIN_VALIDATOR_WITHDRAWABILITY_DELAY = 256&lt;&#x2F;code&gt; epochs, and let $S$ denote the total stake, $E$ the exit churn per epoch, $A$ the activation churn per epoch, and $C$ the consolidation churn per epoch. Each unit of exit churn contributes to a safety degradation (measured in ETH, as the churn) of $\frac{4}{3}$, whereas the safety degradation from activations is only $\frac{2}{3}$ per unit. Finally, it is $2$ per unit for consolidations, as a consolidation is the equivalent of an exit and an activation.&lt;&#x2F;p&gt;
&lt;p&gt;The formula to compute the weak subjectivity period (in epochs) for a 10% safety decay target (exactly corresponding to &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt;) then is:&lt;&#x2F;p&gt;
&lt;p&gt;$\text{WS}_{\text{epochs}} = 256 +
\frac{0.1 \cdot S}{\frac{4}{3} \cdot E + \frac{2}{3} \cdot A + 2 \cdot C}$&lt;&#x2F;p&gt;
&lt;p&gt;The churn limits of the current protocol, assuming a total stake $S = 36M$ ETH (approximately the stake at the time of writing) are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$A = E = \min(256, S&#x2F;2^{16}) = 256$ ETH (capped)&lt;&#x2F;li&gt;
&lt;li&gt;$C = S&#x2F;2^{16} - A \approx 293$ ETH&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The weak subjectivity period is then:&lt;&#x2F;p&gt;
&lt;p&gt;$\text{WS}_{\text{epochs}} \approx 3533$&lt;&#x2F;p&gt;
&lt;p&gt;$\Rightarrow\ \textbf{WS} \approx \mathbf{15.7\ \text{days}}$&lt;&#x2F;p&gt;
&lt;p&gt;In days, it is $\text{WS}_{\text{epochs}} &#x2F; 225$.&lt;&#x2F;p&gt;
&lt;p&gt;Under this EIP, and assuming a total stake $S = 36M$ ETH:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;$E = S&#x2F;2^{15} \approx 1098$ ETH&lt;&#x2F;li&gt;
&lt;li&gt;$A = \min(256, S&#x2F;2^{15}) = 256$ ETH (capped)&lt;&#x2F;li&gt;
&lt;li&gt;$C = S&#x2F;2^{16} \approx 549$ ETH&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The weak subjectivity period is then:&lt;&#x2F;p&gt;
&lt;p&gt;$\text{WS}_{\text{epochs}} \approx 1573$&lt;&#x2F;p&gt;
&lt;p&gt;$\Rightarrow\ \textbf{WS} \approx \mathbf{7.0\ \text{days}}$&lt;&#x2F;p&gt;
&lt;p&gt;Other possible future scenarios are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Activation cap removed: $\textbf{WS} \approx \mathbf{6.0\ \text{days}}$ ($\text{WS}_{\text{epochs}} \approx 1348$)&lt;&#x2F;li&gt;
&lt;li&gt;Consolidations disabled: $\textbf{WS} \approx \mathbf{10.9\ \text{days}}$ ($\text{WS}_{\text{epochs}} \approx 2457$)&lt;&#x2F;li&gt;
&lt;li&gt;Consolidations disabled and activation cap removed: $\textbf{WS} \approx \mathbf{8.4\ \text{days}}$ ($\text{WS}_{\text{epochs}} \approx 1894$)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that removing the activation cap only reduces the weak subjectivity period by one day, and leaves it on the order of a week. The current parameters might then also be considered acceptable in a future where it is decided to remove the activation cap.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Exclude slashed validators from proposing</title>
        <published>2025-10-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Barnabas Busa</name><uri>https://github.com/barnabasbusa</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8045-exclude-slashed-validators-from-proposing/25850" />
        

        <id>https://wg-eips.ritovision.com/8045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8045"
            label="EIP-8045" />
        

        
        

        
        <summary type="html">Modify proposer selection to exclude slashed validators, improving network resilience and performance after mass slashings</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8045/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a modification to the beacon chain proposer selection process to exclude slashed validators from being selected as proposers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, slashed validators can still be selected as proposers, though their blocks are considered invalid by the state transition function, resulting in missed slots. This is in particular problematic after a mass slashing event, at which point there can be a long period with degraded chain performance, until all slashed validators are exited. If mass slashing also comes with general network disruption, the missed slots can also significantly complicate the recovery process. This change filters out slashed validators during proposer selection, reducing disruption and increasing resilience in such scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;get_beacon_proposer_indices&lt;&#x2F;code&gt; function in the consensus specifications is modified to exclude slashed validators from the proposer selection process, effectively going from considering all
active validators to all active and unslashed validators.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_beacon_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the proposer indices for the given ``epoch``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modified to exclude slashed validators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    indices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_active_validator_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slashed&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_seed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_BEACON_PROPOSER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; compute_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-exclude-slashed-validators&quot;&gt;Why exclude slashed validators?&lt;&#x2F;h3&gt;
&lt;p&gt;Slashed validators are already prevented from successfully proposing blocks through the state transition validation. The &lt;code&gt;process_block&lt;&#x2F;code&gt; function checks that the proposer is not slashed, and blocks from slashed proposers are considered invalid. Therefore, selecting slashed validators as proposers serves no purpose and only results in missed slots.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;design-decision-upfront-filtering&quot;&gt;Design decision: upfront filtering&lt;&#x2F;h3&gt;
&lt;p&gt;The chosen approach is to simply filter out slashed validators from the candidate pool, before doing any shuffling computation. An alternative design would be to still use the whole active validator set as the candidate pool, and then only filter out slashed validators once their index has been selected by the shuffle. The exact selection is not identical, but it achieves the same goal, i.e., a balance-weighted selection from the set of active-and-unslashed validators. The complexity is low in either design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change to the consensus rules and MUST be activated as part of a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases should verify that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Slashed validators are not selected as proposers&lt;&#x2F;li&gt;
&lt;li&gt;A complete &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; is generated even in the presence of slashed validators&lt;&#x2F;li&gt;
&lt;li&gt;Slashings do not affect the existing &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Slashed validators are already prevented from successfully proposing blocks through the state transition validation, for good reason, as they are considered to be unreliable participants (malicious or faulty). However, they have historically still been eligible to be selected as proposers in order to ensure stability of the proposer selection mechanism, because excluding them would have severely impacted the stability of the proposer selection mechanism. In fact, any slashing processed on chain would have caused the sequence of future proposers to completely change, even within the lookahead window. However, with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7917&#x2F;&quot;&gt;EIP-7917&lt;&#x2F;a&gt;, the proposer selection is fixed in advance by storing in the Beacon state, so it would not be affected by slashings processed after the fact.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;impact-on-proposer-selection-distribution&quot;&gt;Impact on proposer selection distribution&lt;&#x2F;h3&gt;
&lt;p&gt;This change does not affect the randomness or fairness of proposer selection among non-slashed validators. The selection algorithm remains the same, with the only difference being that slashed validators are excluded from the candidate pool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mass-slashing-scenarios&quot;&gt;Mass slashing scenarios&lt;&#x2F;h3&gt;
&lt;p&gt;During mass slashing events, this change is purely beneficial to the resilience of the network, as well as to general quality of service. Instead of having many slashed validators selected as proposers (resulting in many missed slots), the network will continue to operate normally with only non-slashed validators being selected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uniform price auction over inclusion lists</title>
        <published>2025-10-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8046-uniform-price-auction-over-inclusion-lists/25844" />
        

        <id>https://wg-eips.ritovision.com/8046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8046"
            label="EIP-8046" />
        

        
        

        
        <summary type="html">Ensure IL transactions that offer a higher ranking fee than competing transactions are included in the block. Burn the marginal ranking fee.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8046/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a uniform price auction over inclusion lists (UPIL), which ranks transactions by their offered ranking fee per gas. When the block is full, no transaction is allowed to displace an inclusion-list (IL) transaction that passes regular inclusion criteria and offers a higher ranking fee per gas. All included transactions pay a uniform inclusion price, equal to the highest ranking fee offered by any valid IL transaction excluded from the block, and this fee is burned. UPIL achieves strong censorship resistance by not allowing builders to circumvent propagated ILs when the block is full. This is particularly valuable for time-sensitive transactions and promotes fairness while preventing cheap block-stuffing under a multidimensional fee market. UPIL is specified to run on top of FOCIL (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt;), but can be deployed on top of any IL mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Censorship resistance (CR) is a key property of decentralized blockchains. To ensure that transactions cannot be censored by the entity building the block (denoted &quot;builder&quot; in this EIP, which may sometimes be the proposer), a mechanism called fork-choice enforced inclusion lists (FOCIL) has been proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt;. A set of includers propagate inclusion lists (ILs), and the attesters uphold that the transactions in the ILs are included in the block via the fork-choice. There is no mechanism for ranking transactions in the ILs, and therefore not viable to uphold CR when the block is full. If IL transactions must be prioritized under full blocks, the builder could simply integrate with includers to propagate ILs containing the transactions it wishes to include in the block.&lt;&#x2F;p&gt;
&lt;p&gt;To uphold CR also under full blocks, it is necessary to have a framework for which transactions to include and exclude. This EIP specifies a uniform price auction over inclusion lists (UPIL), which ranks transactions by their offered &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, derived from their specified &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt;. If a block is full, no transaction is allowed to displace an IL transaction with a higher &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, as long as the displaced IL transaction passes regular inclusion criteria. All included transactions pay the &quot;marginal&quot; ranking fee, corresponding to the highest ranking fee offered by a valid IL transaction excluded from the block, and this fee is burned. If no IL transaction was excluded, the marginal ranking fee is &lt;code&gt;0&lt;&#x2F;code&gt;. In essence, the existing base fee prices inter-block contention, while UPIL is an auction mechanism that relies on ILs to impose a secondary base fee that prices intra-block contention.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum is currently pursuing scaling by tracking gas consumption across separate resources, allowing each resource to be consumed at its maximum capacity. With a multidimensional approach, it can become cheaper to &quot;stuff the block&quot; such that it is full in any dimension by creating &quot;dummy transactions&quot; that only consume one specific resource. This degrades the CR of FOCIL, since builders can ignore ILs in full blocks. In the multidimensional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7706&#x2F;&quot;&gt;EIP-7706&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, the degradation of CR can become rather pronounced. Base fees are set individually per resource and may become very low, depending on whether reserve prices in the style of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;&quot;&gt;EIP-7918&lt;&#x2F;a&gt; are adopted or not. Furthermore, if the builder varies which resource that is full across blocks, there is no longer an exponentially increasing cost to keep a transaction censored block after block.&lt;&#x2F;p&gt;
&lt;p&gt;The strong CR of UPIL is particularly suitable under a multidimensional fee market, but can be beneficial under any fee market. Some transactions are time-sensitive: what matters is inclusion within a set time frame. Sometimes, that time frame consists of just a few or a single block. UPIL guarantees inclusion in the next block for a transaction offering a sufficient ranking fee, assuming includers and attesters do their duties. This puts includers and the builder on a more equal footing. Furthermore, the lack of ranking in FOCIL gives builders an incentive to amass private transactions to facilitate low-cost temporary censorship, which could negatively affect the public mempool. However, both FOCIL and UPIL also have properties that strengthen the public mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-transaction-format-and-ranking-fee&quot;&gt;New transaction format and ranking fee&lt;&#x2F;h3&gt;
&lt;p&gt;A new field &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; is added to a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;RANK_TX_TYPE&lt;&#x2F;code&gt;. The &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is:&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: To be defined after scheduling this EIP relative to EIP-7999 and EIP-8011, etc.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ranking is performed on the &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, corresponding to the maximum ranking fee that the transactor was willing to pay under the current base fee. Older transaction formats use their entire headroom for their offered ranking fee, whereas the new format can cap the ranking fee using the &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_legacy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_ranking_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The new RANK_TX_TYPE can set a cap to the offered ranking fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RANK_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The ranking fee does not impose ordering constraints within the block, and only governs inclusion. The alternative specifications section discusses the options that exist for computing the &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; in various transaction formats, including the option to not implement a new transaction format at all.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-processing&quot;&gt;Transaction processing&lt;&#x2F;h3&gt;
&lt;p&gt;The builder specifies in the block body the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; that all transactions must pay. The full &lt;code&gt;inclusion_fee_per_gas&lt;&#x2F;code&gt; corresponding to &lt;code&gt;base_fee_per_gas + marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; is covered before the priority fee. A valid transaction must have &lt;code&gt;max_fee_per_gas &amp;gt;= inclusion_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;RANK_TX_TYPE&lt;&#x2F;code&gt; transactions must also have &lt;code&gt;max_ranking_fee_per_gas &amp;gt;= marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;. Thus, under &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, transaction processing is changed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing check...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..check that the transactor is willing to pay the marginal ranking fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; RANK_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;marginal_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..derive the inclusion fee per gas and perform checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;marginal_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..cap the priority fee by the inclusion fee instead of the base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..and adjust the line calculating the effective gas price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The inclusion fee is never distributed and thus burned. Note that legacy transactions are assigned &lt;code&gt;max_fee_per_gas = gas_price&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas = gas_price&lt;&#x2F;code&gt; as part of a prior normalization step. The existing assert statement&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;is redundant and is removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;altered-focil-post-execution-inclusion-check&quot;&gt;Altered FOCIL post-execution inclusion check&lt;&#x2F;h3&gt;
&lt;p&gt;The post-execution inclusion check of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt; is altered as outlined in the figure. Orange squares represent the original FOCIL checks, where &quot;No&quot; always leads to jumping to the next transaction. Blue squares are the checks added in UPIL that account for ranking. The first black square of step (1) contains only peripheral modifications that do not alter the intended outcome of the inclusion check.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8046&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; is first computed for each transaction &lt;code&gt;X&lt;&#x2F;code&gt; in the block via &lt;code&gt;get_ranking_fee(X, B)&lt;&#x2F;code&gt;. Then, for each transaction &lt;code&gt;T&lt;&#x2F;code&gt; in ILs, the check performs three steps.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;The original step (1)&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;(1) Check whether &lt;code&gt;T&lt;&#x2F;code&gt; is present in &lt;code&gt;B&lt;&#x2F;code&gt;. If &lt;code&gt;T&lt;&#x2F;code&gt; is present, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;is replaced with the following:&lt;&#x2F;p&gt;
&lt;p&gt;(1) If &lt;code&gt;T&lt;&#x2F;code&gt; is present in &lt;code&gt;B&lt;&#x2F;code&gt;, or &lt;code&gt;get_max_fee(T) &amp;lt; block.base_fee_per_gas&lt;&#x2F;code&gt;, or &lt;code&gt;T&lt;&#x2F;code&gt; fails static validity, then skip &lt;code&gt;T&lt;&#x2F;code&gt; and jump to the next IL transaction, else continue to the next step.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;The original step (2):&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;(2) Check whether &lt;code&gt;B&lt;&#x2F;code&gt; has enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;. If &lt;code&gt;T.gas&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;gas_left&lt;&#x2F;code&gt;, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;is replaced with the following:&lt;&#x2F;p&gt;
&lt;p&gt;(2a) Check whether &lt;code&gt;B&lt;&#x2F;code&gt; has enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;: &lt;code&gt;gas_left &amp;gt;= T.gas_limit&lt;&#x2F;code&gt;. If so, continue to (3a); otherwise, continue to (2b) potentially followed by (3b).&lt;&#x2F;p&gt;
&lt;p&gt;(2b) Check whether &lt;code&gt;B&lt;&#x2F;code&gt; would have had enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;, if &lt;code&gt;T&lt;&#x2F;code&gt; was included together with only higher-ranked transactions in &lt;code&gt;B&lt;&#x2F;code&gt;. First compute &lt;code&gt;T.ranking_fee_per_gas = get_ranking_fee(T, B)&lt;&#x2F;code&gt; and then compute &lt;code&gt;gas_ranked_left(T)&lt;&#x2F;code&gt; as the remaining gas after subtracting the &lt;code&gt;gas_used&lt;&#x2F;code&gt; of all transactions of the block with a higher &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; than &lt;code&gt;T&lt;&#x2F;code&gt; from &lt;code&gt;B.gas_limit&lt;&#x2F;code&gt;. For transactions with the same &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, included transactions in &lt;code&gt;B&lt;&#x2F;code&gt; are considered higher-ranked than not-included IL transactions. If &lt;code&gt;gas_ranked_left(T) &amp;gt;= T.gas_limit&lt;&#x2F;code&gt;, continue to (3b); otherwise jump to the next IL transaction.&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;The original step (3):&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;(3) Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce and balance of &lt;code&gt;T.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;is replaced with the following:&lt;&#x2F;p&gt;
&lt;p&gt;(3a) Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce and balance of &lt;code&gt;T.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;(3b) Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce of &lt;code&gt;T.origin&lt;&#x2F;code&gt;. Further validate &lt;code&gt;T&lt;&#x2F;code&gt; against the balance of the origin account by applying the standard pre-execution fundability check to a conservative balance that ignores all increases and counts all decreases to &lt;code&gt;T.origin&lt;&#x2F;code&gt; at the completion of each executed transaction of the block. Intermediate increases or decreases during the execution of a transaction are not tracked in isolation.&lt;&#x2F;p&gt;
&lt;p&gt;Step (3a) and (3b) conclude as previously:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is invalid, then continue to the next transaction.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is valid, terminate process and return an &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;check-on-the-marginal-ranking-fee&quot;&gt;Check on the marginal ranking fee&lt;&#x2F;h3&gt;
&lt;p&gt;Attesters review excluded IL transactions to confirm that the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; was set correctly by the builder. If step (2b) indicates that the transaction was outranked, then, before continuing with the next transaction, the transaction is also checked against step (3b), as indicated by a dashed line in the figure. The highest &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; among outranked IL transactions from (2b) that pass the valid inclusion check of (3b) must equal &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;. If no outranked IL transaction passes (3b), the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; must be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;updated-inclusion-check&quot;&gt;Updated inclusion check&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;conservative-balance&quot;&gt;Conservative balance&lt;&#x2F;h4&gt;
&lt;p&gt;The reason for using a conservative balance in (3b) when validating &lt;code&gt;T&lt;&#x2F;code&gt; is to avoid the circular dependencies that can emerge when a transaction is made executable by a lower-ranked transaction. Consider three transactions &lt;code&gt;A&lt;&#x2F;code&gt;, &lt;code&gt;B&lt;&#x2F;code&gt;, and &lt;code&gt;C&lt;&#x2F;code&gt; ranked as &lt;code&gt;A&amp;gt;B&amp;gt;C&lt;&#x2F;code&gt;. Without a conservative balance, &lt;code&gt;A&lt;&#x2F;code&gt; might be funded only if &lt;code&gt;B&lt;&#x2F;code&gt; is included in the block. For example, transaction &lt;code&gt;B&lt;&#x2F;code&gt; might fund &lt;code&gt;A&lt;&#x2F;code&gt;, so without &lt;code&gt;B&lt;&#x2F;code&gt;, &lt;code&gt;A&lt;&#x2F;code&gt; cannot be included, and without &lt;code&gt;A&lt;&#x2F;code&gt;, &lt;code&gt;B&lt;&#x2F;code&gt; cannot be included due to having a lower ranking. There is not enough gas to include both &lt;code&gt;A&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt;. Including neither and instead including &lt;code&gt;C&lt;&#x2F;code&gt; also fails because the left out &lt;code&gt;B&lt;&#x2F;code&gt; was higher ranked.&lt;&#x2F;p&gt;
&lt;p&gt;It is not necessary that &lt;code&gt;B&lt;&#x2F;code&gt; directly funds &lt;code&gt;A&lt;&#x2F;code&gt;. It might very well be the case that &lt;code&gt;B&lt;&#x2F;code&gt; just changes the state such that a higher-ranked transaction &lt;code&gt;X&lt;&#x2F;code&gt; funds &lt;code&gt;A&lt;&#x2F;code&gt;, something that &lt;code&gt;X&lt;&#x2F;code&gt; would not do unless &lt;code&gt;B&lt;&#x2F;code&gt; was run beforehand.&lt;&#x2F;p&gt;
&lt;p&gt;It should be noted in (3b) that the transactor is in control of decreases to its ETH balance. Within a block, ETH leaves &lt;code&gt;T.origin&lt;&#x2F;code&gt; only via the transactor’s own signed transactions (value transfers and gas payments) or contracts it has explicitly authorized; the builder cannot manufacture debits. If the transactor’s own debits make &lt;code&gt;T&lt;&#x2F;code&gt; unfundable, and these are included in the block—even if lower-ranked—exclusion is acceptable as a consequence of choices made. After all, the transactor controls the relative order of its own transactions via nonces. Thus, ranking is neither considered for debits nor for credits: debits count regardless of rank, and credits do not count at all.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;retained-focil-check-in-non-full-blocks&quot;&gt;Retained FOCIL check in non-full blocks&lt;&#x2F;h4&gt;
&lt;p&gt;The regular FOCIL check is retained in non-full blocks to take advantage of its operational simplicity and since the conservative balance check of UPIL is unnecessarily lenient to the builder whenever an excluded IL transaction would have fit and is funded during processing of the prior transactions in the block. The circular dependencies from the previous subsection do not apply in FOCIL since there is no requirement for transactions in the IL to be included in the block if a transaction outside of the IL uses up the gas. Once (2a) confirms slack, the builder was clearly able to include any existing funding transaction in the block and still include &lt;code&gt;T&lt;&#x2F;code&gt;, so skipping &lt;code&gt;T&lt;&#x2F;code&gt; is an IL violation. UPIL could otherwise also be implemented completely without the old FOCIL checks, to reduce code surface. This corresponds to removing the orange boxes in the figure, retaining the blue boxes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;compute-requirements-for-2b-and-3b&quot;&gt;Compute requirements for (2b) and (3b)&lt;&#x2F;h4&gt;
&lt;p&gt;The new conditions can be checked efficiently by clients.&lt;&#x2F;p&gt;
&lt;p&gt;In step (2b), validators can generate a list of the transactions in the block post-execution, sorted according to &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt;, with an associated list of the cumulative gas consumption. The check for each transaction then only requires keying into the list and extracting the associated gas consumption.&lt;&#x2F;p&gt;
&lt;p&gt;For step (3b), the preprocessing consists of tracking a limited set of account-balance-changes during transaction processing. Before processing the block, the client builds an observation set &lt;code&gt;E&lt;&#x2F;code&gt; of &lt;code&gt;T.origin&lt;&#x2F;code&gt; balances for excluded IL transactions. After processing each transaction, it updates &lt;code&gt;E&lt;&#x2F;code&gt;, accounting for all decreases to &lt;code&gt;T.origin&lt;&#x2F;code&gt; balances but ignoring increases. If a block-level access list (BAL) is available that tracks all balance changes, the overall task is further simplified.&lt;&#x2F;p&gt;
&lt;p&gt;The check on the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; (dashed line in the figure) is also trivial. For example, all outranked IL transactions that are otherwise validly includable can have their &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; added to an array. After all IL transactions have been reviewed, the maximum entry of this array must equal the specified &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;. If the array is empty, the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; must instead be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auction-design&quot;&gt;Auction design&lt;&#x2F;h3&gt;
&lt;p&gt;The uniform price auction design allows transactors to signal intent (to overcome censorship if the block is full), without actually having to pay more than necessary. A transactor may not know beforehand if they will be censored, and may not wish to pay a very high fee for no reason. There are similarities to the current base fee model. Everyone specifies their willingness to pay, but pays the same minimum fee for inclusion, and this fee is burned. The combination of intents and fairness is attractive. A key difference is that the base fee is a clearing fee tracking contention for blockspace at the inter-block level, whereas the marginal ranking fee is a clearing fee tracking contention for blockspace at the intra-block level (locally for each block).&lt;&#x2F;p&gt;
&lt;p&gt;In essence, Ethereum’s current fee mechanism combines a uniform-price base fee that clears congestion across blocks with a first-price priority fee allocating space within each block. What UPIL does is to expand the uniform-price component to the intra-block level by introducing a marginal ranking fee that all included transactions pay equally. Inclusion will thus be governed primarily by protocol-defined uniform clearing (assuming transactions are surfaced in ILs).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; is expected to be set rather low under normal circumstances. Most transactors will not be willing to pay excessively to be included in full blocks, and can instead wait for the next block. However, since the next block will have a 12.5% higher base fee, most transactors will at a minimum set &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; to 12.5% of the current base fee. The increase in burned fees extracted from transactors in full blocks will be offset by a decrease in priority fees, since the builder no longer controls which transactions that are included (furthermore, includers may also receive other fees, as discussed in the section on includer rewards). The ranking fee will also help with clearing in a fair manner under congestion during sudden spikes in transaction demand. All transactions included in the same block will pay the same ranking fee, with transactions willing to pay the most during a sudden spike included in the first available block. This is arguably an improvement to the UX for Ethereum&#x27;s users.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for burning the marginal ranking fee instead of paying it out to includers is that includers otherwise could have an incentive to engineer artificial congestion in order to raise the fee. This is not trivial, requiring many separate entities to agree to withhold transaction inclusion for consecutive blocks. Various configurations for how to reward includers for their work are outlined in a subsequent section, including the option to distribute the marginal ranking fee to them.&lt;&#x2F;p&gt;
&lt;p&gt;The builder may sometimes, via its private orderflow or late-arriving transactions, have some ability to raise the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; by including transactions that outrank IL transactions. But a builder that raises the marginal ranking fee will also inadvertently reduce the priority-fee headroom for all transactions, since the inclusion fee is subtracted from the max fee before calculating the capped priority fee for all transactions in the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-upil&quot;&gt;Multidimensional UPIL&lt;&#x2F;h3&gt;
&lt;p&gt;If there are multiple resources, &lt;code&gt;gas_ranked_left(T)&lt;&#x2F;code&gt; is a vector. Using the notation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, all &lt;em&gt;conditional&lt;&#x2F;em&gt; resources must then be checked against the corresponding gas limits specified by the analyzed transaction. Transactions that consume any &lt;em&gt;deconditional&lt;&#x2F;em&gt; resource are not subject to the UPIL post-execution check, and insufficient capacity in an &lt;em&gt;unconditional&lt;&#x2F;em&gt; resource is never a valid reason to exclude an IL transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, under multidimensional UPIL, the transaction is checked against &lt;code&gt;gas_ranked_left(T)&lt;&#x2F;code&gt; over the conditional resources only, in both (2a) and (2b). However, given the strong CR of UPIL, it would be perfectly feasible to classify calldata as conditional instead of using the unconditional classification of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;censorship-resistance-under-focil-and-upil&quot;&gt;Censorship resistance under FOCIL and UPIL&lt;&#x2F;h3&gt;
&lt;p&gt;This subsection offers a comparison of the censorship resistance achieved under FOCIL and UPIL. The premise is a builder seeking to censor a transaction under different fee market designs. We begin by rudimentarily quantifying the cost $C_i$ of censoring a transaction in block $i$ ($i=0$ for the first censored block) as:&lt;&#x2F;p&gt;
&lt;p&gt;$C_i = g_df_b  (1+r)^i  + g_df_r +  m(i, f_r).$&lt;&#x2F;p&gt;
&lt;p&gt;In this equation, $g_d$ is the gas that the builder must pay by creating so-called &quot;dummy transactions&quot; to fill the block, $f_b$ is the base fee for that gas, $r$ is the rate by which the base fee increases in full blocks (i.e., 12.5%), $f_r$ is the &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; of the censored transaction, and $m(i, f_r)$ is the MEV (including priority fees) forgone when forced to exclude pending transactions with a lower ranking than the censored transaction for block $i$ (the opportunity cost).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market&quot;&gt;Multidimensional fee market&lt;&#x2F;h4&gt;
&lt;p&gt;Under a multidimensional fee market envisioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7706&#x2F;&quot;&gt;EIP-7706&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, the base fee is set individually per resource to maximize utilization of blockspace. As noted in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, the base fee may therefore sometimes become very low for a resource, meaning that the cost of generating dummy transactions to fill the block also becomes very low. In a potential multidimensional FOCIL, it is then only necessary that one resource used by a transaction is filled to censor that transaction. Furthermore, while the base fee will increase for the resource that was filled with dummy transactions, the base fees of all other resources will not. These base fees will instead vary based on gas consumed by regular transactions included in the block. The builder can potentially vary which resource it fills the block for, to keep any base fee from exploding during prolonged censorship. Define $\mathbf{f_b}$ as the vector of base fees. The outcome for FOCIL and UPIL respectively is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;FOCIL:&lt;&#x2F;strong&gt; The cost of censorship for the first block is $C_0 = g_d\min(\mathbf{f_b})$, and thus $C_0 \to 0$ if $\min(\mathbf{f_b}) \to 0$. The cost can potentially be kept close to 0 even under continued censorship, depending on the distribution of the equilibrium base fees under no censorship and the fee elasticities of demand.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There is no ranking fee (thus $g_df_r \to 0$) and there is no opportunity cost because the builder can always include lower-ranked transactions when it fills the block (thus $m(i, f_r) \to 0$).&lt;&#x2F;li&gt;
&lt;li&gt;The builder can switch between resources it fills, thus potentially keeping its overall costs contained even under continued censorship. This depends on prevailing fee elasticities and equilibrium base fees under no censorship.&lt;&#x2F;li&gt;
&lt;li&gt;If there is just one base fee that is low initially, then that base fee will rise (albeit from a low starting point), if the builder does not assume the opportunity cost $m(i, f_r)$ of excluding other transactions. Fee elasticities are relevant also in this case, because the rise in a single base fee should moderately reduce demand for all other resources as the transactor reviews the total cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;UPIL:&lt;&#x2F;strong&gt; The cost of censorship for the first block is $C_0 = g_d\min(\mathbf{f_b}) + g_df_r + m(i, f_r)$, and thus $C_0 = g_df_r + m(i, f_r)$ if $\min(\mathbf{f_b}) \to 0$. This cost can be hundreds or thousands of times higher than whatever ranking fee the censored transaction specifies, and it rises with continued censorship due to the opportunity cost of keeping all pending transactions with a lower ranking fee that consume the filled resource out of the block.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the transactor specifies a ranking fee $f_r$ that exceeds the ranking fee of existing transactions in the mempool, the censoring builder will need to create dummy transactions up to the entire gas limit of the resource it is targeting. This can be specified as $g_d = g_l-g_r(T)$, where $g_r(T)$ is the gas already consumed by the censored transaction. Thus, the censoring builder must pay $f_r(g_l-g_r(T))$. To censor a transaction consuming 100k gas when the gas limit is 60M in the filled resource, the builder must pay $(60-0.1)&#x2F;0.1 = 599$ times more than what the transactor was willing to pay for inclusion. As the gas limit expands, the relative cost of censorship increases. It should here be noted that the transactor will not need to pay its high offered ranking fee if it is indeed censored, and would after censorship concludes only pay according to the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; of the subsequent block.&lt;&#x2F;li&gt;
&lt;li&gt;The opportunity cost from censorship is also higher under UPIL than FOCIL, since no pending transaction with a ranking fee $f&#x27;_r&amp;lt;f_r$ that consumes the filled resource can be included if the censored transaction is excluded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;current-fee-market&quot;&gt;Current fee market&lt;&#x2F;h4&gt;
&lt;p&gt;We now discuss the situation under the current fee market with a single base fee (ignoring the blob resource). In this case, the base fee term of the previous equation does not vanish. If the builder does not use the &quot;slow transaction&quot; strategies outlined in the next subsection, the outcome for FOCIL and UPIL respectively is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;FOCIL:&lt;&#x2F;strong&gt; The builder must cover the base fees: $g_df_b(1+r)^i$ of block $i$. The required amount of purchased gas $g_d$ will in the average case be $g_d=g_l&#x2F;2$. However, there will be many instances where pending transactions in the public mempool or via private orderflow consume more than $g_l&#x2F;2$. Censorship for one or two blocks can therefore be inexpensive even if pending transactions do not completely fill the block. The $(1+r)^i$ term grows by 12.5% per block, doubling in six blocks, and pending transactions are quickly depleted. Therefore, censorship becomes costly rather quickly: FOCIL ensures that transactions are included within a limited number of blocks if includers do their duties, but not in the first few blocks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;UPIL:&lt;&#x2F;strong&gt; The builder must cover the base fee, the ranking fee, and forego pending transactions, thus suffering a cost of $g_df_b(1+r)^i + g_df_r + m(i, f_r)$. The required gas $g_d$ is higher than in FOCIL, and—just as for the multidimensional fee market—potentially the full gas limit, because the builder cannot rely on pending transactions with a lower ranking fee for block stuffing. Due to the $g_df_r$ term, the cost for censoring a transaction for a single block can easily become a thousand times higher than whatever the transactor was willing to pay for inclusion, just as under the multidimensional fee market.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;current-fee-market-with-slow-transactions&quot;&gt;Current fee market with &quot;slow transactions&quot;&lt;&#x2F;h4&gt;
&lt;p&gt;Note the importance of pending transactions for sidestepping the ILs in FOCIL: the cost for covering base fees when filling the block provides the CR. A strategy the builder could use to reduce the cost of censorship over a few blocks is to amass &quot;slow transactions&quot; through private orderflow—transactions that do not have to execute immediately. These are transactions for which the transactor is willing to substitute speed for some other benefit, predominantly rebated fees, but potentially also convenience or MEV protection. The builder (or realistically a MEV-protecting RPC endpoint) guarantees (trustfully) inclusion within some set time frame, and that the total cost for the transactor will be below the cost that would have been incurred given the base fee at the time that the tx is sent to the builder. The concept can be integrated as:&lt;&#x2F;p&gt;
&lt;p&gt;$C_i = g_df_b  ((1+r)^i-s)  + g_df_r +  m(i, f_r).$&lt;&#x2F;p&gt;
&lt;p&gt;Here, $s$ represents the cost reduction factor relative to the initial base fee. This models a scenario where the builder has stored and promised to include blockspace-filling transactions at a fixed discount. If the rebate to transactors for slow transactions is 10%, then $s=0.9$, with the cost of censoring the first block in FOCIL reduced by 90%. Such a strategy can thus be useful for censoring a couple of blocks in a row. After around 5 blocks or less, $(1+r)^i - s &amp;gt; 1$, meaning that the cost is the same as the cost of censoring the first block without slow transactions. Since the supply of slow transactions would likely be limited, the strategy cannot be applied too often.&lt;&#x2F;p&gt;
&lt;p&gt;Slow transactions must be propagated privately to remain useful, and reach their full economic potential by contributing to censorship. When the value in sidestepping ILs exceeds the costs of facilitating slow transactions, the proportion of transactions propagated p2p may thus fall. On the other hand, the transactions that indeed are propagated p2p are upon IL listing guaranteed inclusion in non-full blocks, and therefore do not need to pay priority fees. The effect of FOCIL on the public mempool may therefore be negative or positive depending on the demand for censorship from builders. Alternatively, the protocol could facilitate &quot;trustless slow transactions&quot; by letting builders sponsor transactions offering a max fee below the prevailing base fee, for example by charging the base fee jointly for all transactions at the end of the block.&lt;&#x2F;p&gt;
&lt;p&gt;Under UPIL, slow transactions do not contribute meaningfully to censorship due to the $g_df_r +  m(i, f_r)$ terms, and there is furthermore no rationale for paying a priority fee upon listing, further strengthening the public mempool.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-gas-metering&quot;&gt;Multidimensional gas metering&lt;&#x2F;h4&gt;
&lt;p&gt;Under multidimensional gas metering in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;, the situation is closer to the current fee market than the multidimensional fee market. There is still just one base fee, so the cost of censoring a transaction for a sustained period rises exponentially. Censorship may become slightly cheaper than currently, due to the equilibrium reduction in the base fee with a maintained slack in the block relative to the most consumed resource. On the other hand, utilization of slow transactions may become slightly less efficient.&lt;&#x2F;p&gt;
&lt;p&gt;In the current fee market, half the gas limit $g_l&#x2F;2$ is consumed in the average block. Transactors spend $f_bg_l&#x2F;2$ on average and the cost of censoring a block via dummy transactions is also $f_bg_l&#x2F;2$. Under multidimensional gas metering, $g_l&#x2F;2$ is consumed on average individually for the most used resource. Transactors however consume the higher $xg_l&#x2F;2$ amount of gas on average over all resources, while the gas required for censorship remains at $g_l&#x2F;2$ (filling up the most consumed resource). Here $x$ corresponds to the scaling factor achieved when gas of different resources can be consumed in parallel, a scaling factor that might end up in the range 2-4. Keeping demand and $g_l$ fixed, the base fee $f_b$ will fall, reducing the cost $f_bg_l&#x2F;2$ of censoring a block in the average case. Had we instead simply increased the gas limit, CR would have been affected differently, because then the cost of censorship would also have increased according to the increase in $g_l$, such that the censoring builder would have needed to purchase more dummy transactions in the average case.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-inclusion-and-mev&quot;&gt;Transaction inclusion and MEV&lt;&#x2F;h4&gt;
&lt;p&gt;In FOCIL, including an existing transaction is always possible without raising the inclusion fee, regardless of whether this means that an IL transaction must be excluded or not. In UPIL, if the block is full, including an existing transaction over an IL transaction willing to pay more is treated as censorship. Ostensibly, MEV and censorship are not separate topics: in many scenarios, censorship is also MEV. To displace the IL transaction offering the lowest ranking fee among IL transactions in the block, the new transaction must pay at least the ranking fee offered by that IL transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Since the builder cannot freely decide which of the pending transactions to include in UPIL, it might not be able to extract all MEV from pending transactions that it could have in FOCIL. It lacks the ability to exclude IL transactions at will from full blocks. Once a transaction is in an IL, its inclusion is guaranteed if it is willing to pay at least the same as the smallest offer by other transactions that go into the block. This levels the playing field between includers and the builder, giving the includer the opportunity to offer real inclusion guarantees to transactors. In FOCIL, the &lt;em&gt;protocol&lt;&#x2F;em&gt; offers real inclusion guarantees, &lt;em&gt;eventually&lt;&#x2F;em&gt;. In UPIL, the &lt;em&gt;includer&lt;&#x2F;em&gt; offers real inclusion guarantees, &lt;em&gt;immediately&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Some includers might charge transactors for their services in FOCIL, but the value of the provided services is further strengthened in UPIL. MEV might thus shift from the builder to includers in the form of fees for listing the transaction. A transaction listed by an IL has no need to pay a priority fee for inclusion. Indeed, we may even see &quot;IL-builders&quot; that collate full ILs as a service both in FOCIL and UPIL. Some MEV will also shift to the protocol in the form of burned ranking fees. It is natural to then consider what options the builder has, to retain some power over transaction inclusion. It may of course try to bribe includers to not list transactions. A problem for a builder trying to stay competitive is that this requires bribing all includers, and that any includer remaining faithful to its duties can earn a greater reward from transactors when others take the bribe, particularly in UPIL.&lt;&#x2F;p&gt;
&lt;p&gt;There are nuances to the design that need careful consideration before adoption. Something to be attentive to is the effect of burning the marginal ranking fee, given that avoiding the burn is not a zero-sum outcome for builders and includers. This is further discussed in the next section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications-for-rewarding-includers&quot;&gt;Alternative specifications for rewarding includers&lt;&#x2F;h3&gt;
&lt;p&gt;Transactors might wish to reward includers in both FOCIL and UPIL for surfacing their transaction in an IL. They may recognize that the space in each IL is limited, meaning includers sometimes need to prioritize between available transactions. They might also fear that builders could bribe includers to not fulfill their duties, so that the builder can exclude unwanted transactions. As discussed previously, UPIL strengthens the position of includers, giving them in some sense equal power to the builder in deciding which transactions enter the block. For this reason, the case for rewarding includers is also stronger: an IL transaction does not require a priority fee to be included, even in full blocks—it must be included if it offers a higher ranking fee than competing transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;out-of-protocol-inclusion-fees&quot;&gt;Out-of-protocol inclusion fees&lt;&#x2F;h4&gt;
&lt;p&gt;If there is no in-protocol reward mechanism, individual staking service providers might start offering (trustfully) to list transactions in their next assigned IL slot, against a small fee. We might also see public orderflow of includable transactions offering a certain reward for inclusion, with includers and transactors coming to agreement via a third-party software. This can improve the UX, but also has the potential to become a centralization vector.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;in-protocol-inclusion-fee-sources&quot;&gt;In-protocol inclusion fee sources&lt;&#x2F;h4&gt;
&lt;p&gt;It is possible that the protocol can be of direct assistance. Three fee sources will first be reviewed, and relevant distribution mechanisms then explored.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Includer fee:&lt;&#x2F;strong&gt; One example is to allow transactions to specify an includer fee via a new field &lt;code&gt;max_includer_fee_per_gas&lt;&#x2F;code&gt;. To split the &lt;code&gt;max_includer_fee_per_gas&lt;&#x2F;code&gt; and the &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; when they are capped by the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, the &quot;aggregate-cap-divide&quot; method outlined in the &quot;pay-as-you-bid&quot; subsection is the recommended approach. Alternatively, it is possible to distribute only the includer fee or the priority fee, depending on if the transaction was listed in an IL or not, and never both. The builder must then specify whether each transaction originated from an IL or not (at the transaction or IL level), and attesters vote against the block if the builder fails to make such an assignment when they observed the transaction in a timely IL.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Priority fee:&lt;&#x2F;strong&gt; It is possible to instead let the includers receive the priority fee if they list a transaction. The builder will have no choice but to include a transaction once it is listed by an includer, and the priority fee then serves little purpose. From the transactor&#x27;s perspective, giving a priority fee to the builder for an IL transaction is a wasteful expenditure. Once again, with this option the builder must specify whether each transaction originated from an IL or not.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Marginal ranking fee:&lt;&#x2F;strong&gt; The marginal ranking fee can be distributed to includers instead of being burned. As discussed previously, one potential downside of this is the increase in rewards for engineering contention—in collaboration with builders—by first withholding transactions, and then releasing all transactions in the same block.&lt;&#x2F;p&gt;
&lt;p&gt;The question is whether includers will be able to engineer such contention, given the coordination problem at hand: withholding transactions over several slots, with several slots&#x27; includers working together, where anyone breaking the cartel could reap higher rewards from transactors paying includers for their services. Transactors might also end up setting lower ranking fees if such an approach becomes systematic, and most ranking fees will likely anyway be in the region of 12.5% of the base fee. Finally, we do not see builders coordinating to bring down the base fee in order to reap higher priority fees today (at the same time, the control over the priority fee is indirect, and they do not directly attain the base fee).&lt;&#x2F;p&gt;
&lt;p&gt;A potential benefit of distributing the marginal ranking fee to includers is that if the builder wishes to bribe includers to avoid contention (in order to bring up priority fees), then includers taking such a bribe would miss out on rewards for that contention (in addition to any rewards they may already miss out on from includer priority fees).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mechanisms-for-distributing-inclusion-fees-in-protocol&quot;&gt;Mechanisms for distributing inclusion fees in-protocol&lt;&#x2F;h4&gt;
&lt;p&gt;Four options for how to distribute the fee from any of the three in-protocol inclusion fee sources listed in the previous section will now be reviewed:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(1) Keyed distribution:&lt;&#x2F;strong&gt; Let transactors set one or several keys, with each key linking to one includer (i.e., validator ID) or to many includers (e.g., enabling all validators of an SSP to associate one key to all its validators). The protocol can then ensure that the rewards are distributed only to validators represented by a key, if it listed the transaction. This means that transactions shared with an includer privately still can use an in-protocol fee distribution without risking dilution. Options (2)-(4) below can be applied when the transactor does not provide a key or when the keyed includer(s) failed to list the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(2) Individual distribution:&lt;&#x2F;strong&gt; Split the fee between all includers listing a transaction. All includers then have an incentive to list a transaction, with the incentive being stronger if other includers have ignored it. It may however lead to unnecessary duplicate listings, since there is an incentive to list transactions even after they have been observed in another IL. It may also lead includers to integrate with builders to propagate the optimal IL by leveraging the builder&#x27;s last look.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(3) Seniority distribution:&lt;&#x2F;strong&gt; Use a &quot;seniority waterfall&quot; rule. The transaction hash is combined with includer validator IDs to assign an order of seniority by which each includer has the right to the full includer fee. If a transaction&#x27;s senior includer lists it, there is no purpose for a less senior includer to also list it. The idea is to promote a broader coverage while maintaining fairness. The mechanism will however not remove all duplicates, as a more senior includer will still list a transaction already listed by a less senior includer. It is straightforward to combine (1) with (3), by giving keyed includers the highest seniority, with remaining includers assigned a seniority based on the transaction hash. This could also prevent transaction hash grinding in the case when some senior includers are more reliable than others. Under the priority fee redistribution rule, the builder is in essence appended to the waterfall, having the lowest seniority.&lt;&#x2F;p&gt;
&lt;p&gt;To further reduce duplicates, a potential extension could allow includers to stagger their inclusion list so that they first broadcast transactions they are the most senior includer for, and then append the list with transactions they are less senior for or that arrive late. This can also increase the includer&#x27;s expected value (EV) since an early broadcast increases margins and the late broadcast allows for better coverage. Another way to increase EV under this rule is to combine it with (4) below. Each partial list must have timeliness observed in isolation, and the rules for IL equivocation must be amended to allow append operations.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(4) Collective distribution:&lt;&#x2F;strong&gt; Distribute the includer fee collectively to all includers. There is then no need to keep track of who propagated which transaction in which IL. It also serves to promote independence of includers. Builders cannot help includers to extract a relatively higher proportion of the ranking fee by constructing an optimal IL for them from their last look. Includers are further encouraged to facilitate as broad coverage as possible, given that there are no incentives to propagate a (high-paying) transaction if one of the other includers already propagates it. This means that some includers can pivot to propagating their ILs early, while others observe and select late or missed transactions.&lt;&#x2F;p&gt;
&lt;p&gt;A downside is that includers are not incentivized individually to do a good job, and gain individually only 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; of any ranking fee of a transaction they uniquely include. The point however is that the collective distribution alters the meaning of &quot;doing a good job&quot;, aligning protocol design goals with includer incentives.&lt;&#x2F;p&gt;
&lt;p&gt;Builders may try to bribe includers to not include transactions. If an includer will receive 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; of any collective rewards for &lt;em&gt;not&lt;&#x2F;em&gt; including a transaction that eventually is not surfaced by any IL, then they may elect to leave it out to preserve space for other transactions. However, the builder would then also forego a sum corresponding to the entire collective rewards by paying out such bribes to the includers. In the setup where the priority fee is distributed to includers if they surface a transaction, the builder would thus need to forego the entire priority fee it stands to receive.&lt;&#x2F;p&gt;
&lt;p&gt;However, due to the gradual construction of the aggregate IL, the builder can offer higher bribes than 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; to the last remaining includers, to keep some transactions not yet included out of the IL aggregate. The last remaining includer that spots a late transaction might be able to choose between including it to receive 1&#x2F;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt; of the priority fee, or to receive 1&#x2F;2 of a conditional priority fee as a bribe to not include it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications-for-the-auction-and-transaction-format&quot;&gt;Alternative specifications for the auction and transaction format&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;omit-the-new-transaction-format-with-its-added-ranking-fee-field&quot;&gt;Omit the new transaction format with its added ranking fee field&lt;&#x2F;h4&gt;
&lt;p&gt;Existing transaction formats are ranked using &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;. This may be sufficiently expressive, with the new transaction type omitted. The benefit is that it simplifies the UX. Transactors may not care about how much they have to pay to specifically cover the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt;—they have already specified how much they are willing to pay for inclusion in total with the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;. It also simplifies the developer experience, since we do not need to change the transaction format.&lt;&#x2F;p&gt;
&lt;p&gt;A potential downside is that transactors cannot differentiate between how high contention fees they are willing to pay to cover the base fee and to cover the marginal ranking fee in full blocks. The builder has some control over the marginal ranking fee: if there are transactions outside of the ILs that are willing to pay a higher fee for inclusion than the IL transactions, then it may or may not elect to include those transactions. This influences the marginal ranking fee which is determined by the highest offered ranking fee of an excluded IL transaction. It is more difficult for the builder to control the base fee. Transactors wishing to limit their ranking fees, while at the same time giving ample room for the base fee to rise before inclusion, may therefore find that older transaction formats do not offer sufficient expressiveness.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pay-as-you-bid-auction&quot;&gt;Pay-as-you-bid auction&lt;&#x2F;h4&gt;
&lt;p&gt;Two alternative pay-as-you-bid auction designs will now be highlighted. The first is that transactors always pay their offered ranking fee upon inclusion. In this case, there is no risk that the includers or the builder engineer contention for blockspace to drive up the price, and the full ranking fee is distributed to includers instead of being burned, using the collective method previously described. The post-execution check stays the same as in the main specification, with the only difference that the check on outranked IL transactions concerning the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; (dashed line in the figure) is removed.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction processing is altered to, e.g., facilitate payment to includers. The split between the specified &lt;code&gt;max_ranking_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; can be done in two ways. Either the ranking fee takes precedence over the priority fee as previously, or the two are given equal precedence. In the first case, the same strategy as in the main specification can be used. In the second case, the two fees can first be summed into a single &lt;code&gt;max_payout_fee_per_gas&lt;&#x2F;code&gt;, and the capped &lt;code&gt;payout_fee_per_gas&lt;&#x2F;code&gt; then distributed proportionally to the size of the original max ranking&#x2F;priority fees.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the builder is given the ability to set a &lt;code&gt;priority_fee_shift_per_gas&lt;&#x2F;code&gt; parameter for each transaction to allow transactions without a sufficient &lt;code&gt;ranking_fee_per_gas&lt;&#x2F;code&gt; to become eligible for inclusion in the block. We can envision a scenario where the builder otherwise integrates deeper with transactors to help them set the optimal ranking fee anyway. Such an integration could have detrimental effects on the builder competitive landscape, and it is therefore desirable to allow the builder—who has the last look when building blocks—to raise the ranking fee as it sees fit in a trustless manner. This means that many transactors will elect to just provide a priority fee, and that there is limited downside for transactors using older transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;If a transactor believes that the builder may leave their transactions out of the block, then it is still well served by providing a ranking fee and propagating the transaction publicly so that it can be surfaced by an IL. The builder needs to boost all transactions up to the ranking fee of the transaction it wishes to exclude from the block, and a modest ranking fee can therefore be sufficient to ensure inclusion. The spec shows the ranking fee taking precedence and omits some overflow checks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; After this existing check...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..Optionally shift a proportion of the priority fee over to the ranking fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..then fill in order of: base fee, ranking fee, priority fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_shifted_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_shifted_ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; inclusion_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..after refunding the transactor as normal, the includer fee is computed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    includer_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..balances of the `IL_COMMITTEE_SIZE` includers increased&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;includer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; includer_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..and the priority fee is distributed to the builder just as in EIP-1559&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The consensus layer (CL) constructs a list of execution-layer (EL) payout addresses for the slot, ordered by IL committee index, and provides it to the EL via a new engine API call: &lt;code&gt;engine_setIncluderPayoutsV1&lt;&#x2F;code&gt;. For committee members with &lt;code&gt;0x00&lt;&#x2F;code&gt; credentials, the CL inserts the zero address &lt;code&gt;0x000...&lt;&#x2F;code&gt;, thus burning these rewards.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pay-as-you-bid-auction-using-only-priority-fee&quot;&gt;Pay-as-you-bid auction using only priority fee&lt;&#x2F;h4&gt;
&lt;p&gt;A second alternative is to let the priority fee act as a ranking fee in a pay-as-you-bid auction. The priority fee is distributed collectively to includers if it was surfaced by at least one inclusion list. Otherwise it is distributed to the builder. &lt;em&gt;Only&lt;&#x2F;em&gt; priority fees distributed to the includers count towards the transaction&#x27;s ranking.&lt;&#x2F;p&gt;
&lt;p&gt;The builder specifies whether an included transaction was surfaced by an IL via a bitfield &lt;code&gt;IL_transaction&lt;&#x2F;code&gt; in the payload body, of equal length to the number of transactions. For all transactions where &lt;code&gt;IL_transaction[i]=FALSE&lt;&#x2F;code&gt;, the attesters check that they are not in any observed timely ILs, and otherwise return &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt;. For these transactions, the builder can also apply the &lt;code&gt;priority_fee_shift_per_gas&lt;&#x2F;code&gt; described in the previous subsection, which however here is the same for all transactions since none have an initial ranking fee. Under &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, transaction processing is changed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Processing begins after this existing line&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Redistribute priority fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;IL_transaction&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;TRUE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;priority_fee_shift_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The fee given to each includer (small division remainder burned)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    includer_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ranking_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increase the balances of the `IL_COMMITTEE_SIZE` includers &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;IL_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;includer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; includer_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Proposer receives the priority fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Payout to includers uses the same CL construction as in the previous subsection and the check on the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; (dashed line in the figure) is once again removed.&lt;&#x2F;p&gt;
&lt;p&gt;If the ranking was based on the priority fee paid to the builder, the builder could offer kickbacks, allowing transactors to achieve a high ranking for free. To prevent this, the ranking portion of the fee must be distributed to a wider set of validators or be burned. Any arbitrary fee split between the builder and includers when &lt;code&gt;IL_transaction[i]=FALSE&lt;&#x2F;code&gt; would likely prove suboptimal and encourage off-chain agreements and builder–includer integration to circumvent the intended mechanism.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;allow-builder-to-shift-priority-fee-under-upil&quot;&gt;Allow builder to shift priority fee under UPIL&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;priority_fee_shift_per_gas&lt;&#x2F;code&gt; could be used also in the main UPIL specification. The primary rationale is that transactions using older formats then also can be included when &lt;code&gt;marginal_ranking_fee_per_gas&amp;gt;0&lt;&#x2F;code&gt;, by having the builder reallocate the priority fee. Another option is to simply charge all base fees and ranking fees jointly for all transactions at the end of the block, as previously discussed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;upil-batch-auctions&quot;&gt;UPIL batch auctions&lt;&#x2F;h4&gt;
&lt;p&gt;A more extensive modification of the protocol is to make use of the improved CR and pricing of intra-block contention to eliminate the slack in the block, targeting 100% of the gas limit to facilitate scaling. The base fee can in such an implementation either be removed entirely, or the price information obtained via the marginal ranking fee can be relied upon for appropriate increases to the base fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Transactions using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; transaction formats can with this change spend up to their entire &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; to cover the &lt;code&gt;marginal_ranking_fee_per_gas&lt;&#x2F;code&gt; in blocks with high contention. Previously, the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; could only be consumed by the &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; (which grows slowly each block) or the &lt;code&gt;priority_fee_per_gas&lt;&#x2F;code&gt; (which can be explicitly capped). A user setting &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; to twice the current &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt;, while using a negligible &lt;code&gt;priority_fee_per_gas&lt;&#x2F;code&gt;, may be surprised to see the entire &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; consumed directly in the next block. However, this also implies that contention was high, and that they may have needed to spend the entire &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; for inclusion a few blocks later anyway. Importantly, the total fee paid will never exceed the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; the user originally authorized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not allow the builder to control which transactions that go into the block, with implications on CR and MEV. To retain full control over the block&#x27;s content, the builder would have to bribe includers to not surface unwanted transactions. A concern then is that the builder bribes includers to not surface transactions, such that it can build the most profitable block, by excluding unwanted transactions. However, even if all includers were to be willing to forgo their duty to uphold CR if there is a profit to be made, the profit from surfacing transactions in the IL against a fee would reasonably be higher than whatever bribe a competitive builder is able to pay; especially if some includers have already taken the bribe, making remaining IL space more valuable. The option otherwise remains to distribute the marginal ranking fee to includers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for ML-DSA signature verification</title>
        <published>2025-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Renaud Dubois</name><uri>https://github.com/rdubois-crypto</uri>
	</author>
	
	<author>
		<name>Simon Masson</name><uri>https://github.com/simonmasson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8051/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8051-ml-dsa-verification/25857" />
        

        <id>https://wg-eips.ritovision.com/8051/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8051"
            label="EIP-8051" />
        

        
        

        
        <summary type="html">Precompiled contracts for FIPS-204 ML-DSA signature verification and an EVM-optimized variant</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8051/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds precompiled contracts that perform signature verifications using the NIST module-lattice signature scheme. Two instantiations are supported:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ML-DSA&lt;&#x2F;strong&gt; — NIST-compliant version using SHAKE256 (FIPS-204),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;ML-DSA-ETH&lt;&#x2F;strong&gt; — EVM-optimized version for cheaper on-chain verification:
&lt;ul&gt;
&lt;li&gt;Uses Keccak-based PRNG instead of SHAKE256 (leverages native KECCAK256 precompile)&lt;&#x2F;li&gt;
&lt;li&gt;Stores public-key polynomial &lt;code&gt;t1&lt;&#x2F;code&gt; in the NTT domain to skip one NTT during verification (convertible to regular encoding offline)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Two precompile contracts are specified:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VERIFY_MLDSA&lt;&#x2F;code&gt; — verifies a ML-DSA signature compliant to FIPS-204.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERIFY_MLDSA_ETH&lt;&#x2F;code&gt; — verifies a ML-DSA-ETH signature replacing SHAKE256 with a more efficient hash function, deviating from FIPS-204.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Quantum computers pose a long-term risk to classical cryptographic algorithms. In particular, signature algorithms based on the hardness of the Elliptic Curve Discrete Logarithm Problem (ECDLP) such as secp256k1, are widely used in Ethereum and threatened by quantum algorithms. This exposes potentially on-chain assets and critical infrastructure to quantum adversaries.&lt;&#x2F;p&gt;
&lt;p&gt;Integrating post-quantum signature schemes is crucial to future-proof Ethereum and other EVM-based environments. It shall be noted that infrastructure for post-quantum signatures should be deployed before quantum adversaries are known to be practical because it takes on the order of years for existing applications to integrate.&lt;&#x2F;p&gt;
&lt;p&gt;Dilithium, a lattice-based scheme standardized by NIST as FIPS-204, offers high security against both classical and quantum adversaries. As the main winner of the standardization, the scheme has been selected as the main alternative to elliptic curve signature algorithms, making it a serious option for Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;While the signature size (2.4kB) and public key size (1.3kB) are larger than other post-quantum candidates such as Falcon FN-DSA, this scheme is more flexible in terms of parameters. It is thus possible to derive a zero-knowledge version of Dilithium, keeping the security of the scheme together with an efficient in-circuit verification. This EIP does not dig into the details of this instance.&lt;&#x2F;p&gt;
&lt;p&gt;ML-DSA has a simpler signer algorithm than FN-DSA, making hardware implementation easier.
Finally, ML-DSA is based on the same mathematical construction as Kyber, the Post-Quantum Key Exchange algorithm standardized by NIST as FIPS-203.
All these properties make ML-DSA well-suited for blockchain applications.&lt;&#x2F;p&gt;
&lt;p&gt;In the context of the Ethereum Virtual Machine, a precompile for Keccak256 hash function is already available, making ML-DSA verification much faster when instantiated with an extendable output function derived from Keccak than with SHAKE256, as specified in NIST submission. This EIP specifies two versions of ML-DSA enabling two important features: one version being fully compliant with the NIST specification, the other deviating in encodings to reduce the gas cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The following specification provides two precompiled contracts:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Precompiled contract&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;1&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;2&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Name&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VERIFY_MLDSA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;VERIFY_MLDSA_ETH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Address&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;0x12&lt;&#x2F;td&gt;&lt;td&gt;0x13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Gas cost&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;4500&lt;&#x2F;td&gt;&lt;td&gt;4500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;While ML-DSA can be instantiated for three security levels: NIST level II, III and IV, this EIP only covers NIST level II, corresponding to 128 bits of security.&lt;&#x2F;p&gt;
&lt;p&gt;For the two variants of ML-DSA of this EIP, the following parameters are fixed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Polynomial degree: &lt;code&gt;n = 256&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Field modulus: &lt;code&gt;q = 8380417&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Matrix dimensions: &lt;code&gt;k=4&lt;&#x2F;code&gt;, &lt;code&gt;l=4&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Bounds of rejection: &lt;code&gt;γ_1 = 2¹⁷&lt;&#x2F;code&gt;, &lt;code&gt;γ_2 = (q-1)&#x2F;88&lt;&#x2F;code&gt;, &lt;code&gt;β = 78&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Additional parameters: &lt;code&gt;η = 2&lt;&#x2F;code&gt;, &lt;code&gt;τ = 39&lt;&#x2F;code&gt;, &lt;code&gt;d = 13&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These parameters strictly follow NIST. More precisely, &lt;code&gt;q&lt;&#x2F;code&gt;, &lt;code&gt;n&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt;, &lt;code&gt;l&lt;&#x2F;code&gt; and &lt;code&gt;η&lt;&#x2F;code&gt; are chosen in order to ensure a hard MLWE related problem, and the remaining parameters are chosen for the hardness of MSIS as well as for the efficiency of the scheme. The parameter &lt;code&gt;β = τ * η = 78&lt;&#x2F;code&gt; is the norm bound used in the rejection condition &lt;code&gt;||z||_∞ &amp;lt; γ_1 - β&lt;&#x2F;code&gt; for the ML-DSA-44 parameter set in FIPS-204.&lt;&#x2F;p&gt;
&lt;p&gt;In terms of storage, ML-DSA public key can be derived by the verifier, making the overall public key of 1312 bytes. However, this increases the verifier cost, making the on-chain verification too expensive from a practical point of view. In this EIP, the verification algorithm takes the public key in raw format, meaning that the storage for the public key is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The full matrix &lt;code&gt;A_hat&lt;&#x2F;code&gt; of 16 384 bytes,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tr&lt;&#x2F;code&gt; is stored in order to save one hash, with 32 bytes,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;t1&lt;&#x2F;code&gt; is stored in the NTT domain in order to save one NTT, with 4096 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The overall storage for the &lt;strong&gt;public key&lt;&#x2F;strong&gt; is &lt;strong&gt;20512 bytes&lt;&#x2F;strong&gt;. The signature follows the same format as specified in FIPS-204: 32 bytes for &lt;code&gt;c_tilde&lt;&#x2F;code&gt;, 2304 bytes for the coefficients of &lt;code&gt;z&lt;&#x2F;code&gt;, and 84 bytes for &lt;code&gt;h&lt;&#x2F;code&gt;. In total, a &lt;strong&gt;signature&lt;&#x2F;strong&gt; requires &lt;strong&gt;2420 bytes&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sub-algorithms-of-ml-dsa&quot;&gt;Sub-algorithms of ML-DSA&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;number-theoretic-transform&quot;&gt;Number Theoretic Transform&lt;&#x2F;h4&gt;
&lt;p&gt;Polynomial arithmetic is computed efficiently using Number Theoretic Transform (NTT). Efficient polynomial multiplication can be implemented following the draft NTT EIP. NTT inverse cost is roughly the same as an NTT: $n\log(n)$ additions and $n&#x2F;2 \log(n)$ multiplications over the field $\mathbb F_q$, where $q=8380417$ and $n=256$.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extendable-output-function&quot;&gt;EXtendable Output Function&lt;&#x2F;h4&gt;
&lt;p&gt;The verification algorithm requires an eXtendable Output Function (XOF) made from a hash function.
This EIP provides two instantiations of a XOF:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHAKE256 is the XOF provided in NIST submission, a sponge construction derived from SHA256. Extracting bytes using SHAKE256 calls the &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; permutation as described in Section 3.7 of FIPS-204. While this construction is standardized, it is expensive when computed in the Ethereum Virtual Machine because &lt;code&gt;Keccak_f&lt;&#x2F;code&gt; has no EVM opcode.&lt;&#x2F;li&gt;
&lt;li&gt;Keccak-PRNG is a XOF that is build from a counter-mode PRNG based on Keccak256. Generating new chunks of bytes requires an incrementing counter, as described in NIST SP800-90A revision 1. This XOF has the same interface as SHAKE256, but requires a &lt;code&gt;flip()&lt;&#x2F;code&gt; function that initiate a counter to &lt;code&gt;0&lt;&#x2F;code&gt;. Then, the &lt;code&gt;squeeze&lt;&#x2F;code&gt; function outputs as many bytes as needed using a counter mode as specified in SP800-90A revision 1. A precompile of &lt;code&gt;Keccak256&lt;&#x2F;code&gt; is available in the Ethereum Virtual Machine, making this XOF very efficient in the EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;hints-in-ml-dsa&quot;&gt;Hints in ML-DSA&lt;&#x2F;h4&gt;
&lt;p&gt;ML-DSA requires some hint computation. More precisely, the function &lt;code&gt;use_hint&lt;&#x2F;code&gt; must be implemented following Algorithm 40 of FIPS-204. The output hint is a polynomial with coefficients in {0,1}. Another function &lt;code&gt;sum_hint&lt;&#x2F;code&gt; is required, and counts the number of non-zero values of the hint.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sample-in-ball-challenge&quot;&gt;Sample In Ball Challenge&lt;&#x2F;h4&gt;
&lt;p&gt;In ML-DSA, a challenge is computed using a XOF.
This algorithm &lt;code&gt;sample_in_ball&lt;&#x2F;code&gt; outputs a polynomial with τ small coefficients (in {-1,1}).
The values of the coefficients as well as the position in the coefficients list is obtained using the XOF, as specified in Algorithm 29 of FIPS-204.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ml-dsa-verification-algorithm&quot;&gt;ML-DSA verification algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;Verifying a ML-DSA signature follows Algorithm 8 of FIPS-204, with &lt;code&gt;A_hat&lt;&#x2F;code&gt; of the public key stored in expanded format, and &lt;code&gt;t1&lt;&#x2F;code&gt; stored in the NTT domain.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VERIFY_MLDSA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    A_hat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; properly&lt;&#x2F;span&gt;&lt;span&gt; encoded&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; shake_256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sample_in_ball&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; τ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; computed in the NTT domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; three NTTs for c and z, and t1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; one final inverse NTT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Az_minus_ct1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; A_hat&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    w_prime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;use_hint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Az_minus_ct1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;γ_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; check_norm_bound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; γ_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; β&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; c_tilde&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; shake_256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; w_prime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;ml-dsa-eth-verification-algorithm&quot;&gt;ML-DSA-ETH verification algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;The verification of ML-DSA-ETH signatures follows the same algorithm with another hash function, with two differences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;t1&lt;&#x2F;code&gt; from the public key is stored in the NTT domain in order to save one NTT. The multiplication by &lt;code&gt;2^d&lt;&#x2F;code&gt; is also precomputed. Note that this change can be seen as a change of representation.&lt;&#x2F;li&gt;
&lt;li&gt;A variant of &lt;code&gt;sample_in_ball&lt;&#x2F;code&gt; is defined using KeccakPRNG. The only difference from Algorithm 29 of FIPS-204 is that it requires a &lt;code&gt;flip()&lt;&#x2F;code&gt; between lines 3 and 4 so that it initializes the counter to &lt;code&gt;0&lt;&#x2F;code&gt; before starting squeezing. Note that this can be implemented in &lt;code&gt;absorb()&lt;&#x2F;code&gt; and &lt;code&gt;squeeze()&lt;&#x2F;code&gt; so that the same interface can be used as in SHAKE256.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; VERIFY_MLDSA_ETH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    A_hat&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt; are&lt;&#x2F;span&gt;&lt;span&gt; decoded&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; properly&lt;&#x2F;span&gt;&lt;span&gt; encoded&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak_prng&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sample_in_ball_keccak_prng&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;c_tilde&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; τ&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; computed in the NTT domain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; two NTTs for c and z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; one final inverse NTT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Az_minus_ct1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; A_hat&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; t1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    w_prime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;use_hint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Az_minus_ct1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;γ_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; check_norm_bound&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; γ_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; β&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; c_tilde&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; keccak_prng&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;μ&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; w_prime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;required-checks-in-ml-dsa-eth-verification&quot;&gt;Required checks in ML-DSA(-ETH) verification&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The hint &lt;code&gt;h&lt;&#x2F;code&gt; needs to be properly encoded. The malformation of the hint is specified in Algorithm 21 of FIPS-204.&lt;&#x2F;li&gt;
&lt;li&gt;The element &lt;code&gt;z&lt;&#x2F;code&gt; must have a norm satisfying &lt;code&gt;||z||_∞ &amp;lt; γ_1 - β&lt;&#x2F;code&gt;. The norm &lt;code&gt;||.||_∞&lt;&#x2F;code&gt; is defined page 6 of FIPS-204.&lt;&#x2F;li&gt;
&lt;li&gt;The final hash output must be equal to the signature bytes &lt;code&gt;c_tilde&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;precompiled-contract-specification&quot;&gt;Precompiled contract specification&lt;&#x2F;h3&gt;
&lt;h3 id=&quot;ml-dsa-precompiled-contract&quot;&gt;ML-DSA precompiled contract&lt;&#x2F;h3&gt;
&lt;p&gt;The precompiled contract VERIFY_MLDSA is proposed with the following input and outputs, which are big-endian values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input data&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;32 bytes for the message&lt;&#x2F;li&gt;
&lt;li&gt;2420 bytes for ML-DSA signature&lt;&#x2F;li&gt;
&lt;li&gt;20512 bytes for the ML-DSA expanded public key&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output data&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the algorithm process succeeds, it returns 1 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;li&gt;If the algorithm process fails, it returns 0 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;error-cases&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Insufficient gas has been provided.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid input length (not compliant to described input)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ q)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid norm  bound&lt;&#x2F;li&gt;
&lt;li&gt;Invalid hint check&lt;&#x2F;li&gt;
&lt;li&gt;Signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ml-dsa-eth-precompiled-contract&quot;&gt;ML-DSA-ETH precompiled contract&lt;&#x2F;h3&gt;
&lt;p&gt;The precompiled contract VERIFY_MLDSA_ETH is proposed with the following input and outputs, which are big-endian values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Input data&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;32 bytes for the message&lt;&#x2F;li&gt;
&lt;li&gt;2420 bytes for ML-DSA-ETH signature&lt;&#x2F;li&gt;
&lt;li&gt;20512 bytes for the ML-DSA-ETH expanded public key&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output data&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;If the algorithm process succeeds, it returns 1 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;li&gt;If the algorithm process fails, it returns 0 in 32 bytes format.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;error-cases-1&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Insufficient gas has been provided.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid input length (not compliant to described input)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ q)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid norm  bound&lt;&#x2F;li&gt;
&lt;li&gt;Invalid hint check&lt;&#x2F;li&gt;
&lt;li&gt;Signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;precompiled-contract-gas-usage&quot;&gt;Precompiled contract gas usage&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of the &lt;strong&gt;VERIFY_MLDSA&lt;&#x2F;strong&gt; and &lt;strong&gt;VERIFY_MLDSA_ETH&lt;&#x2F;strong&gt; functions is dominated by the call to the NTTs, and the required hash calls for sampling in the ball (and for μ and the final check).
It represents in average 5 calls to the hash function. Taking linearly the cost of keccak256, and avoiding the context switching it represents 4500 gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compliance-with-eip-7932&quot;&gt;Compliance with EIP-7932&lt;&#x2F;h3&gt;
&lt;p&gt;In compliance with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;,  the necessary parameters and structure for its integration are provided. &lt;code&gt;ALG_TYPE = 0xD1&lt;&#x2F;code&gt;  uniquely identifies ML-DSA transactions, set MAX_SIZE = 2441 bytes to accommodate the fixed-length signature_info container, and recommend a &lt;code&gt;GAS_PENALTY&lt;&#x2F;code&gt; of approximately &lt;code&gt;3000&lt;&#x2F;code&gt; gas subject to benchmarking. The verification function follows the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; model, parsing the signature_info, recovering the corresponding Dilithium public key, verifying the signature against the transaction payload hash, and deriving the signer&#x27;s Ethereum address as the last 20 bytes of keccak256(pubkey). This definition ensures that ML-DSA can be cleanly adopted within the &lt;code&gt;AlgorithmicTransaction&lt;&#x2F;code&gt; container specified by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xD1 for ML-DSA (NIST-compliant version),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0xD2 for ML-DSA-ETH (EVM-friendly version),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ML-DSA signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2420&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak256(pubkey)[12:]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the format of EIP-7932:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the NIST-compliant version:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2441&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2441&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;D1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; VERIFY_MLDSA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;For the EVM-friendly version:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2441&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;      =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;    =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2421&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2441&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;D2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookup_pubkey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; VERIFY_MLDSA_ETH&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The ML-DSA scheme was selected as a NIST-standardized post-quantum cryptographic algorithm due to its strong security guarantees and efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;ML-DSA is a signature algorithm build from lattice-based cryptography. Specifically, its hardness relies on the Short Integer Solution (SIS) problem and the Learning With Errors (LWE) problem, which is believed to be hard for both classical and quantum computers.&lt;&#x2F;p&gt;
&lt;p&gt;ML-DSA (based on CRYSTALS-Dilithium) offers a strong balance between security, efficiency, and practicality compared to classical ECC and other post-quantum schemes. Its signature and key sizes remain reasonably small, making it practical for real-world deployments such as Ethereum blockchain. As the main winner of the NIST PQC standardization process, it benefits from a broad community consensus on its security, which is not yet the case for many alternatives. Moreover, its lattice-based structure allows flexible parameter tuning, making it easier to adapt for specialized contexts like zero-knowledge proofs. Schemes like Falcon (FN-DSA, another signature scheme built on top of lattice-based assumptions) have a more rigid parameterization, making zero-knowledge circuits larger, and thus proof computation more expensive.&lt;&#x2F;p&gt;
&lt;p&gt;Given the increasing urgency of transitioning to quantum-resistant cryptographic primitives or even having them ready in the event that research into quantum computers speeds up.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A set of test vectors for verifying implementations is located in a separate file (see explanations in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8051&#x2F;assets&#x2F;README&#x2F;&quot;&gt;this file&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The file &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8051&#x2F;.&#x2F;assets&#x2F;mldsa_nist.rsp&quot;&gt;&lt;code&gt;mldsa_nist.rsp&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; containing the NIST submission KAT file for security level II.&lt;&#x2F;li&gt;
&lt;li&gt;The file &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8051&#x2F;.&#x2F;assets&#x2F;mldsa_evm.rsp&quot;&gt;&lt;code&gt;mldsa_evm.rsp&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; containing test vectors for the EVM-friendly version with the same format as NIST.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation is the NIST submission code for ML-DSA. A reference implementation is provided by ZKNOX for the EVM-friendly version ML-DSA-ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The derivation path to obtain the private key from the seed is (tbd).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State-access gas cost update</title>
        <published>2025-10-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8038/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8038-state-access-gas-cost-update/25693" />
        

        <id>https://wg-eips.ritovision.com/8038/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8038"
            label="EIP-8038" />
        

        
        

        
        <summary type="html">Increases the gas cost of state-access operations to reflect Ethereum’s larger state</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8038/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP updates the gas cost of state-access operations to reflect Ethereum&#x27;s larger state and the consequent slowdown of these operations. It raises the base costs for &lt;code&gt;GAS_STORAGE_UPDATE&lt;&#x2F;code&gt;, &lt;code&gt;GAS_COLD_SLOAD&lt;&#x2F;code&gt;, and &lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt; and updates the access cost for &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;. The design coordinates with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;: before EIP-8032, parameters assume worst-case contract size; after EIP-8032, they assume worst-case up to &lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt;, with additional depth-based scaling beyond.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The gas price of accessing state has not been updated for quite some time. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; was included in the Berlin fork in March 2021 and raised the costs of state-accessing opcodes. Yet, since then, Ethereum&#x27;s state has grown significantly, thus deteriorating the performance of these operations. This proposal further raises state access costs to better align them with the current performance of state access operations, in relation to other operations.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; have the same access cost as &lt;code&gt;BALANCE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;. However, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; require two database reads - first to load the account object (which includes the &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt; and &lt;code&gt;storageRoot&lt;&#x2F;code&gt;), and second to collect the required information (the code size and bytecode respectively). Therefore, the access cost of &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; should be higher when compared with the other account read operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, the following parameters of the gas model are renamed:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;New name&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_STORAGE_UPDATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following parameters of the gas model are updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Current value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;New value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Increase&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Operations affected&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,100&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,600&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes, &lt;code&gt;BALANCE&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_STORAGE_CLEAR_REFUND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4,800&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,900&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ext-family-update&quot;&gt;&lt;code&gt;EXT*&lt;&#x2F;code&gt; family update&lt;&#x2F;h3&gt;
&lt;p&gt;Besides these parameter changes, the gas cost formula for &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; is updated to include an additional &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;benchmarking&quot;&gt;Benchmarking&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal does not yet have finalized numbers. To achieve this, we require stateful benchmarks, which are currently in development. Once we collect that data, we will set the final numbers.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;special-case-for-extcodesize-and-extcodecopy&quot;&gt;Special case for &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Differently from other account read operations, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; make two reads to the database. The first read is the same, where the object of the target account is loaded. This object includes the account&#x27;s &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt; and &lt;code&gt;storageRoot&lt;&#x2F;code&gt;. Then, these operations do another read to collect either the code size or the bytecode of the account. This second read is to an already warmed account, and thus we propose to price it as &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; for consistency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-with-eip-8032&quot;&gt;Interaction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt; proposes modifying the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; cost formula to account for the storage size of a contract. This is a more accurate method for pricing storage writes. It allows writes to smaller contracts to be cheaper than writes to large contracts, which helps with scaling and is fairer to users. However, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt; is not yet scheduled for inclusion in a fork, and, as such, this proposal considers two cases for setting the values of &lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt; and &lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;. In this case, we set the parameters assuming a worst-case contract size, which makes state-accessing operations more expensive, independently of the contract size.&lt;&#x2F;li&gt;
&lt;li&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;. In this case, we set the parameters assuming the worst-case until &lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt;, which is the parameter in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt; that triggers the depth-based cost. This means that contract sizes below the threshold have the same access costs, while contracts above the threshold get exponentially more expensive with increasing size.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;interaction-with-eip-2926&quot;&gt;Interaction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt; proposes to change how code is store in the state trie. One of the changes of this proposal is to include the code size as a new field in the account object (&lt;code&gt;codeSize&lt;&#x2F;code&gt;). With this change, the code size can be directly accessed with a single read to the database and thus &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; should maintain its previous cost formula, without including the additional &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-with-eip-7928&quot;&gt;Interaction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; introduces Block-Level Access Lists, which enable parallel disk reads, parallel transaction validation, and executionless state updates through client optimizations. The initial benchmarks won&#x27;t take into consideration these optimizations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new state access cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new state access cost values.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Changing the cost of state access operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adaptive state cost to cap growth &amp; scale L1</title>
        <published>2025-10-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8075/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8075-adaptive-state-cost-to-cap-growth-scale-l1/26450" />
        

        <id>https://wg-eips.ritovision.com/8075/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8075"
            label="EIP-8075" />
        

        
        

        
        <summary type="html">Track state bytes and target 250 MiB&#x2F;day by dynamically adjusting the state gas cost. Exempt state from the gas limit to facilitate scaling.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8075/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP precisely caps state growth while at the same time facilitating between 50%-300% more non-state operations per block compared to when solely raising the state gas cost. The cap is achieved by tracking state creation and having a dedicated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; style fee market mechanism set the cost, to target 250 MiB per day. To preserve the existing transaction format and EVM execution patterns, state is still priced in gas during transaction processing. The state creation gas cost is updated every block, adjusting slowly so that users can set reasonable gas limits. The byte-level harmonization of state creation operations provided by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; is then still applied. To facilitate scaling, state creation and regular gas have separate limits, but a normalized aggregate gas is used when calculating the base fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum is currently focused on scaling the layer 1, with a rapid expansion of the block gas limit foreseen in the near-term from compute and memory optimization, as well as via headliner proposals &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt;. Unfortunately, if the gas cost for state creation is kept fixed, state would likely expand in line with an expanding gas limit. As client database sizes increase, degradation in performance is expected. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; addresses state growth by harmonizing current state creation costs according to how many bytes they add to the state. It also increases the gas cost of state creation significantly, by between 3x and 9.5x per operation.&lt;&#x2F;p&gt;
&lt;p&gt;It can be assumed that increased gas costs will somewhat keep state from expanding in line with the increased gas limit. However, since the price-elasticity of demand for state creation is unknown, it is impossible to say exactly what the effect would be. Users may not be particularly sensitive to the increased state gas costs and still continue to purchase state relative to other resources similar to present usage patterns, given that the overall base fee may also fall from the increased gas limit. This would have two effects:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;State would continue to expand by a higher rate than desired.&lt;&#x2F;li&gt;
&lt;li&gt;Under equilibrium, well over 50% of all consumed gas may be spent on state. As further analyzed in the Rationale, a possible equilibrium outcome is 78.5% under current usage pattern and 64.7% even if users only create half as many state bytes for every gas they spend on other operations, relative to today. This impedes scaling under the current one-dimensional fee market, because state gas crowds out gas that can be used for other resources such as compute.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To confidently target some specific state growth, it is necessary to dynamically vary the price of state creation according to its usage. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; mechanism is then particularly suitable. This proposal tracks &lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt; each block and keep a running counter of &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;. When &lt;code&gt;state_bytes_created - state_bytes_cleared&lt;&#x2F;code&gt; exceeds the target, &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; increases, resulting in an increase to the gas charged per state byte. Users should not need to attach excessive margins to the transaction gas limit without risking transactions failure, and the gas charged per state byte is thus set to vary very moderately between blocks, at 0.1% at the very most.&lt;&#x2F;p&gt;
&lt;p&gt;To not impede scaling when a higher gas is charged per state byte, it is necessary to exempt state gas from the block gas limit. This is achieved by tracking the &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt; separately, having a separate limit for each. To ensure that the base fee still prices usage across all resources, the base fee update still operates on a normalized aggregate of both. Thus, the smooth shift in the gas charged per state byte can be understood as a separate control mechanism for pricing state &lt;em&gt;relative&lt;&#x2F;em&gt; to all other operations, facilitating good load-balancing over time. It is however not a mechanism that prices state creation in isolation—the base fee still applies to all resources.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The full specification is available &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;commit&#x2F;d64f82b18db8c0ae35f3c56e1762ace9d83ba578&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Four constants have a similar role as in EIP-4844.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;36_418_000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;36_400&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2 * TARGET_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_STATE_GAS_PER_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;380&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt; is chosen so that a block that uses &lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt; can increase state_gas_per_byte by at most 0.1%. It was computed as &lt;code&gt;(MAX_STATE_BYTES_PER_BLOCK - TARGET_STATE_BYTES_PER_BLOCK) &#x2F; ln(1.001)&lt;&#x2F;code&gt;, rounded to the nearest thousand.&lt;&#x2F;p&gt;
&lt;p&gt;The number of bytes assigned to each state operation follows EIP-8037.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CODE_DEPOSIT_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NEW_ACCOUNT_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STORAGE_SET_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;112&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_AUTH_BASE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;23&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with three new 64-bit unsigned integer fields.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; is the number of state bytes that were created in the current block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt; is the number of state bytes that were cleared in the current block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; is a running total of state bytes created in excess of the target, prior to the block. Blocks with above-target state bytes creation increase this value, blocks with below-target state bytes creation decrease it (bounded at 0).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The header sequence of the new fields is &lt;code&gt;[..., TBD, state_bytes_created, state_bytes_cleared, excess_state_bytes]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also rename the &lt;code&gt;gas_used&lt;&#x2F;code&gt; field to &lt;code&gt;regular_gas_used&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;regular_gas_used&lt;&#x2F;code&gt; is the regular gas used in the block, ignoring gas spent on state creation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;evm-gas-accounting&quot;&gt;EVM gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;During processing, the protocol tracks &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt; separately, and returns the aggregate &lt;code&gt;gas_used&lt;&#x2F;code&gt; accounting for refunds, similar to today. Furthermore, &lt;code&gt;regular_gas_used&lt;&#x2F;code&gt; (without refunds to satisfy &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7778&#x2F;&quot;&gt;EIP-7778&lt;&#x2F;a&gt;) is returned to count against the block limit. Finally, the protocol also tracks &lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt;, allowing for a more accurate tracking of the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;. These are returned in the list &lt;code&gt;state_bytes(created, cleared)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;computing-the-state-gas-per-byte&quot;&gt;Computing the state gas per byte&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol keeps track of &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;, and computes the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; from that variable (referred to as &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; in EIP-8037). The same update mechanism as in EIP-4844 is applied.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_STATE_GAS_PER_BYTE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_state_bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STATE_GAS_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt; is set so that the maximum increase in &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; is 0.1%, when a block consumes &lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt;. The &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; has a floor of &lt;code&gt;MIN_STATE_GAS_PER_BYTE&lt;&#x2F;code&gt;, corresponding to EIP-8037 when scaled down to a 60M block gas limit. The &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; are updated as in EIP-4844, but accounting for both created and cleared state bytes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_state_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_state_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deficit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_STATE_BYTES_PER_BLOCK&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; deficit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; deficit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;updating-state-gas-costs-for-the-block&quot;&gt;Updating state gas costs for the block&lt;&#x2F;h3&gt;
&lt;p&gt;The block level gas cost for each state operation is computed as &lt;code&gt;GAS_STATE_OPERATION = STATE_OPERATION_BYTES * state_gas_per_byte&lt;&#x2F;code&gt;. For completeness, the function below specifies this for all operations:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_state_op_costs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_CREATE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;             =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CREATE_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_CODE_DEPOSIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;       =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODE_DEPOSIT_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_NEW_ACCOUNT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;        =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_ACCOUNT_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    GAS_STORAGE_SET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;        =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STORAGE_SET_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    PER_EMPTY_ACCOUNT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_EMPTY_ACCOUNT_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    PER_AUTH_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;     =&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_AUTH_BASE_BYTES&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;base-fee-update-rule&quot;&gt;Base fee update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The base fee is updated by aggregating the regular gas and &quot;normalized state gas&quot;, where a net change of &lt;code&gt;MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;code&gt; corresponds to the block&#x27;s gas limit, thus giving state gas the same range as regular gas. The change is still restricted to the range ±12.5%. When not conditioning against negative values, the &lt;code&gt;gas_used_delta&lt;&#x2F;code&gt; used in the base fee update can for the EIP-1559 mechanism thus be computed as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    normalized_state_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_cleared&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;regular_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; normalized_state_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;block-validation&quot;&gt;Block validation&lt;&#x2F;h3&gt;
&lt;p&gt;The transaction&#x27;s &lt;code&gt;gas_used&lt;&#x2F;code&gt; is computed as the sum of &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt; and includes refunds, similar to how &lt;code&gt;gas_used&lt;&#x2F;code&gt; is applied today. The &lt;code&gt;regular_gas_used&lt;&#x2F;code&gt; is returned without refunds, which the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; cumulative gas at the block level accounts for. We also keep track of the cumulative &lt;code&gt;state_bytes_created&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_cleared&lt;&#x2F;code&gt; in the vector &lt;code&gt;state_bytes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that the excess state bytes was updated correctly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_state_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_excess_state_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the per-block state_gas_per_byte and update state-op gas costs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_state_op_costs&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_gas_per_byte&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_bytes_cleared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transaction execution returns a gas_used vector and refund_vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; regular_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The gas refund stays the same, the transaction gas counter only counts regular gas without refunds&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; regular_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the total state bytes created and cleared in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; state_bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state_bytes_cleared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; state_bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure the net state bytes created are within the per-block limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_STATE_BYTES_PER_BLOCK&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure state_bytes_created and state_bytes_cleared matches header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_created&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state_bytes_cleared&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_bytes_cleared&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;potential-concerns-with-current-eip-8037&quot;&gt;Potential concerns with current EIP-8037&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-8037 sets a fixed price of 1900 gas per byte, which can lead to a range of outcomes, depending on, e.g., the price-elasticity of demand for state creation. A specific concern is that since EIP-8037 counts state gas against the regular block gas limit, it may impede scaling, when users consume relatively more state gas at the higher gas per byte charged after the change. EIP-8037 assumes that users will spend 30% of all gas on state gas, just as today, even if the state gas per state byte is increased close to tenfold. This assumption may not hold.&lt;&#x2F;p&gt;
&lt;p&gt;Ideally, an increase in the gas cost for state creation will lead users and developers to reduce usage of these operations, relative to other operations. As an example, some may opt to use an existing ETH address instead of creating a new one for each CEX withdrawal. However, given that state creation is a rather fundamental part of interacting with a blockchain, it is reasonable to suspect that many other usage patterns remain as today. Furthermore, an increase in the gas limit as Ethereum scales is associated with a general drop in the base fee. Thus, even if state creation becomes relatively more expensive than other operations, the reduced base fee may mean that users do not take notice to the extent that is desired.&lt;&#x2F;p&gt;
&lt;p&gt;Assume that 30% of all consumed gas is state gas at 60M gas limit, producing 102 GiB in state growth per year (286 MiB&#x2F;day). Then scale the L1 by $5x$ up to a 300M gas limit and increase the gas cost for state creation by $8.5x$ (using account creation in EIP-8037 as a reference point), while usage patterns do not change. The equilibrium outcome is then that $100 \times 0.3 \times 8.5 &#x2F; (0.3 \times 8.5 + 0.7) = 78.5%$ of all gas is spent on state. Even though Ethereum scaled the gas limit by $5x$, the real achieved scaling is only $5 \times (1 - 0.785) &#x2F; 0.7 = 1.54x$, and state growth is 157 GiB per year (440 MiB&#x2F;day).&lt;&#x2F;p&gt;
&lt;p&gt;The first example assumes no change in usage behavior and illustrates a general effect that might take place, but somewhat less pronounced. Assume instead that usage patterns indeed change, and that users create half as many state bytes for every gas they spend on other operations, in comparison to how they interact with Ethereum today. In this case, the equilibrium outcome is that $100 \times (0.3 \times 8.5 \times 0.5) &#x2F; (0.3 \times 8.5 \times 0.5 + 0.7) = 64.7%$ of all gas is spent on state. When scaling the gas limit by $5x$, the real achieved scaling is $5 \times (1 - 0.647) &#x2F; 0.7 = 2.52x$, and state growth is 129 GiB per year (363 MiB&#x2F;day).&lt;&#x2F;p&gt;
&lt;p&gt;Exempting state from the gas limit applied to regular gas—as proposed in this EIP—would produce a $7.14x$ in scaling (for non-state operations). We would thus achieve close to three times as much throughput as achieved in the example where users halve their state purchases relative to other operations (because they would still spend 64.7% of all available gas on state creation).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-specifications&quot;&gt;Alternative specifications&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative solutions would ideally adhere to the principles outlined in this EIP, specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is necessary to exempt state from the aggregated regular gas limit, and assign state its own limit. Otherwise, as the gas cost for state is increased, the reduction in gas remaining for other operations will impede scaling.&lt;&#x2F;li&gt;
&lt;li&gt;It is not possible to guarantee some specific state expansion just by altering gas costs, given that the price-elasticity of demand is unknown. For this reason, it is desirable to set the cost of state independently and according to its usage. At the same time, a fixed increase in the state gas cost will always help in reducing state consumption to some extent, but there is then also always a risk of overshooting.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;multidimensional-subfee-market&quot;&gt;Multidimensional subfee market&lt;&#x2F;h4&gt;
&lt;p&gt;One variant is to expand the transaction format, using a separate &lt;code&gt;regular_gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;state_byte_limit&lt;&#x2F;code&gt; while removing the current &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. At the beginning of processing a transaction, the protocol computes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; regular_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; state_gas_per_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; state_byte_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;All further processing is applied as if the transaction had specified the computed &lt;code&gt;gas_limit&lt;&#x2F;code&gt; in the first place. This ensures that users do not need to risk having a transaction fail if the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; drifts significantly between submission and execution, if they set a tight &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. They simply specify how much regular gas they will use and how many state-bytes they will add, which then implies a certain &lt;code&gt;gas_limit&lt;&#x2F;code&gt; at execution time. The idea has certain similarities with the &quot;aggregated gas&quot; concept explored in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;, but the separate fee here influences how much gas that a resource consumes, hence the name &quot;Multidimensional subfee market&quot;. A benefit of the approach is that it offers perfect control over state growth while there is no fee-drift that can make a transaction fail. A downside is that the transaction format must be updated. It would be possible to move to a multidimensional subfee market at a later stage, after first implementing this proposal.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-gas-metering&quot;&gt;Multidimensional gas metering&lt;&#x2F;h4&gt;
&lt;p&gt;It is possible to try to achieve the stated goals with multidimensional gas metering of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;. The difference between the proposal and the EIP-8011 mechanism is that the latter would not have a separate price for state. It uses the &lt;code&gt;max&lt;&#x2F;code&gt; of the gas consumption among resources for the base fee update. The base fee update may thus for example be set either from the &lt;code&gt;regular_gas&lt;&#x2F;code&gt; or the &lt;code&gt;state_gas&lt;&#x2F;code&gt;, depending on which that is used the most in the block. This means that there is less control over state growth due to the interaction between resources. When another resource consumes the most gas, it will also set the price for state.  When state is the most consumed resource, it might raise the price for other resources to a level where scaling is impeded. These types of interactions can be optimized by careful tuning of limits, targets and gas costs, although whatever setting that is decided on may never be fully satisfactory. The benefit is that the gas cost set for state can be fixed, while state still is &quot;exempted&quot; from the regular gas limit, since it only influences the base fee in parallel via the &lt;code&gt;max&lt;&#x2F;code&gt; operation. Thus scaling is mostly preserved.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, it is possible to use the &lt;code&gt;max&lt;&#x2F;code&gt; of the gas consumption among resources for the base fee update, while still retaining the separate EIP-4844 mechanism for the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt;. This just represents another way to update the base fee, instead of the aggregation proposed here.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market-with-aggregate-gas&quot;&gt;Multidimensional fee market with aggregate gas&lt;&#x2F;h4&gt;
&lt;p&gt;The multidimensional fee market with aggregate gas specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt; could be applied without changing the transaction format. The gas cost for state creation is fixed and users set a single &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. The fee for the gas for state creation is however completely separate in &lt;code&gt;fee_per_state_gas&lt;&#x2F;code&gt;, instead of being folded into the gas cost through conversion. Users set a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; as today and the total fee they are willing to pay is computed as &lt;code&gt;max_fee = max_fee_per_gas * gas_limit&lt;&#x2F;code&gt;. This fee is compared with the fee determined during execution: &lt;code&gt;fee_per_state_gas * state_gas + base_fee_per_gas * regular_gas&lt;&#x2F;code&gt;. The benefit is that the gas cost cannot drift between transaction submission and execution, while the transaction format still stays the same. The downside is that if a users sets a tight &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, then the builder cannot be sure before execution whether the fee covers the cost of the transaction. The user would need to set a more permissive &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; that covers the higher of &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;fee_per_state_gas&lt;&#x2F;code&gt; to provide full guarantees.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;combination-with-multidimensional-gas-metering&quot;&gt;Combination with multidimensional gas metering&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP works well with a broader adoption of full multidimensional gas metering, as proposed in EIP-8011, if we at the same time also adopt the EIP-8011 mechanism for updating the base fee, as suggested previously. We would then expand the &lt;code&gt;gas_used_per_resource&lt;&#x2F;code&gt; vector to track also the other resources in separation. State would still be treated differently in that it has its own &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; cost derived from the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt;, whereas other resources are priced directly via the base fee. The metering approach of EIP-8011 is then applied to set the base fee. Given that state is increasingly becoming the major resource contraint (and thus pricing constraint) as we try to limit its usage, it is particularly beneficial that this EIP would allow the EIP-8011 metering to only be applied to the remaining resources. This is likely to benefit scaling further. Note further that the special treatment of the &lt;code&gt;code_deposit_gas&lt;&#x2F;code&gt; proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; would not be necessary with this proposal, because the constraint on state bytes per block is more moderate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The gas consumed by state creation operations will slowly change so that state growth is maintained at a desirable level. The speed of that drift is tuned by adjusting the &lt;code&gt;STATE_GAS_UPDATE_FRACTION&lt;&#x2F;code&gt;. This constant must be set to a level where UX concerns are mitigated. Specifically, the main concern is that if a transaction sets a very tight &lt;code&gt;gas_limit&lt;&#x2F;code&gt; while consuming state bytes, then that &lt;code&gt;gas_limit&lt;&#x2F;code&gt; may be exceeded, if the &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; cost derived from the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; shifts between submission and execution. The transaction would thus fail. Wallets must first fetch the &lt;code&gt;excess_state_bytes&lt;&#x2F;code&gt; and compute &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt;, just as for the &lt;code&gt;blob_base_fee&lt;&#x2F;code&gt; (and &lt;code&gt;base_fee&lt;&#x2F;code&gt;) today. They know how many &lt;code&gt;state_bytes&lt;&#x2F;code&gt; that are created from each op-code of the transaction via the constants inherited from EIP-8037, e.g., &lt;code&gt;NEW_ACCOUNT_BYTES = 112&lt;&#x2F;code&gt;. They then simply add a margin &lt;code&gt;m&lt;&#x2F;code&gt; when computing the &lt;code&gt;gas_limit&lt;&#x2F;code&gt; set for the transaction: &lt;code&gt;gas_limit = regular_gas_limit + state_bytes * state_gas_per_byte * m&lt;&#x2F;code&gt;. The margin is tuned to the variation in &lt;code&gt;state_gas_per_byte&lt;&#x2F;code&gt; that is expected before execution, at the upper limit. The wallet may of course add some margin to their estimate for the &lt;code&gt;regular_gas_limit&lt;&#x2F;code&gt; of other op-codes as well when computing the &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. The difference to the alternative &quot;Multidimensional subfee market&quot; outlined previously is thus that the wallet does not send a &lt;code&gt;regular_gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;state_bytes_limit&lt;&#x2F;code&gt; separately, and instead combine them in order to preserve the current transaction format.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Wallets must have a margin when they set the &lt;code&gt;gas_limit&lt;&#x2F;code&gt; so that the transaction does not fail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Creation Gas Cost Increase</title>
        <published>2025-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:29+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Carlos Perez</name><uri>https://github.com/CPerezz</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Łukasz Rozmej</name><uri>https://github.com/LukaszRozmej</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8037/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8037-state-creation-gas-cost-increase/25694" />
        

        <id>https://wg-eips.ritovision.com/8037/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8037"
            label="EIP-8037" />
        

        
        

        
        <summary type="html">Harmonization, increase and separate metering of state creation gas costs to mitigate state growth and unblock scaling</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8037/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal increases the cost of state creation operations, thus avoiding excessive state growth under increased block gas limits. It dynamically sets the unit cost per new state byte at a given block gas limit, by targeting an average state growth of 100 GiB per year based on current network usage. It also introduces an independent metering for state creation costs, thus allowing for increased throughput and for larger contract deployments without being limited by the single transaction gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;State creation does not have a harmonized cost, with different methods incurring varied costs for creating the same size of new state. For instance, while contract deployment only costs 202 gas units per new byte created, new storage slots cost 625 gas units per new byte created. Also, deploying duplicated bytecode costs the same as deploying new bytecode, even though clients don&#x27;t store duplicated code in the database. This proposal establishes a standard to harmonize all state creation operations.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, state growth will become a bottleneck for scaling under higher block limits. As of May 2025, the current database size in a Geth node dedicated to state is ~340 GiB. After the increase in gas limit from 30M to 36M gas units, the median size of new state created each day doubled, from ~102 MiB to ~205 MiB. This results in an annual growth of ~73 GiB per year.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;.&#x2F;assets&#x2F;new_state_added.png&quot; alt=&quot;new_state_added&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The relationship we are seeing in this example is not linear as expected. This is likely due to other factors impacting user behavior. However, all else being equal, we expect a proportional increase in the number of new states created as gas limits increase. At a 60M gas limit (and a proportional increase in new state per day of 1.7x), we would see a daily state growth of ~349 MiB and a yearly state growth of ~124 GiB. Similarly, at a 100M gas limit, the state would grow at a rate of ~553 MiB per day and 197 GiB per year. This level of state growth would give us less than 2.5 years until the size of the state database exceeds the threshold of 650 GiB, at which point nodes will begin experiencing a degradation in performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-parameters&quot;&gt;New parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;TARGET_STATE_GROWTH_PER_YEAR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100 × 1024^3 bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;CPSB_SIGNIFICANT_BITS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;CPSB_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9578&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Besides these fixed parameters, this EIP introduces a dynamic variable that controls the cost per byte of state created for a given block gas limit. The variable is &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; and is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ceil&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2_628_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_STATE_GROWTH_PER_YEAR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shifted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CPSB_OFFSET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bit_length&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shifted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CPSB_SIGNIFICANT_BITS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost_per_state_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;shifted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CPSB_OFFSET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The raw value is the unquantized cost derived from targeting &lt;code&gt;TARGET_STATE_GROWTH_PER_YEAR&lt;&#x2F;code&gt; at 50% average gas utilization (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;#deriving-the-cost-per-byte&quot;&gt;Deriving the cost per byte&lt;&#x2F;a&gt;). Quantization retains the top &lt;code&gt;CPSB_SIGNIFICANT_BITS&lt;&#x2F;code&gt; significant bits after applying &lt;code&gt;CPSB_OFFSET&lt;&#x2F;code&gt;, producing a stepped function that avoids frequent small changes as the gas limit fluctuates (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;#quantization-of-cost-per-state-byte&quot;&gt;Quantization&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-changes&quot;&gt;Parameter changes&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, the following parameters of the gas model are updated. The &quot;New State Gas&quot; column shows the state gas cost (charged to the &lt;code&gt;state_gas&lt;&#x2F;code&gt; dimension), while the &quot;New Regular Gas&quot; column shows additional regular gas costs that accompany the state gas charge.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Current&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;New State Gas&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;New Regular Gas&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;Operations affected&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32,000&lt;&#x2F;td&gt;&lt;td&gt;112 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;9,000 (assuming same as &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, contract creation txs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&#x2F;byte&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;cpsb&lt;&#x2F;code&gt; per byte&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;6 × ceil(len&#x2F;32)&lt;&#x2F;code&gt; (hash cost)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, contract creation txs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;112 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 (already has &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; 9,000)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CALL*&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_STORAGE_SET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20,000&lt;&#x2F;td&gt;&lt;td&gt;32 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2,900 (&lt;code&gt;GAS_STORAGE_UPDATE - GAS_COLD_SLOAD&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;112 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 (included in &lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;EOA delegation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12,500&lt;&#x2F;td&gt;&lt;td&gt;23 × &lt;code&gt;cpsb&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;7,500&lt;&#x2F;td&gt;&lt;td&gt;EOA delegation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where &lt;code&gt;cpsb&lt;&#x2F;code&gt; = &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;. The values assigned to regular gas will be updated based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-TODO-&amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt; regular gas of 7,500 is derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&#x27;s cost analysis, excluding the code deployment cost (now charged as state gas):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Calldata cost: ~1,616 (101 bytes × 16)&lt;&#x2F;li&gt;
&lt;li&gt;Recovering authority address (ecrecover): 3,000&lt;&#x2F;li&gt;
&lt;li&gt;Reading nonce and code of authority (cold access): 2,600&lt;&#x2F;li&gt;
&lt;li&gt;Storing values in already warm account: 200&lt;&#x2F;li&gt;
&lt;li&gt;&lt;del&gt;Code deployment cost: 4,600 (200 × 23)&lt;&#x2F;del&gt; → now in state gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Total regular gas: 1,616 + 3,000 + 2,600 + 200 ≈ 7,500&lt;&#x2F;p&gt;
&lt;p&gt;In addition, &lt;code&gt;GAS_SELF_DESTRUCT_NEW_ACCOUNT&lt;&#x2F;code&gt; is removed and replaced by &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-metering-for-state-creation-costs&quot;&gt;Multidimensional metering for state creation costs&lt;&#x2F;h3&gt;
&lt;p&gt;Besides the parameter changes, this proposal introduces an independent metering for state creation costs. The specification is derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;. However, it only requires two dimensions, namely, &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt;. For state creation operations, the &quot;new state costs&quot; are charged to &lt;code&gt;state_gas&lt;&#x2F;code&gt;, while the &quot;new regular costs&quot; are charged to &lt;code&gt;regular_gas&lt;&#x2F;code&gt;. The costs of all other operations are also charged to &lt;code&gt;regular_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At transaction level, the user pays for both &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt;. The total gas cost of a transaction is the sum of both dimensions. In addition, the transaction gas limit set in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt; only applies to &lt;code&gt;regular_gas&lt;&#x2F;code&gt;, while &lt;code&gt;state_gas&lt;&#x2F;code&gt; is only capped by &lt;code&gt;tx.gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At the block level, only the gas used in the bottleneck resource is considered when checking if the block is full and when updating the base fee for the next block. This gives a new meaning to the block’s gas limit and the block’s gas target, which now corresponds to the maximum gas that can be metered in the bottleneck resource.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-validation&quot;&gt;Transaction validation&lt;&#x2F;h4&gt;
&lt;p&gt;Before transaction execution, &lt;code&gt;calculate_intrinsic_cost&lt;&#x2F;code&gt; returns three values: &lt;code&gt;intrinsic_regular_gas&lt;&#x2F;code&gt;, &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt;, and &lt;code&gt;calldata_floor_gas_cost&lt;&#x2F;code&gt;. State gas components of intrinsic cost (e.g., account creation for contract deployment transactions, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt; charges, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization charges) are included in &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt;. All other intrinsic costs (base transaction cost, calldata, access lists, authorization base costs) are included in &lt;code&gt;intrinsic_regular_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;validate_transaction&lt;&#x2F;code&gt; rejects transactions where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_MAX_GAS_LIMIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;validate_transaction&lt;&#x2F;code&gt; also returns &lt;code&gt;intrinsic_regular_gas&lt;&#x2F;code&gt;, &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt;, and &lt;code&gt;calldata_floor_gas_cost&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-level-gas-accounting-reservoir-model&quot;&gt;Transaction-level gas accounting (reservoir model)&lt;&#x2F;h4&gt;
&lt;p&gt;Since transactions have a single gas limit parameter (&lt;code&gt;tx.gas&lt;&#x2F;code&gt;), gas accounting is enforced through a &lt;strong&gt;reservoir model&lt;&#x2F;strong&gt;, in which &lt;code&gt;gas_left&lt;&#x2F;code&gt; and &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; are initialized as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;intrinsic_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_state_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;regular_gas_budget&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_MAX_GAS_LIMIT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;regular_gas_budget&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; execution_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_gas_reservoir&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; holds gas that exceeds the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt;&#x27;s budget. The two counters operate as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Regular gas&lt;&#x2F;strong&gt; charges deduct from &lt;code&gt;gas_left&lt;&#x2F;code&gt; only.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State gas&lt;&#x2F;strong&gt; charges deduct from &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; first; when the reservoir is exhausted, from &lt;code&gt;gas_left&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;GAS&lt;&#x2F;code&gt; opcode returns &lt;code&gt;gas_left&lt;&#x2F;code&gt; only (excluding the reservoir).&lt;&#x2F;li&gt;
&lt;li&gt;The reservoir is passed &lt;strong&gt;in full&lt;&#x2F;strong&gt; to child frames (no 63&#x2F;64 rule). Unused reservoir is returned to the parent on child completion.&lt;&#x2F;li&gt;
&lt;li&gt;On &lt;strong&gt;exceptional halt&lt;&#x2F;strong&gt;, both &lt;code&gt;gas_left&lt;&#x2F;code&gt; and &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; are set to zero (all gas consumed), consistent with existing EVM out-of-gas semantics. This is not applied to system transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The two counters are returned by the transaction output. Besides the two counters, the EVM also keeps track of &lt;code&gt;execution_state_gas_used&lt;&#x2F;code&gt; and &lt;code&gt;execution_regular_gas_used&lt;&#x2F;code&gt; during transaction execution. &lt;code&gt;state_gas&lt;&#x2F;code&gt; costs are added to &lt;code&gt;execution_state_gas_used&lt;&#x2F;code&gt; while &lt;code&gt;regular_gas&lt;&#x2F;code&gt; costs are added to &lt;code&gt;execution_regular_gas_used&lt;&#x2F;code&gt;. These two counters are also returned by the transaction output.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-gas-used&quot;&gt;Transaction gas used&lt;&#x2F;h4&gt;
&lt;p&gt;At the end of transaction execution, the gas used before and after refunds is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_used_before_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_gas_reservoir&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gas_used_after_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_refund&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The refund cap remains at 20% of gas used.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-level-gas-accounting&quot;&gt;Block-level gas accounting&lt;&#x2F;h4&gt;
&lt;p&gt;At block level, instead of tracking a single &lt;code&gt;gas_used&lt;&#x2F;code&gt; counter, we keep track of two counters, one for &lt;code&gt;state_gas&lt;&#x2F;code&gt; and one for &lt;code&gt;regular_gas&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_regular_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_regular_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_regular_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_state_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_state_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_state_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_regular_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_regular_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_state_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; tx_state_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The block header &lt;code&gt;gas_used&lt;&#x2F;code&gt; field is set to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_regular_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_state_gas_used&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The block validity condition uses this value:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: too much gas used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The base fee update rule is also modified accordingly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sstore-refund-for-slot-restoration&quot;&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; refund for slot restoration&lt;&#x2F;h3&gt;
&lt;p&gt;When a storage slot is set to a non-zero value and then restored to zero within the same transaction (0→X→0 pattern), the following are refunded via &lt;code&gt;refund_counter&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;State gas: &lt;code&gt;32 × cost_per_state_byte&lt;&#x2F;code&gt; (the state creation charge)&lt;&#x2F;li&gt;
&lt;li&gt;Regular gas: &lt;code&gt;GAS_STORAGE_UPDATE - GAS_COLD_SLOAD - GAS_WARM_ACCESS&lt;&#x2F;code&gt; (2,800)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The net cost after refund is &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; (100), consistent with pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; &lt;code&gt;SSTORE&lt;&#x2F;code&gt; restoration behavior. Refunds use &lt;code&gt;refund_counter&lt;&#x2F;code&gt; rather than direct gas accounting decrements, so that reverted frames do not benefit from the refund.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revert-behavior-for-state-gas&quot;&gt;Revert behavior for state gas&lt;&#x2F;h3&gt;
&lt;p&gt;State gas charged for account creation (&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt; to new account, and EOA delegation) is consumed even if the frame reverts — state changes are rolled back but gas is not refunded. This is consistent with pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8037&#x2F;&quot;&gt;EIP-8037&lt;&#x2F;a&gt; behavior where &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; was consumed on revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eip-2780-authorizations&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt; authorizations&lt;&#x2F;h4&gt;
&lt;p&gt;For &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorizations, the intrinsic state gas assumes account creation for each authorization: &lt;code&gt;(112 + 23) × cost_per_state_byte&lt;&#x2F;code&gt; per authorization. When an authorization targets an existing account (no account creation needed), the &lt;code&gt;112 × cost_per_state_byte&lt;&#x2F;code&gt; portion is subtracted from &lt;code&gt;intrinsic_state_gas&lt;&#x2F;code&gt; during authorization processing, before state changes begin.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;receipt-semantics&quot;&gt;Receipt semantics&lt;&#x2F;h4&gt;
&lt;p&gt;Receipt &lt;code&gt;cumulative_gas_used&lt;&#x2F;code&gt; tracks the cumulative sum of &lt;code&gt;tx_gas_used_after_refund&lt;&#x2F;code&gt; (post-refund, post-floor) across transactions, instead of the block&#x27;s &lt;code&gt;gas_used&lt;&#x2F;code&gt;. This means &lt;code&gt;receipt[i].cumulative_gas_used - receipt[i-1].cumulative_gas_used&lt;&#x2F;code&gt; equals the gas paid by transaction &lt;code&gt;i&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-deployment-cost-calculation&quot;&gt;Contract deployment cost calculation&lt;&#x2F;h3&gt;
&lt;p&gt;When a contract creation transaction or opcode (&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;) is executed, gas is charged differently based on whether the deployment succeeds or fails. Given bytecode &lt;code&gt;B&lt;&#x2F;code&gt; (length &lt;code&gt;L&lt;&#x2F;code&gt;) returned by initcode and &lt;code&gt;H = keccak256(B)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;When opcode execution starts:&lt;&#x2F;strong&gt; Always charge &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;During initcode execution:&lt;&#x2F;strong&gt; Charge the actual gas consumed by the initcode execution&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Success path&lt;&#x2F;strong&gt; (no error, not reverted, and &lt;code&gt;L ≤ MAX_CODE_SIZE&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; and persist &lt;code&gt;B&lt;&#x2F;code&gt; under &lt;code&gt;H&lt;&#x2F;code&gt;, then link &lt;code&gt;codeHash&lt;&#x2F;code&gt; to &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Charge &lt;code&gt;HASH_COST(L)&lt;&#x2F;code&gt; where &lt;code&gt;HASH_COST(L) = 6 × ceil(L &#x2F; 32)&lt;&#x2F;code&gt; to compute &lt;code&gt;H&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Failure paths&lt;&#x2F;strong&gt; (REVERT, OOG&#x2F;invalid during initcode, OOG during code deposit, or &lt;code&gt;L &amp;gt; MAX_CODE_SIZE&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Do NOT charge &lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt; or &lt;code&gt;HASH_COST(L)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;No code is stored; no &lt;code&gt;codeHash&lt;&#x2F;code&gt; is linked to the account&lt;&#x2F;li&gt;
&lt;li&gt;The account remains unchanged or non-existent&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;&#x2F;strong&gt; The gas for code deposit (&lt;code&gt;GAS_CODE_DEPOSIT * L&lt;&#x2F;code&gt;) is checked before hash computation. This means that if a deployment runs out of gas, it will fail during the deposit gas check before the hash is computed. This maintains consistency with post-Homestead behavior where any deployment failure (including OOG) reverts all state changes - no account is created, and no gas is charged beyond &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt; and the actual initcode execution cost consumed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Total gas formulas:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SUCCESS_PATH_TOTAL_GAS =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    GAS_CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + initcode_execution_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + (GAS_NEW_ACCOUNT if account is new else 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + GAS_CODE_DEPOSIT * L&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + HASH_COST(L)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FAILURE_PATH_TOTAL_GAS =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    GAS_CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  + initcode_execution_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;create-vs-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; vs &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; already charges for hashing the init code when deriving the address. That cost remains unchanged. The bytecode hash (&lt;code&gt;keccak256(B)&lt;&#x2F;code&gt;) must be computed on success to store the code, incurring &lt;code&gt;HASH_COST(L)&lt;&#x2F;code&gt; as specified above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deriving-the-cost-per-byte&quot;&gt;Deriving the cost per byte&lt;&#x2F;h3&gt;
&lt;p&gt;The variable &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; is a dynamic parameter that depends on the block gas limit. The idea is to have a cost that scales as the block gas limit increases, thus avoiding excessive state growth. To compute this variable, we target a specific state growth per year, which we set to 100 GiB. Then, we assume this growth rate is achieved at an average gas utilization.&lt;&#x2F;p&gt;
&lt;p&gt;With multidimensional metering, blocks can be filled up to 50% of the target for both regular gas and state gas. Thus, we consider that on average, blocks can use half of the entire available gas in the block for state creation. This leads to a total of &lt;code&gt;(gas_limit&#x2F;2) * 7200 * 365&lt;&#x2F;code&gt; gas units used for state creation in a year. Dividing this by the target state growth per year gives us the cost per byte of state created.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;quantization-of-cost-per-state-byte&quot;&gt;Quantization of &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Without quantization, &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; changes by 1 for every ~81,715 change in gas limit, which is 0.13% of the current block gas limit of 60M gas units. This creates unnecessary churn for tooling and gas estimation, since the cost can change almost every block even when the gas limit is relatively stable.&lt;&#x2F;p&gt;
&lt;p&gt;The quantization scheme retains the top 5 significant bits of &lt;code&gt;(raw + CPSB_OFFSET)&lt;&#x2F;code&gt;, zeroes the remaining bits, then subtracts &lt;code&gt;CPSB_OFFSET&lt;&#x2F;code&gt;. This is equivalent to binary floating-point rounding: each power-of-2 band has exactly 16 distinct levels, and the step size doubles at each band boundary while remaining perfectly uniform within a band.&lt;&#x2F;p&gt;
&lt;p&gt;The offset (&lt;code&gt;CPSB_OFFSET = 9578&lt;&#x2F;code&gt;) shifts quantization boundaries away from common gas limit targets. It was chosen by brute-force search over 0–10000 to maximize the minimum distance from any quantization boundary to gas limits from 100M to 1000M (in 50M increments). This prevents &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; from flipping between adjacent values due to small gas limit fluctuations near popular targets. The following table shows the resulting boundary distances:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Gas Limit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Distance to boundary&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Blocks to boundary&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;100M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,174&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4.15%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;42.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;150M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,686&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8.21%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;84.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;200M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,198&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10.24%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;104.8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;250M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,710&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5.28%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;54.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;300M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3,222&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.68%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;17.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;350M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4,246&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.89%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;400M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4,758&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.82%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;28.9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;450M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5,270&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4.32%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;44.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;500M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5,782&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.85%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;29.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;550M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6,294&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11.3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;600M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6,806&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6.63%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;67.8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;650M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;7,830&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.58%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;16.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;700M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;7,830&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3.35%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34.3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;750M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8,854&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3.54%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;36.3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;800M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8,854&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.89%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;850M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;9,878&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;4.80%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;49.1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;900M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10,902&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.02%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;950M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;10,902&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.57%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;26.4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;1000M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11,926&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.55%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;26.2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The worst-case minimum distance is 0.89% of the gas limit (at 350M and 800M). Since the gas limit can deviate from its parent by at most 1&#x2F;1024, &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt; remains stable for at least ~9 consecutive blocks of same-direction gas limit changes at any gas limit in the 100M–1000M range (in 50M increments).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;harmonization-across-state-creation&quot;&gt;Harmonization across state creation&lt;&#x2F;h3&gt;
&lt;p&gt;With the current pricing, the gas cost of creating 1 byte of state varies depending on the method used. The following table shows the various methods and their gas cost per byte. The calculation ignores the transaction intrinsic cost (21k gas units) and the costs of additional opcodes and scaffolding needed to execute such a transaction.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Method&lt;&#x2F;th&gt;&lt;th&gt;What is written&lt;&#x2F;th&gt;&lt;th&gt;Intrinsic gas&lt;&#x2F;th&gt;&lt;th&gt;Bytes → state&lt;&#x2F;th&gt;&lt;th&gt;Gas &#x2F; byte&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Deploy 24kB contract (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; limit)&lt;&#x2F;td&gt;&lt;td&gt;Runtime code + account trie node&lt;&#x2F;td&gt;&lt;td&gt;32,000 CREATE + 200 × 24,576 code deposit = 4,947,200 gas&lt;&#x2F;td&gt;&lt;td&gt;24,688 B&lt;&#x2F;td&gt;&lt;td&gt;~200 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fund fresh EOA with 1 wei&lt;&#x2F;td&gt;&lt;td&gt;Updated account leaf&lt;&#x2F;td&gt;&lt;td&gt;25,000 new account&lt;&#x2F;td&gt;&lt;td&gt;~112 B&lt;&#x2F;td&gt;&lt;td&gt;~223 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Add delegate flag to funded EOA (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;td&gt;23 B (0xef0100‖address) + updated account leaf&lt;&#x2F;td&gt;&lt;td&gt;25,000 PER_EMPTY_ACCOUNT + 12,500 PER_AUTH_BASE + 1,616 calldata - 7,823 refund = ~31,300 gas&lt;&#x2F;td&gt;&lt;td&gt;~135 B&lt;&#x2F;td&gt;&lt;td&gt;~232 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization to empty address&lt;&#x2F;td&gt;&lt;td&gt;23 B (0xef0100‖address) + updated account leaf&lt;&#x2F;td&gt;&lt;td&gt;25,000 PER_EMPTY_ACCOUNT + 12,500 PER_AUTH_BASE + 1,616 calldata = 39,116 gas&lt;&#x2F;td&gt;&lt;td&gt;~135 B&lt;&#x2F;td&gt;&lt;td&gt;~289 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Fill new storage slots (SSTORE 0→x)&lt;&#x2F;td&gt;&lt;td&gt;Slot in storage trie&lt;&#x2F;td&gt;&lt;td&gt;20,000 gas&#x2F;slot&lt;&#x2F;td&gt;&lt;td&gt;32 B&lt;&#x2F;td&gt;&lt;td&gt;625 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;To harmonize costs, we first set the gas cost of a single state byte, &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;, as explained above. This is a dynamic parameter that depends on the block gas limit. Now that we have a standardized cost per byte, we can derive the various costs parameters by multiplying the unit cost by the increase in bytes any given operation creates in the database (i.e., 32 bytes per slot, 112 bytes per account and 23 bytes per authorization).&lt;&#x2F;p&gt;
&lt;p&gt;Note that the fixed cost &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt; for contract deployments assumes the same cost as a new account creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multidimensional-metering&quot;&gt;Multidimensional metering&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal is consistent with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;. However, it only requires two dimensions, namely, &lt;code&gt;regular_gas&lt;&#x2F;code&gt; and &lt;code&gt;state_gas&lt;&#x2F;code&gt;. If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt; is not implemented, a two-dimensional version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt; is still required.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eip-7825-limit-on-contract-size&quot;&gt;EIP-7825 limit on contract size&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt; introduces &lt;code&gt;TX_MAX_GAS_LIMIT&lt;&#x2F;code&gt; (16.7M) as the maximum gas for a single transaction, in particular stipulating &lt;code&gt;tx.gas &amp;lt; TX_MAX_GAS_LIMIT&lt;&#x2F;code&gt;as a validity condition. Were we to continue enforcing this validity condition, with a block limit of 100M gas units, this proposal would limit the maximum contract size that can be deployed to roughly 9.9kB ($\frac{16,777,216 - 21,000 - 5,000,000 - 112 \times 1174}{1174} = 9&#x27;902$). This maximum size would only decrease as we increase the gas limit and the &lt;code&gt;cost_per_state_byte&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To solve this issue, we only apply this gas limit to regular gas, not state gas. Doing so does not weaken the intended scaling effect of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;&quot;&gt;EIP-7825&lt;&#x2F;a&gt;, because regular gas meters all resources that benefit from parallelization. In particular, state growth does not: growing the state always requires writing to disk, a parallelizable operation, but crucially this part of the cost of a state growth operation has to be metered in regular gas, not state gas. In other words, any operation that grows the state should consume both regular gas and state gas, and the regular gas should fully account for all costs other than the long term effect of growing the state.&lt;&#x2F;p&gt;
&lt;p&gt;However, we cannot statically enforce a regular gas consumption of &lt;code&gt;TX_MAX_GAS_LIMIT&lt;&#x2F;code&gt;, while still allowing a higher state gas consumption, because transactions only have a single gas limit parameter, &lt;code&gt;tx.gas&lt;&#x2F;code&gt;. This is solved through a &lt;strong&gt;reservoir model&lt;&#x2F;strong&gt;: at transaction start, execution gas is split into &lt;code&gt;gas_left&lt;&#x2F;code&gt; (capped at &lt;code&gt;TX_MAX_GAS_LIMIT - intrinsic_regular_gas&lt;&#x2F;code&gt;) and a &lt;code&gt;state_gas_reservoir&lt;&#x2F;code&gt; (the overflow). State gas charges draw from the reservoir first, then from &lt;code&gt;gas_left&lt;&#x2F;code&gt; when the reservoir is empty. Regular gas charges draw from &lt;code&gt;gas_left&lt;&#x2F;code&gt; only. Exceeding the regular gas budget behaves identically to running out of gas — no special error is needed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;higher-throughput&quot;&gt;Higher throughput&lt;&#x2F;h4&gt;
&lt;p&gt;Another advantage of metering contract creation separately is that increasing the cost of state creation operation in line with the block limit will not affect the available gas for other operations. This allows for higher throughput, as explained in the original multidimensional gas metering introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;&quot;&gt;EIP-8011&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new floor cost values.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;estimated-price-impacts-at-various-block-gas-limits&quot;&gt;Estimated price impacts at various block gas limits&lt;&#x2F;h3&gt;
&lt;p&gt;Users and dApp developers will experience an increase in transaction costs associated with creating a new state. The next table summarizes the state creation costs for common operations at different block gas limits.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Case&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;cost_per_state_byte&lt;&#x2F;th&gt;&lt;th&gt;Cost of a new account&lt;&#x2F;th&gt;&lt;th&gt;Cost increase&lt;&#x2F;th&gt;&lt;th&gt;Cost of a new slot&lt;&#x2F;th&gt;&lt;th&gt;Cost increase&lt;&#x2F;th&gt;&lt;th&gt;24kB contract deployment&lt;&#x2F;th&gt;&lt;th&gt;Cost increase&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Current cost&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;NA&lt;&#x2F;td&gt;&lt;td&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;NA&lt;&#x2F;td&gt;&lt;td&gt;20,000&lt;&#x2F;td&gt;&lt;td&gt;NA&lt;&#x2F;td&gt;&lt;td&gt;4,947,200&lt;&#x2F;td&gt;&lt;td&gt;NA&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 60M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;662&lt;&#x2F;td&gt;&lt;td&gt;74,144&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;24,084&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;16,357,064&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 100M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1,174&lt;&#x2F;td&gt;&lt;td&gt;131,488&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;40,468&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;28,997,320&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 200M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2,198&lt;&#x2F;td&gt;&lt;td&gt;246,176&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;73,236&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;54,277,832&lt;&#x2F;td&gt;&lt;td&gt;11&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;Proposed cost at 300M block limit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3,222&lt;&#x2F;td&gt;&lt;td&gt;360,864&lt;&#x2F;td&gt;&lt;td&gt;14&lt;&#x2F;td&gt;&lt;td&gt;106,004&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;79,558,344&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We should note that as the block limit increases, the base fee is expected to reduce due to the higher capacity of the network. This reduction in base fee will offset, in part, the costs from state creation operations. Some analysis is needed to quantify this effect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Increasing the cost of state creation operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mispricing-with-respect-to-eth-transfers&quot;&gt;Mispricing with respect to ETH transfers&lt;&#x2F;h3&gt;
&lt;p&gt;One potential concern is the cost of creating a new account (&lt;code&gt;112 × cost_per_state_byte&lt;&#x2F;code&gt; gas units, e.g., 131,488 at a 100M gas limit), compared to transferring ETH to a fresh account (21,000 gas units). With this mismatch, users wishing to create new account are incentivized to first send a normal transaction (costing 21k) to this account to create it, thus avoiding the &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; charge.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;&quot;&gt;EIP-2780&lt;&#x2F;a&gt; solves this mispricing by adding a new component to the intrinsic gas cost of transactions. If a non-create transaction has value &amp;gt; 0 and targets a non-existent account, the &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; is added to intrinsic cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-complexity-in-block-building&quot;&gt;Added complexity in block building&lt;&#x2F;h3&gt;
&lt;p&gt;Optimal block construction becomes more complex, since builders must now balance resource usage across multiple dimensions rather than a single gas metric. Sophisticated builders may gain an advantage by applying advanced optimization techniques, raising concerns about further builder centralization. However, practical heuristics (e.g., greedily filling blocks until one resource dimension saturates) remain effective for most use cases. These heuristics limit centralization pressure by keeping block construction feasible for local and less sophisticated builders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;testing-requirements-for-increasing-block-limits&quot;&gt;Testing requirements for increasing block limits&lt;&#x2F;h3&gt;
&lt;p&gt;With a dynamic cost per byte, every time the block gas limit is increased, clients and testing frameworks need to test for backward compatibility issues. This changes the testing framework for increasing the block limit. A way to mitigate this is to introduce a max cost per byte and do the analysis once on the impact of this max cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Size-Based Storage Gas Pricing</title>
        <published>2025-09-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Carlos Perez</name><uri>https://github.com/CPerezz</uri>
	</author>
	
	<author>
		<name>Matan Prasma</name><uri>https://github.com/KanExtension</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8032/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/the-case-for-eip-8032-in-glamsterdam-tree-depth-based-storage-gas-pricing/25619" />
        

        <id>https://wg-eips.ritovision.com/8032/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8032"
            label="EIP-8032" />
        

        
        

        
        <summary type="html">Makes `SSTORE` gas cost scale with a contract&#x27;s storage size to discourage state bloat.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8032/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a mechanism to dynamically price SSTORE operations based on the storage size of a contract. A new optional &lt;code&gt;storage_count&lt;&#x2F;code&gt; field is added to the account RLP, which tracks the number of storage slots it owns. The gas cost for SSTORE will be augmented by a factor that grows exponentially with this &lt;code&gt;storage_count&lt;&#x2F;code&gt; field, but only after it crosses a predefined activation threshold. This change aims to align the cost of state growth with the long-term burden it places on the network, thereby disincentivizing state bloat.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s state size is a growing concern, as it directly impacts node synchronization times, hardware requirements, and overall network health. The current gas model for storage operations does not fully account for the long-term cost of maintaining state indefinitely. As a result, it remains economically viable to deploy contracts with large storage footprints (“state bloat”), which can be exploited for low-cost data anchoring or spam. This imposes a negative externality on all network participants, who must store and process this data indefinitely.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, the computational and I&#x2F;O costs of creating and updating storage slots scale with the number of storage slots a contract owns. However, the current gas pricing model does not meaningfully increase with storage size. This discrepancy underprices workloads for contracts with very large state and slows down state root computation.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to address the state growth problem by creating a direct economic link between the size of a contract&#x27;s storage and the cost to expand it further. By progressively increasing the price of SSTORE operations in proportion to how much storage a contract already owns, storage write costs become more aligned with the actual work clients perform. Contracts that contribute disproportionately to state growth will face rising costs for additional writes, while small and medium-sized contracts remain unaffected. This mechanism creates a market-based incentive for developers to use onchain storage efficiently, helping mitigate unsustainable state growth over time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants-and-parameters&quot;&gt;Constants and parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Fork activation timestamp&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LIN_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Linear gas cost factor&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;Activation threshold, chosen to be at ~8GB of data.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The address of system contract that holds the information of account transition&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The number of storage slots to iterate per block during the transition process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The number of accounts to iterate per block during the transition process&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-account-field&quot;&gt;New account field&lt;&#x2F;h3&gt;
&lt;p&gt;Account RLP descriptors receive an optional &lt;code&gt;storage_count&lt;&#x2F;code&gt; field, corresponding to the current number of storage slots it contains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-transition&quot;&gt;Account transition&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, the transition is activated.&lt;&#x2F;p&gt;
&lt;p&gt;The transition process involves reading all accounts and count the number of storage slots for accounts with non-empty storage root hashes, which in turn populates the &lt;code&gt;storage_count&lt;&#x2F;code&gt; field in the account.&lt;&#x2F;p&gt;
&lt;p&gt;The progress of the transition is stored at system contract at &lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Storage layout at &lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;slot &lt;code&gt;0x00&lt;&#x2F;code&gt;: &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; (32-byte account hash)&lt;&#x2F;li&gt;
&lt;li&gt;slot &lt;code&gt;0x01&lt;&#x2F;code&gt;: &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt; (32-byte slot hash)&lt;&#x2F;li&gt;
&lt;li&gt;slot &lt;code&gt;0x02&lt;&#x2F;code&gt;: &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; (uint256 count of non-zero slots seen for the current account)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At the &lt;strong&gt;end&lt;&#x2F;strong&gt; of each block, the client performs up to &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; storage slot iterations, possibly spanning one account or multiple accounts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Select account&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If &lt;code&gt;cursor_account_hash == 0x00…00&lt;&#x2F;code&gt;, set it to the smallest account hash that is present in the state trie. Otherwise, continue with &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Iterate storage slots&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If the current account at &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; has a non-empty &lt;code&gt;storageRootHash&lt;&#x2F;code&gt;, visit storage slots of this account in ascending lexicographic order of &lt;code&gt;slot hash&lt;&#x2F;code&gt;, starting &lt;strong&gt;strictly after&lt;&#x2F;strong&gt; &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt; (or from the beginning if &lt;code&gt;cursor_slot_hash == 0x00…00&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increment &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; slot for every slot hash seen&lt;&#x2F;li&gt;
&lt;li&gt;Stop when either:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; slots have been processed, or&lt;&#x2F;li&gt;
&lt;li&gt;there are no more storage slots for the account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Finalize account (if exhausted)&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If all storage slots for &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; have been visited, set &lt;code&gt;storage_count(cursor_account)&lt;&#x2F;code&gt; to &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; in the account object.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; accounts are iterated, then stop iterating.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Else:
&lt;ul&gt;
&lt;li&gt;Advance to the next account:&lt;br &#x2F;&gt;
&lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; = next account hash that is present in the state trie&lt;&#x2F;li&gt;
&lt;li&gt;Reset per-account cursors:&lt;br &#x2F;&gt;
&lt;code&gt;cursor_slot_hash = 0x00…00&lt;&#x2F;code&gt;, &lt;code&gt;cursor_accum = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Persist&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
If either &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; or &lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; is reached, write &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;, &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt;, and &lt;code&gt;cursor_accum&lt;&#x2F;code&gt; to the registry in the post-state of the block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Completion&lt;&#x2F;strong&gt;&lt;br &#x2F;&gt;
The transition is complete when there is no further account present in the trie, with an account hash that is lexicographically greater than the current &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The account hashes and slot hashes are iterated in ascending lexicographical order.&lt;&#x2F;p&gt;
&lt;p&gt;Transition reference: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reorg-semantics&quot;&gt;Reorg semantics&lt;&#x2F;h4&gt;
&lt;p&gt;Chain reorganizations require &lt;strong&gt;no special handling&lt;&#x2F;strong&gt; beyond normal block re-execution. The mechanism is reorg-safe.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;storage_count&lt;&#x2F;code&gt; updates and the transition cursors (&lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;, &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt;, &lt;code&gt;cursor_accum&lt;&#x2F;code&gt;) are ordinary state writes committed in the post-state of each block at &lt;code&gt;TRANSITION_REGISTRY_ADDRESS&lt;&#x2F;code&gt;. On a reorg, these values revert to those of the new canonical ancestor and are re-derived by re-executing blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-update-rules&quot;&gt;Account update rules&lt;&#x2F;h3&gt;
&lt;p&gt;After executing all transactions in a block, clients MUST update &lt;code&gt;storage_count&lt;&#x2F;code&gt; for affected accounts as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;old := storage_count(A)&lt;&#x2F;code&gt; in the block-prestate (treat as &lt;code&gt;0&lt;&#x2F;code&gt; if absent).&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;new&lt;&#x2F;code&gt; be the true count of non-zero slots for &lt;code&gt;A&lt;&#x2F;code&gt; in the post-block state.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;storage_count(A) := new&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To compute &lt;code&gt;new&lt;&#x2F;code&gt; efficiently without scanning all storage every block, clients MUST apply net deltas derived from slots whose values changed relative to the block-prestate:&lt;&#x2F;p&gt;
&lt;p&gt;For each storage slot &lt;code&gt;k&lt;&#x2F;code&gt; of account &lt;code&gt;A&lt;&#x2F;code&gt; that was written at least once in the block:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_storage_delta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;prestate_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; poststate_value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Calculate the storage slot delta based on pre-state and post-state values.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Args:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        prestate_value: Pre-state value of the storage slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        poststate_value: Post-state value of the storage slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        int: Delta value (+1, -1, or 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; prestate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; poststate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot created: empty to non-empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; prestate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; poststate_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot deleted: non-empty to empty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No change in slot occupancy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;During a transition, the transition is advanced &lt;em&gt;first&lt;&#x2F;em&gt; before applying the storage deltas, but &lt;em&gt;after&lt;&#x2F;em&gt; executing all transactions, so the gas costs of a contract that is sweeped by the iterator in this block are only applied for the &lt;em&gt;next&lt;&#x2F;em&gt; block. Update semantics when a transition is occurring:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For accounts that have been iterated (i.e. &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;acc_hash&lt;&#x2F;code&gt; ), all storage deltas are applied.&lt;&#x2F;li&gt;
&lt;li&gt;For accounts that have not been iterated at all (i.e. &lt;code&gt;acc_hash&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt;), none of the storage deltas are applied.&lt;&#x2F;li&gt;
&lt;li&gt;For the account currently being iterated (i.e. &lt;code&gt;cursor_account_hash&lt;&#x2F;code&gt; == &lt;code&gt;acc_hash&lt;&#x2F;code&gt;), storage deltas are applied only to the slots that have already been accounted for (i.e. &lt;code&gt;cursor_slot_hash&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;slot_hash&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;sstore-gas-cost-changes&quot;&gt;SSTORE gas cost changes&lt;&#x2F;h3&gt;
&lt;p&gt;For each contract account &lt;code&gt;A&lt;&#x2F;code&gt;, define &lt;code&gt;S_pre(A)&lt;&#x2F;code&gt; as the value of &lt;code&gt;storage_count(A)&lt;&#x2F;code&gt; in the parent state of the block being executed (pre-state).&lt;&#x2F;p&gt;
&lt;p&gt;For all &lt;code&gt;SSTORE&lt;&#x2F;code&gt;s in the block, implementations MUST use &lt;code&gt;S_pre(A)&lt;&#x2F;code&gt; when computing the gas cost for &lt;code&gt;SSTORE&lt;&#x2F;code&gt;. This value MUST NOT change within the block, regardless of any writes to &lt;code&gt;A&lt;&#x2F;code&gt; during the block.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;storage_count(A)&lt;&#x2F;code&gt; is absent at block start, clients MUST treat &lt;code&gt;S_pre(A) = 0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Rationale: holding &lt;code&gt;S_pre(A)&lt;&#x2F;code&gt; constant within the block keeps gas estimation stable and independent of transaction ordering.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The gas cost of an &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is computed as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;constant_sstore_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LIN_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ceil_log16&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;S_pre&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACTIVATION_THRESHOLD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;impact-on-state-size&quot;&gt;Impact on state size&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;storage_count&lt;&#x2F;code&gt; is RLP-encoded as a minimal-length big-endian byte string (no leading zeros). The per-account overhead is therefore small and not a fixed 32 byte number. The field is present only for accounts with a non-empty storage root hash. If &lt;code&gt;storage_count == 0&lt;&#x2F;code&gt;, the field may be omitted.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Per-account overhead&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Payload length &lt;code&gt;L = bytes_required(storage_count)&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;L = 0&lt;&#x2F;code&gt; for &lt;code&gt;0&lt;&#x2F;code&gt; (field may be omitted entirely)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 1&lt;&#x2F;code&gt; for &lt;code&gt;1 … 255&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 2&lt;&#x2F;code&gt; for &lt;code&gt;256 … 65,535&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 3&lt;&#x2F;code&gt; for &lt;code&gt;65,536 … 16,777,215&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;L = 4&lt;&#x2F;code&gt; for &lt;code&gt;16,777,216 … 4,294,967,295&lt;&#x2F;code&gt; (≈ 4.29B)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;+1 byte&lt;&#x2F;strong&gt; RLP string prefix (since &lt;code&gt;L ≤ 55&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;+ up to 1 byte&lt;&#x2F;strong&gt; for the account-list prefix growth (only if the list’s total payload crosses a size boundary)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For context, at block ~23,000,000 the largest contract has about &lt;strong&gt;80M&lt;&#x2F;strong&gt; storage slots. Even at that scale (&lt;code&gt;L = 4&lt;&#x2F;code&gt;), the per-account addition remains &lt;strong&gt;≤ 6 bytes&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If we pessimistically assume &lt;strong&gt;23,000,000&lt;&#x2F;strong&gt; contract accounts each carry &lt;code&gt;storage_count&lt;&#x2F;code&gt; and each incurs the worst-case &lt;strong&gt;6 bytes&lt;&#x2F;strong&gt;, the upper bound is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;23,000,000 × 6 = 138,000,000&lt;&#x2F;code&gt; bytes ≈ &lt;strong&gt;138 MB&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This is a conservative upper bound. In practice, most contracts have far fewer slots (&lt;code&gt;L ≤ 1–3&lt;&#x2F;code&gt;), so a typical addition is 2–4 bytes per contract. Therefore, the net impact on state size is negligible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The intent is to create friction when growing the state size of a contract, thus limiting the number of such contracts. Going over the limit, some contract developers might want to use another contract to start fresh, which comes at the cost of paying for contract creation, and for any call into the previous instance of the contract.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ACTIVATION_THRESHOLD&lt;&#x2F;code&gt; is chosen to not penalize the contracts that are large, but do provide useful value. The idea is to disincentivize spam contracts that grow larger than useful contracts, the latter being legitimately big due to the value they bring to their users and the wider ecosystem. This means that this constant could be increased as the state grows.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; bounds how many accounts may be finalized (i.e. have their &lt;code&gt;storage_count&lt;&#x2F;code&gt; written) per block during the transition. This prevents excessive write operations per block, reducing write amplification and avoiding large database compactions and associated performance degradation. It complements &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt;, which limits how many &lt;strong&gt;storage slots&lt;&#x2F;strong&gt; are scanned per block in line with the minimal hardware recommendations. In short, &lt;code&gt;TRANSITION_SLOTS_PER_BLOCK&lt;&#x2F;code&gt; bounds read operations, while &lt;code&gt;TRANSITION_MAX_ACCOUNTS&lt;&#x2F;code&gt; bounds write operations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comparison-with-depth-based-pricing&quot;&gt;Comparison with depth-based pricing&lt;&#x2F;h3&gt;
&lt;p&gt;The largest contract observed (XEN) sits around depth 9, meaning its relevant storage keys share a 9-nibble (~4.5 bytes) prefix along their MPT paths. Because the storage key into the trie is &lt;code&gt;keccak256(slot_key)&lt;&#x2F;code&gt;, an attacker can easily calculate the inputs offchain to find hashes and populate all contracts such that they pay the same cost as XEN.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-is-a-transition-needed&quot;&gt;Why is a transition needed?&lt;&#x2F;h3&gt;
&lt;p&gt;If counting began only at &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, every existing contract would start with an implicit &lt;code&gt;storage_count = 0&lt;&#x2F;code&gt; and accrue counts only from &lt;em&gt;new&lt;&#x2F;em&gt; writes. While spammy contracts would quickly accumulate writes and thus incur penalties, this would still misprice the workloads we intend to regulate: large pre-fork contracts would continue paying unscaled base costs until they rewrote a substantial portion of their historical slots. During that period, gas pricing would understate their actual storage footprint.&lt;&#x2F;p&gt;
&lt;p&gt;A deterministic, in-protocol transition avoids this. By iterating existing storage under consensus rules and progressively populating each account’s &lt;code&gt;storage_count&lt;&#x2F;code&gt; in the state, we ensure that storage-size-based pricing reflects reality for &lt;em&gt;all&lt;&#x2F;em&gt; contracts—regardless of whether they write again after the fork. Persisting cursor progress under the state root also makes the process reorg-safe and client-agnostic.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Alternative (pre-fork background counting by clients)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Idea:&lt;&#x2F;strong&gt; Clients begin counting slots before &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;. At activation, they only need to write the final counts into the state for a fixed number of accounts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Pros:&lt;&#x2F;strong&gt; Reduces post-fork iteration work, much faster convergence at fork time since iterating all accounts is faster than all storage slots.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Cons:&lt;&#x2F;strong&gt; Late upgraders, snap-syncing nodes, or nodes that were offline cannot reconstruct pre-fork counts deterministically. This approach has to be coordinated so that all users upgrade their nodes and must finish counting prior to the fork activation. Reorgs have to be handled explicitly too.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;compatibility-with-verkle-binary-unified-tree&quot;&gt;Compatibility with Verkle&#x2F;Binary unified tree&lt;&#x2F;h3&gt;
&lt;p&gt;In the current two-layer MPT, a write to contract storage accesses an account path and then a storage path, and the cost a client pays in trie updates and database reads&#x2F;writes correlates with how deep the storage trie becomes over time.&lt;&#x2F;p&gt;
&lt;p&gt;Under a unified tree, the per-write computational and I&#x2F;O cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; no longer tracks an account’s total number of storage slots. The path length is set by the global tree’s branching factor and height, and by the overall distribution of state keys, not by a single account’s footprint. As a result, progressive pricing based on an account’s slot count can become misaligned with the actual work once a unified tree ships.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibility-with-eip-2926&quot;&gt;Compatibility with EIP-2926&lt;&#x2F;h3&gt;
&lt;p&gt;Because &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt; also requires an account transition to chunkify the bytecode and additional fields, scheduling both EIPs in the same fork enables a single, combined transition. This removes duplicated work, reduces client complexity and the number of tree transitions in the future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found. Making the &lt;code&gt;storage_count&lt;&#x2F;code&gt; field optional ensures that the default count is 0, which means that contract will not be affected by the gas increase before they have been reached by the iterator sweep.&lt;&#x2F;p&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically, RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation when encountering an &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Users and wallets can maintain their usual workflows without modification, as RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MEVless Protocol</title>
        <published>2025-09-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lawliet Chan</name><uri>https://github.com/lawliet-chan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8099/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/mevless-an-anti-mev-protocol/26800" />
        

        <id>https://wg-eips.ritovision.com/8099/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8099"
            label="EIP-8099" />
        

        
        

        
        <summary type="html">A protocol that prevents MEV attacks by constraining transaction ordering through blind sequencing and two-phase block execution.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8099/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces the MEVless protocol, a novel approach to prevent Maximum Extractable Value (MEV) attacks by implementing blind transaction sequencing. The core principle of MEVless is to prevent validators from seeing transaction content during the ordering phase, thereby eliminating the fundamental prerequisite for MEV attacks. The protocol separates block production into two phases: sequencing blocks that order transactions based on transaction hashes without revealing transaction content, and execution blocks that execute transactions in the predetermined order. This design eliminates the ability of miners and validators to perform MEV attacks such as sandwich attacks and front-running by removing their access to transaction content during the critical ordering phase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;MEV attacks, particularly sandwich attacks and front-running, represent a significant threat to blockchain ecosystems, especially in DeFi applications. The fundamental prerequisite for MEV attacks is that validators can see transaction content before ordering, which allows them to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sandwich Attacks&lt;&#x2F;strong&gt;: Insert buy and sell transactions around user transactions to manipulate prices and extract value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Front-running&lt;&#x2F;strong&gt;: Execute similar transactions before users to capture arbitrage opportunities&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Back-running&lt;&#x2F;strong&gt;: Execute transactions after users to benefit from price movements&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Unlike legitimate arbitrage activities that provide liquidity, these attacks are purely extractive and harmful to the ecosystem. They reduce user confidence, increase transaction costs, and can lead to significant financial losses for users.&lt;&#x2F;p&gt;
&lt;p&gt;Current solutions have limitations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Encrypted Mempools&lt;&#x2F;strong&gt;: High computational overhead for encryption&#x2F;decryption&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Private Mempools&lt;&#x2F;strong&gt;: Centralized and not fully decentralized, use trustful instead of trustless.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;PBS (Proposer-Builder Separation)&lt;&#x2F;strong&gt;: Still allows builders to see transaction content and becoming more and more centralized.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The MEVless protocol addresses these issues by fundamentally changing how transactions are ordered, making it impossible for miners to perform MEV attacks while maintaining decentralization and efficiency. By eliminating MEV attacks at the protocol level, DeFi developers can focus on building innovative financial products and user experiences without constantly worrying about MEV protection mechanisms, leading to faster development cycles and more robust applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;protocol-overview&quot;&gt;Protocol Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The MEVless protocol operates on a two-phase block system:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sequencing Blocks&lt;&#x2F;strong&gt;: Order transactions based on transaction hashes and prepayment amounts without revealing transaction content. Sequencing blocks interval can be shorter than execution blocks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution Blocks&lt;&#x2F;strong&gt;: Execute transactions in the predetermined order from sequencing blocks&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;block-types&quot;&gt;Block Types&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;sequencing-blocks&quot;&gt;Sequencing Blocks&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose&lt;&#x2F;strong&gt;: Order transactions and collect prepayments&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Frequency&lt;&#x2F;strong&gt;: Every odd-numbered block height&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operations&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;Receive transaction hashes from users&lt;&#x2F;li&gt;
&lt;li&gt;Collect prepayments (gas fees + optional tips)&lt;&#x2F;li&gt;
&lt;li&gt;Order transactions by prepayment amount (highest first)&lt;&#x2F;li&gt;
&lt;li&gt;Publish ordered transaction sequence as commitment&lt;&#x2F;li&gt;
&lt;li&gt;Store transaction hashes in block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;execution-blocks&quot;&gt;Execution Blocks&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Purpose&lt;&#x2F;strong&gt;: Execute transactions in predetermined order&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Frequency&lt;&#x2F;strong&gt;: Every even-numbered block height&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operations&lt;&#x2F;strong&gt;:
&lt;ul&gt;
&lt;li&gt;Receive transaction content from users&lt;&#x2F;li&gt;
&lt;li&gt;Verify transaction content matches committed hashes&lt;&#x2F;li&gt;
&lt;li&gt;Execute transactions in predetermined order&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transaction-flow&quot;&gt;Transaction Flow&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;phase-1-transaction-submission-and-sequencing&quot;&gt;Phase 1: Transaction Submission and Sequencing&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;User creates transaction and calculates transaction hash&lt;&#x2F;li&gt;
&lt;li&gt;User sends transaction hash to the network with prepayment:
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Base Gas Fee&lt;&#x2F;strong&gt;: Fixed fee for hash storage and sequencing computation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Optional Tip&lt;&#x2F;strong&gt;: Additional payment for priority in sequencing&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Network validates user has sufficient balance for prepayment&lt;&#x2F;li&gt;
&lt;li&gt;Network orders transaction hashes by total prepayment amount (descending)&lt;&#x2F;li&gt;
&lt;li&gt;Network deducts prepayment from user account&lt;&#x2F;li&gt;
&lt;li&gt;Network publishes ordered transaction sequence as commitment&lt;&#x2F;li&gt;
&lt;li&gt;Network stores transaction hashes in sequencing block&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8099&#x2F;.&#x2F;assets&#x2F;MEVless.png&quot; alt=&quot;MEVless Protocol Flow&quot; &#x2F;&gt;
&lt;em&gt;MEVless Protocol Transaction Flow&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;phase-2-transaction-content-submission-and-execution&quot;&gt;Phase 2: Transaction Content Submission and Execution&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;User monitors network for their transaction hash commitment&lt;&#x2F;li&gt;
&lt;li&gt;User submits actual transaction content(including the remaining gasfee) to network&lt;&#x2F;li&gt;
&lt;li&gt;Network receives transaction content during execution block&lt;&#x2F;li&gt;
&lt;li&gt;Network verifies transaction content matches committed hash&lt;&#x2F;li&gt;
&lt;li&gt;Network executes transactions in predetermined order, deduct the remaining fee and 50% of the actual difference between gasUsed and gaslimit for tax ( prevent the gasLimit much more than gasUsed so that validators can entire the whole block to get MEV)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-economics&quot;&gt;Gas Economics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;prepayment-structure&quot;&gt;Prepayment Structure&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Total Prepayment = Base Gas Fee + Optional Tip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Base Gas Fee&lt;&#x2F;strong&gt;: Fixed cost for hash storage and sequencing computation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Optional Tip&lt;&#x2F;strong&gt;: Variable amount for priority in transaction ordering&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;gas-cost-calculation&quot;&gt;Gas Cost Calculation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Sequencing Phase&lt;&#x2F;strong&gt;: Minimal gas cost for hash operations&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Execution Phase&lt;&#x2F;strong&gt;: Standard gas cost for transaction execution&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-blind-sequencing&quot;&gt;Why Blind Sequencing?&lt;&#x2F;h3&gt;
&lt;p&gt;Blind sequencing eliminates the root cause of MEV attacks by preventing miners from seeing transaction content during the critical ordering phase. This approach is more efficient than encryption-based solutions and more decentralized than private mempool approaches.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-phase-blocks&quot;&gt;Why Two-Phase Blocks?&lt;&#x2F;h3&gt;
&lt;p&gt;Separating sequencing and execution allows for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Efficient Ordering&lt;&#x2F;strong&gt;: Hash-based ordering is computationally lightweight&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Network Efficiency&lt;&#x2F;strong&gt;: Small hash data reduces bandwidth requirements&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Commitment Mechanism&lt;&#x2F;strong&gt;: Public ordering commitment prevents manipulation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-random-block-production-is-critical&quot;&gt;Why Random Block Production is Critical?&lt;&#x2F;h3&gt;
&lt;p&gt;Random block production is essential to prevent speculative MEV attacks. When block producers cannot predict when they will be selected to produce blocks, they cannot reliably perform speculative MEV attacks because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unpredictable Selection&lt;&#x2F;strong&gt;: Attackers cannot know if they will be the next block producer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Economic Risk&lt;&#x2F;strong&gt;: Speculative transactions require prepayments that are lost if the attacker is not selected&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Decentralization Amplification&lt;&#x2F;strong&gt;: More validators mean lower individual selection probability, increasing attack costs exponentially&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This protocol will add some RPC methods to support the two-phase block system:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;eth_sendTxHash&lt;&#x2F;strong&gt;: Users submit transaction hashes instead of full transactions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;eth_getTxSequence&lt;&#x2F;strong&gt;: Returns the ordered transaction sequence that is committed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;basic-transaction-flow&quot;&gt;Basic Transaction Flow&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;User submits transaction hash with prepayment&lt;&#x2F;li&gt;
&lt;li&gt;Network orders transaction by prepayment amount&lt;&#x2F;li&gt;
&lt;li&gt;User submits transaction content&lt;&#x2F;li&gt;
&lt;li&gt;Network executes transaction in predetermined order&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;mev-attack-prevention&quot;&gt;MEV Attack Prevention&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Attacker submits transaction hash for sandwich attack&lt;&#x2F;li&gt;
&lt;li&gt;Network orders transaction without revealing content&lt;&#x2F;li&gt;
&lt;li&gt;Attacker cannot see victim transaction content during ordering&lt;&#x2F;li&gt;
&lt;li&gt;Attack fails due to lack of transaction visibility&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The MEVless protocol requires a consensus mechanism with unpredictable block production to prevent speculative MEV attacks. Without unpredictable block production, block producers can perform cost-free speculative MEV attacks by submitting transaction hashes and then deciding whether to submit their transaction content based on other users&#x27; transaction content, thus performing cost-free speculative MEV attacks. Since the prepayment ultimately goes to the block producer themselves, predictable block production allows them to recover their prepayment costs through block fees, making MEV attacks economically viable. Random block production forces attackers to pay prepayments for speculative transactions without knowing if they will be selected to produce the next block, making the prepayment cost real rather than recoverable through block fees, thus making such attacks economically unviable. The anti-MEV effectiveness increases exponentially with network decentralization - more validators mean lower individual selection probability, making attacks economically unviable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>P256 algorithm support</title>
        <published>2025-09-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8030/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-topic-for-eip-8030/25557" />
        

        <id>https://wg-eips.ritovision.com/8030/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8030"
            label="EIP-8030" />
        

        
        

        
        <summary type="html">Adds an EIP-7932 algorithm type for P256 support of type `0x0`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8030/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithm of type &lt;code&gt;0x0&lt;&#x2F;code&gt; for supporting P256 signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;P256 (a.k.a secp256r1) is a widely-used NIST standardized algorithm that already has a presence within the Ethereum codebase. This makes it a great algorithm to write test
cases against implementations of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithmic type with the following parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ALG_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;129&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the precompile cost from [EIP-7951](.&#x2F;07951.md) with 3000 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; subtracted (the cost of the secp256k1 precompile)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    BASE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3900&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate extra overhead for keccak256 hashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        minimum_word_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; minimum_word_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function is a noop as there is no&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; exposed function defined in [EIP-7951](.&#x2F;07951.md)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash if non-standard size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ignore initial alg_type byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is similar to [EIP-2](.&#x2F;00002.md)&amp;#39;s malleability verification.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is defined in [P256Verify Function](#p256verify-function)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;P256Verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;p256verify-function&quot;&gt;&lt;code&gt;P256Verify&lt;&#x2F;code&gt; Function&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;P256Verify&lt;&#x2F;code&gt; function is the logic of the precompile defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7951&#x2F;&quot;&gt;EIP-7951&lt;&#x2F;a&gt;, the only exception is that this function MUST NOT charge any gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-p256&quot;&gt;Why P256?&lt;&#x2F;h3&gt;
&lt;p&gt;P256 or secp256r1, is used globally but (more importantly) has an existing implementation in all execution clients. This allows easy implementation of a known-safe algorithm, which is perfect for a test algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optional Execution Proofs</title>
        <published>2025-09-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri><email>justin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8025/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-optional-execution-proofs/25500" />
        

        <id>https://wg-eips.ritovision.com/8025/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8025"
            label="EIP-8025" />
        

        
        

        
        <summary type="html">Introducing optional execution proofs on the consensus layer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8025/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Optional execution proofs allow beacon nodes to verify the validity of the execution payload within a beacon block without running an execution layer client. The execution proofs are sent over the consensus layer&#x27;s peer-to-peer network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Optional execution proofs reduce the hardware and bandwidth requirements that are needed for an attester to verify a beacon block. Moreover, the cost to verify to a block no longer grows with the gas limit.&lt;&#x2F;p&gt;
&lt;p&gt;Since these are optional, protocol upgrades cannot be based on the improvements in this EIP. This EIP allows us to safely test execution proofs without making it explicitly consensus critical.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This is a consensus layer change only.&lt;&#x2F;p&gt;
&lt;p&gt;Validators will now be able to enable two new modes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;zkEVM Proof generating&lt;&#x2F;li&gt;
&lt;li&gt;Stateless validation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When a proof generating node receives a beacon block, they will create the necessary proofs for the execution payload in the block and re-propagate them on the specified subnets.&lt;&#x2F;p&gt;
&lt;p&gt;When a stateless validating node receives a beacon block, they will check to see if they have already received a valid execution proof for that execution payload from the specified subnet.&lt;&#x2F;p&gt;
&lt;p&gt;The detailed specifications are in the consensus-specs repository.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is backwards compatible and does not require a hardfork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ CompatibleUnion</title>
        <published>2025-08-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8016/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8016-ssz-compatibleunion/25275" />
        

        <id>https://wg-eips.ritovision.com/8016/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8016"
            label="EIP-8016" />
        

        
        

        
        <summary type="html">SSZ type for forward-compatible unions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8016/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; type to represent unions with forward-compatible Merkleization: A given field is always assigned the same stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; across all type options.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Certain types, e.g., transactions, allow multiple variants carving out slightly different feature sets. Merkleization equivalence is still desirable, as it allows verifiers to check common fields across variants. These types should still efficiently deserialize into one of their possible variants corresponding to its known tree shape. In programming languages, this is typically achieved by tagged unions.&lt;&#x2F;p&gt;
&lt;p&gt;If multiple versions of an SSZ container coexist at the same time, for example to represent transaction types, the same field may be assigned to a different gindex in each version. This unnecessarily complicates verifiers and introduces a maintenance burden, as the verifier has to be kept up to date with version specific field to gindex map.&lt;&#x2F;p&gt;
&lt;p&gt;Compatible unions allow only type options to be used that provide stable gindex assignment across all of them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibleunion-selector-type&quot;&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;SSZ composite type&lt;&#x2F;a&gt; is defined:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;compatible union&lt;&#x2F;strong&gt;: union type containing one of the given subtypes with compatible Merkleization
&lt;ul&gt;
&lt;li&gt;notation &lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;, e.g. &lt;code&gt;CompatibleUnion({1: Square, 2: Circle})&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compatible unions are always considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#variable-size-and-fixed-size&quot;&gt;&quot;variable-size&quot;&lt;&#x2F;a&gt;, even when all type options share the same fixed length.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#default-values&quot;&gt;default value&lt;&#x2F;a&gt; is defined as:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Default Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a (error)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following types are considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#illegal-types&quot;&gt;illegal&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion({})&lt;&#x2F;code&gt; without any type options are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; with a selector outside &lt;code&gt;uint8(1)&lt;&#x2F;code&gt; through &lt;code&gt;uint8(127)&lt;&#x2F;code&gt; are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; with a type option that has incompatible Merkleization with another type option are illegal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;compatible-merkleization&quot;&gt;Compatible Merkleization&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Types are compatible with themselves.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;byte&lt;&#x2F;code&gt; is compatible with &lt;code&gt;uint8&lt;&#x2F;code&gt; and vice versa.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Bitlist[N]&lt;&#x2F;code&gt; are compatible if they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Bitvector[N]&lt;&#x2F;code&gt; are compatible if they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt; are compatible if &lt;code&gt;type&lt;&#x2F;code&gt; is compatible and they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Vector[type, N]&lt;&#x2F;code&gt; are compatible if &lt;code&gt;type&lt;&#x2F;code&gt; is compatible and they share the same capacity &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are compatible if &lt;code&gt;type&lt;&#x2F;code&gt; is compatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Container&lt;&#x2F;code&gt; are compatible if they share the same field names in the same order, and all field types are compatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are compatible if all &lt;code&gt;1&lt;&#x2F;code&gt; entries in both type&#x27;s &lt;code&gt;active_fields&lt;&#x2F;code&gt; correspond to fields with shared names and compatible types, and no other field name is shared across both types.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; are compatible with each other if all type options across both &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; are compatible.&lt;&#x2F;li&gt;
&lt;li&gt;All other types are incompatible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;value&lt;&#x2F;code&gt; as &lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; has properties &lt;code&gt;value.data&lt;&#x2F;code&gt; with the contained value, and &lt;code&gt;value.selector&lt;&#x2F;code&gt; which indexes the selected type option.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;selector&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deserialization&quot;&gt;Deserialization&lt;&#x2F;h4&gt;
&lt;p&gt;The deserialization logic is updated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In the case of compatible unions, the first byte of the deserialization scope is deserialized as type selector, the remainder of the scope is deserialized as the selected type.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following invalid input needs to be hardened against:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An out-of-bounds type selector in a &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Incomplete data (less than 1 byte for selector)&lt;&#x2F;li&gt;
&lt;li&gt;Corrupted or malformed serialized data&lt;&#x2F;li&gt;
&lt;li&gt;Invalid serialization of inner types (delegated to inner type deserialization)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;json-mapping&quot;&gt;JSON mapping&lt;&#x2F;h4&gt;
&lt;p&gt;The canonical &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#json-mapping&quot;&gt;JSON mapping&lt;&#x2F;a&gt; is updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;SSZ&lt;&#x2F;th&gt;&lt;th&gt;JSON&lt;&#x2F;th&gt;&lt;th&gt;Example&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;selector-object&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ &quot;selector&quot;: string, &quot;data&quot;: type }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; is encoded as an object with a &lt;code&gt;selector&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; field, where the contents of &lt;code&gt;data&lt;&#x2F;code&gt; change according to the selector.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;SSZ Merkleization specification&lt;&#x2F;a&gt; is extended with a helper function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_selector&lt;&#x2F;code&gt;: Given a Merkle root &lt;code&gt;root&lt;&#x2F;code&gt; and a type selector &lt;code&gt;selector&lt;&#x2F;code&gt; (&lt;code&gt;&quot;uint8&quot;&lt;&#x2F;code&gt; serialization) return &lt;code&gt;hash(root, selector)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Merkleization definitions are extended.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_selector(hash_tree_root(value.data), value.selector)&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is of compatible union type.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-are-compatibleunion-selectors-limited-to-1-127&quot;&gt;Why are &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; selectors limited to &lt;code&gt;1 ... 127&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;Reserving &lt;code&gt;0&lt;&#x2F;code&gt; prevents issues with incomplete initialization, and can possibly be used in a future EIP to denote optionality.&lt;&#x2F;p&gt;
&lt;p&gt;Reserving selectors above &lt;code&gt;127&lt;&#x2F;code&gt; (i.e., highest bit is set) enables future backwards compatible extensions.&lt;&#x2F;p&gt;
&lt;p&gt;The range &lt;code&gt;1 ... 127&lt;&#x2F;code&gt; is sufficient to satisfy current demand.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-field-collections&quot;&gt;Why not field collections?&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative design was explored where the &lt;code&gt;active_fields&lt;&#x2F;code&gt; bitvector was emitted. While that works in principle, it becomes very inefficient to parse when &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; are nested, as the parser cannot immediately determine the overall tree shape. Further, the bitvector makes every single nesting layer variable-length, adding a lot of overhead to the serialized format.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt;, a tag is emitted that tells the parser early on what to expect, including for nested fields.&lt;&#x2F;p&gt;
&lt;p&gt;Note that wrapping a field in a &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; is not a backwards compatible operation. However, new options can be introduced, and existing options dropped, without breaking verifiers. Therefore, &lt;code&gt;CompatibleUnion&lt;&#x2F;code&gt; has to be introduced early on wherever future design extensions are anticipated, even when only a single type option is used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt; is an alternative to an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;earlier union proposal&lt;&#x2F;a&gt;. However, it has only been used in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;specs&#x2F;_deprecated&#x2F;sharding&#x2F;beacon-chain.md&quot;&gt;deprecated specifications&lt;&#x2F;a&gt;. Portal network also uses a union concept for network types, but does not use &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; on them, and could transition to the new compatible union proposal with a new networking version.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt; contains static tests in &lt;code&gt;test_impl.py&lt;&#x2F;code&gt; and &lt;code&gt;test_typing.py&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; releases contain random tests in &lt;code&gt;tests&#x2F;general&#x2F;phase0&#x2F;ssz_generic&lt;&#x2F;code&gt;, generated according to a format defined in &lt;code&gt;tests&#x2F;format&#x2F;ssz_generic&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For &lt;code&gt;CompatibleUnion({selector: type})&lt;&#x2F;code&gt;, the &lt;code&gt;selector&lt;&#x2F;code&gt; mix-in guarantees a unique &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; if multiple type options refer to the same Merkle tree shape, or also if multiple type options solely differ in the element type of a &lt;code&gt;List[type, N]&lt;&#x2F;code&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; field (as the &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; of any empty list does not depend on the &lt;code&gt;type&lt;&#x2F;code&gt;). Without the &lt;code&gt;selector&lt;&#x2F;code&gt;, such cases would either have to be defined as illegal types, or handled by the application logic (e.g., by mixing it into the signing root, or by encoding the element type into a different field).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multidimensional Gas Metering</title>
        <published>2025-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Davide Crapis</name><uri>https://github.com/dcrapis</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8011/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8011-multidimensional-gas-metering/25260" />
        

        <id>https://wg-eips.ritovision.com/8011/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8011"
            label="EIP-8011" />
        

        
        

        
        <summary type="html">Gas accounting by EVM resource, increasing throughput and improving resource usage controls, with minimal changes to the protocol and UX</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8011/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces multidimensional gas metering, changing the way we account for gas used at the block level. This enables Ethereum to increase throughput and better control excessive resource usage, with minimal changes to the protocol and the UX. During transaction execution, gas is metered for each resource dimension, such as compute and state. At the transaction level, everything remains unchanged. A transaction still pays fees according to the sum of gas used across all resources and still has a single gas limit imposed on this same sum. However, at the block level, only the gas used in the bottleneck resource is considered when checking if the block is full and when updating the base fee for the next block. This gives a new meaning to the block&#x27;s gas limit and the block&#x27;s gas target, which now corresponds to the maximum gas that can be metered in the bottleneck resource.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal separates &lt;em&gt;transaction pricing&lt;&#x2F;em&gt; (i.e., the way of measuring consumption of resources by transactions) from &lt;em&gt;block metering&lt;&#x2F;em&gt; (i.e., the way of controlling resource limits and ensure that blocks do not overload the network). More concretely, it introduces a multidimensional metering scheme that accounts for the different EVM resources while keeping the pricing model unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;There are four main benefits of the proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Throughput gains: By decoupling resource limits, blocks can carry transactions that stress distinct resources simultaneously, improving packing efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;Finer-grained control over excessive resource usage: metering gas costs independently for each resource allows us to tailor each operation&#x27;s gas cost to the actual resource limits.&lt;&#x2F;li&gt;
&lt;li&gt;Keeps UX identical: users still specify one &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and see one &lt;code&gt;gas_used&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;li&gt;Simplicity: This simpler metering change lays the groundwork for eventual multidimensional pricing  (such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;) without disrupting the current fee market and with minimal protocol changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;operation-gas-costs&quot;&gt;Operation gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Under the multidimensional metering model, EVM operations are assigned a cost vector whose components correspond to their gas cost on each resource dimension. Each cost has 6 dimensions: &lt;code&gt;gas_cost_vector = (compute_cost, access_cost, size_cost, memory_cost, state_cost, history_cost)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pure-compute-operations&quot;&gt;Pure compute operations&lt;&#x2F;h4&gt;
&lt;p&gt;The operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;compute_ops&#x2F;&quot;&gt;compute_ops&lt;&#x2F;a&gt; are assigned a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; equal to &lt;code&gt;(gas_cost, 0, 0, 0, 0, 0)&lt;&#x2F;code&gt;, where &lt;code&gt;gas_cost&lt;&#x2F;code&gt; is the operation&#x27;s gas cost.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;compute-and-memory-operations&quot;&gt;Compute and memory operations&lt;&#x2F;h4&gt;
&lt;p&gt;The operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;compute_mem_ops&#x2F;&quot;&gt;compute_mem_ops&lt;&#x2F;a&gt; are assigned a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; equal to &lt;code&gt;(compute_cost, 0, 0, memory_cost, 0, 0)&lt;&#x2F;code&gt;, where &lt;code&gt;memory_cost&lt;&#x2F;code&gt; is the operation&#x27;s memory expansion cost (as defined by the function &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;91824145ef62da61803edf9a764fd8f3662794c0&#x2F;src&#x2F;ethereum&#x2F;osaka&#x2F;vm&#x2F;gas.py#L167&quot;&gt;&lt;code&gt;calculate_gas_extend_memory&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) and &lt;code&gt;compute_cost&lt;&#x2F;code&gt; is the operation&#x27;s gas cost minus its memory expansion cost.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;state-operations&quot;&gt;State operations&lt;&#x2F;h4&gt;
&lt;p&gt;The assignment of a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; to the operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;state_ops&#x2F;&quot;&gt;state_ops&lt;&#x2F;a&gt; is TBD, pending benchmarks.
&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;log-operations&quot;&gt;LOG operations&lt;&#x2F;h4&gt;
&lt;p&gt;The assignment of a &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt; to the operations listed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8011&#x2F;assets&#x2F;log_ops&#x2F;&quot;&gt;log_ops&lt;&#x2F;a&gt; is TBD, pending benchmarks.
&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;intrinsic-gas-costs&quot;&gt;Intrinsic gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Under the multidimensional metering model, each transaction&#x27;s intrinsic cost (as defined by the function &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;91824145ef62da61803edf9a764fd8f3662794c0&#x2F;src&#x2F;ethereum&#x2F;osaka&#x2F;transactions.py#L571&quot;&gt;&lt;code&gt;calculate_intrinsic_cost&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) is also assigned 6-dimensional &lt;code&gt;gas_cost_vector&lt;&#x2F;code&gt;. The breakdown of cost by resource dimension is TBD, pending benchmarks.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;Besides replacing the single gas cost with a 6-dimensional cost vector, the gas accounting during block execution also changes. Instead of keeping track of a single total of gas used, the EVM stores a 6-dimensional vector with how much gas units was spent on each resource until that point in the execution.&lt;&#x2F;p&gt;
&lt;p&gt;After executing the ith EVM operation of a transaction, say &lt;code&gt;OP_i&lt;&#x2F;code&gt;, with a cost vector &lt;code&gt;gas_cost_vector_i = (compute_cost_i, access_cost_i, size_cost_i, memory_cost_i, state_cost_i, history_cost_i)&lt;&#x2F;code&gt;, the following variables are updated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remaining available gas for the transaction:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas = gas - sum(compute_cost_i, access_cost_i, size_cost_i, memory_cost_i, state_cost_i, history_cost_i)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Total used gas by the transaction so far:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_used = gas_used + sum(compute_cost_i, access_cost_i, size_cost_i, memory_cost_i, state_cost_i, history_cost_i)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Used gas vector by the transaction so far:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_used_vector = (compute_gas_used + compute_cost_i, access_gas_used + access_cost_i, size_gas_used + size_cost_i, memory_gas_used + memory_cost_i, state_gas_used + state_cost_i, history_gas_used + history_cost_i)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At the transaction level, everything remains the same. A transaction still has the same one-dimensional &lt;code&gt;gas_limit&lt;&#x2F;code&gt;. The transaction&#x27;s out-of-gas condition is still defined as &lt;code&gt;gas_used &amp;lt;= gas_limit&lt;&#x2F;code&gt;. Additionally, the transaction&#x27;s fee is also computed with &lt;code&gt;gas_used&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The key change is the introduction of &lt;code&gt;gas_used_vector&lt;&#x2F;code&gt; as a new variable that tracks the gas used by each resource at the transaction level. This variable is returned by the &lt;code&gt;execute_transaction&lt;&#x2F;code&gt; function, in addition to &lt;code&gt;gas_used&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;block-header-extension&quot;&gt;Block header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with a new 64-bit unsigned integer field named &lt;code&gt;max_gas_metered&lt;&#x2F;code&gt;. This integer corresponds to the total gas units used by the bottleneck resource, i.e., the resource with the largest used gas in the block. This variable is computed as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_block_max_gas_metered&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_gas_used_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_used_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_gas_used_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used_vector&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas_metered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used_vector&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; max_gas_metered&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The header sequence with the new field is &lt;code&gt;[..., parent_beacon_block_root, requests_hash, max_gas_metered]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validity-condition&quot;&gt;Block validity condition&lt;&#x2F;h3&gt;
&lt;p&gt;The block validity conditions are modified to replace &lt;code&gt;block.gas_used&lt;&#x2F;code&gt; with &lt;code&gt;block.max_gas_metered&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_gas_metered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: too much gas used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;base-fee-update-rule&quot;&gt;Base fee update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The block validity conditions are modified to replace &lt;code&gt;parent.gas_used&lt;&#x2F;code&gt; with &lt;code&gt;parent.max_gas_metered&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_gas_metered&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This change is compatible with the various transaction variants, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;,  or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-are-we-choosing-this-resource-split&quot;&gt;Why are we choosing this resource split?&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum’s slot-based structure introduces a strict temporal constraint: all attestations must be processed, aggregated, and propagated within a single slot. This fact makes time a fundamental resource. To maintain network health, validators must execute blocks, validate them, and gossip attestations quickly enough to avoid missed slots and penalties.&lt;&#x2F;p&gt;
&lt;p&gt;Each type of resource contributes differently to this bottleneck:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Execution time affects how quickly validators can process blocks and produce attestations.&lt;&#x2F;li&gt;
&lt;li&gt;Data size influences how long it takes to propagate blocks and blobs across the peer-to-peer network.&lt;&#x2F;li&gt;
&lt;li&gt;Memory usage determines how efficiently nodes can handle concurrent workloads without triggering garbage collection or cache eviction. It also affects the minimum hardware requirements that proposers and attesters must meet to fulfill their responsibilities.&lt;&#x2F;li&gt;
&lt;li&gt;State growth impacts long-term scalability and database performance, especially for archival and full nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, changes in the slot (e.g., Enshrined Proposer-Builder Separation) and changes in the execution model (e.g., Block-level Access Lists) will change how the different resources interact and how they impact the available slot time. Thus, we want to track as many relevant resources as possible in order to allow for future changes to the protocol that may impact resource contribution.&lt;&#x2F;p&gt;
&lt;p&gt;For these reasons, the proposal splits the resources into the following broad categories:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Block Execution Time&lt;&#x2F;strong&gt;: Captures how long it takes to process a block on a single node. This includes:
&lt;ul&gt;
&lt;li&gt;Compute: CPU time spent on each operation.&lt;&#x2F;li&gt;
&lt;li&gt;State Access: Time or count of disk I&#x2F;O operations when accessing the trie (e.g., &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Upload&#x2F;Download Time&lt;&#x2F;strong&gt;: Captures how data size affects network transmission:
&lt;ul&gt;
&lt;li&gt;Block size (call data + transaction &amp;amp; block metadata)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Short-term Memory&lt;&#x2F;strong&gt;: Reflects short-term memory allocation during execution, i.e., RAM usage&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Long-term Storage&lt;&#x2F;strong&gt;: Tracks persistent changes to disk usage. There are two dimensions here:
&lt;ul&gt;
&lt;li&gt;State Growth: Delta in disk size of the state trie before and after execution.&lt;&#x2F;li&gt;
&lt;li&gt;History Growth: Delta in disk space used for historical receipts, logs, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that we are not considering the blob resource (which is part of the Block Upload&#x2F;Download Time) as it is already priced independently.&lt;&#x2F;p&gt;
&lt;p&gt;Based on previous empirical analysis, state growth represented a significant portion of the gas used in Ethereum blocks, accounting for 30.2% of all gas consumed between blocks 22000000 and 22005000. The second resource with the most gas used was compute (26.8%), followed by state access (21.9%). History growth and data had a less relevant contribution, accounting for 9.9% and 6.9% of all the gas used, respectively. Note that the data component in this analysis did not consider blobs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards-compatible and requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;worst-case-blocks-and-excessive-resource-usage&quot;&gt;Worst-case blocks and excessive resource usage&lt;&#x2F;h3&gt;
&lt;p&gt;A concern about metering resources independently is the potential of creating worst-case blocks that put too much pressure on EVM resources. Thus, the cost vectors of each EVM operation need to be carefully set up to avoid this scenario. To this end, we will perform comprehensive benchmarks to measure the resource utilization of each operation and set the gas cost vector accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, state and history growth are not constrained at the block level, but over longer time frames. Increased aggregate gas usage from this proposal may be associated with increase state-growth, assuming that relative gas consumption across resources is not altered significantly under equilibrium. To keep the long-run consumption in check, the gas cost of operations contributing to state and history growth would thus need to be increased.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-fee-manipulation&quot;&gt;Base fee manipulation&lt;&#x2F;h3&gt;
&lt;p&gt;Builders can manipulate the base fee by selectively including or excluding transactions to change the block&#x27;s &lt;code&gt;max_gas_metered&lt;&#x2F;code&gt;. This behavior is already possible with EIP-1559. Yet, multidimensional gas metering compute the base fee on the bottleneck resource instead of the total gas consumed. This allows for blocks that yield the same total fees but with different &lt;code&gt;max_gas_metered&lt;&#x2F;code&gt; values. The extent of this concern is limited by the incentives to maximize fee revenue. While the expected gains of base fee manipulation are smaller than execution rewards, we won&#x27;t observe these attacks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-complexity-in-block-building&quot;&gt;Added complexity in block building&lt;&#x2F;h3&gt;
&lt;p&gt;Optimal block construction becomes more complex, since builders must now balance resource usage across multiple dimensions rather than a single gas metric. Sophisticated builders may gain an advantage by applying advanced optimization techniques, raising concerns about further builder centralization. However, practical heuristics (e.g., greedily filling blocks until one resource dimension saturates) remain effective for most use cases. These heuristics limit centralization pressure by keeping block construction feasible for local and less sophisticated builders.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;censorship-resistance&quot;&gt;Censorship resistance&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP makes it cheaper to fill the block to censor transactions under FOCIL in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt; (as also noted in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7999&#x2F;&quot;&gt;EIP-7999&lt;&#x2F;a&gt;). Specifically, it can be cheaper for a builder to create dummy transaction consuming only one resource to fill the block, taking advantage of the lower base fee under equilibrium. However, given that all resources have the same base fee in this proposal, and that the builder must still fill the block up to the gas limit for at least one resource, the degradation in censorship resistance is fairly moderate, and mainly related to the potentially reduced base fee under equilibrium.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generalized consolidation requests</title>
        <published>2025-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Potuz</name><uri>https://github.com/potuz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8012/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8012-generalized-consolidation-requests/25264" />
        

        <id>https://wg-eips.ritovision.com/8012/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8012"
            label="EIP-8012" />
        

        
        

        
        <summary type="html">Reutilizes the consolidation request contract to pass general messages from the EL to the CL.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8012/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP redefines the field &lt;code&gt;target_pubkey&lt;&#x2F;code&gt; from consolidations requests into a general array of 48 bytes that can be interpreted separately by the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current contract to send consolidation requests is not optimized in that the exact same contract, with the exact same calldata and engine API, can be used to transmit more general messages from the EL to the CL without changes on the EL side. In particular, avoiding any cross layer coordination in the event of an CL hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;As a possible application, we could use the same contract to allow any existing validator to become a builder as in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;NAME&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAGIC_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xEF0A11&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3 byte prefix to all generalized consolidation requests&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;No changes are expected&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer-1&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not establish any changes on the consensus layer, but rather standardizes how consolidation requests are to be treated in the future. When receiving a &lt;code&gt;ConsolidationRequest&lt;&#x2F;code&gt; type object on the consensus layer, the &lt;code&gt;target_pubkey&lt;&#x2F;code&gt; field is to be treated differently. If it coincides with the BLS publick key of an existing active validator in the beacon chain, then it is to be interpreted as such. Otherwise, the 48 bytes are to be interpreted as a concatenation of the following fields&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|MAGIC_PREFIX | CALL_TYPE | ARG_NUMBER | ARG1 | ARG2 | ARG3 | ARG4 | ARG5 |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;MAGIC_PREFIX&lt;&#x2F;code&gt; is the 3 byte constant that prefixes all generalized consolidation requests. &lt;code&gt;CALL_TYPE&lt;&#x2F;code&gt; are 4 bytes to be interpretted as a little Endian &lt;code&gt;uint32&lt;&#x2F;code&gt; and identifies the function type. &lt;code&gt;ARG_NUMBER&lt;&#x2F;code&gt; is a 1 byte to be interpretted as a &lt;code&gt;uint8&lt;&#x2F;code&gt; that encodes the number of arguments that are being passed to the generalized consolidation request handler. And each &lt;code&gt;ARG1, ARG2, ARG3, ARG4, ARG5&lt;&#x2F;code&gt; are all interpretted as little Endian &lt;code&gt;uint64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For each addition of a new &lt;code&gt;CALL_TYPE&lt;&#x2F;code&gt;, the consensus layer must add a handler appropriately called from within &lt;code&gt;process_consolidation_requests&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;No changes needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed reinterpretation of the existing contract enables new implementations in the consensus layer without requireing a hard fork in the execution layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security impacts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove `deposit` and `eth1data` fields</title>
        <published>2025-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Terence</name><uri>https://github.com/terencechain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8015/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8015-remove-legacy-deposit-and-eth1data-fields/25401" />
        

        <id>https://wg-eips.ritovision.com/8015/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:8015"
            label="EIP-8015" />
        

        
        

        
        <summary type="html">Remove legacy `deposits` and `eth1_data` fields from `BeaconBlockBody` after EIP-6110 finalization</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8015/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP removes the legacy &lt;code&gt;deposits&lt;&#x2F;code&gt; and &lt;code&gt;eth1_data&lt;&#x2F;code&gt; fields from the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; structure after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;&quot;&gt;EIP-6110&lt;&#x2F;a&gt; has been fully finalized. These fields become obsolete once all validators have transitioned to the new in-protocol deposit processing mechanism introduced in EIP-6110.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-6110 introduced in-protocol deposit processing by moving validator deposits to the execution layer as part of the EIP-7685 request framework. This change eliminated the need for the consensus layer&#x27;s proposer voting mechanism for deposits. However, during the transition period, both the legacy deposit mechanism (using &lt;code&gt;deposits&lt;&#x2F;code&gt; and &lt;code&gt;eth1_data&lt;&#x2F;code&gt; fields) and the new mechanism coexist to ensure smooth migration.&lt;&#x2F;p&gt;
&lt;p&gt;Once EIP-6110 has been fully finalized and the transition period is complete (when &lt;code&gt;state.eth1_deposit_index == state.deposit_requests_start_index&lt;&#x2F;code&gt;), the legacy deposit fields become permanently unused and can be safely removed. This cleanup provides several benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplified validation&lt;&#x2F;strong&gt;: Removes deprecated validation logic and code paths&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Improved maintainability&lt;&#x2F;strong&gt;: Eliminates technical debt from the transition period&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;activation-conditions&quot;&gt;Activation Conditions&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP SHALL only be activated when both of the following conditions are met:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;EIP-6110 has been fully finalized: &lt;code&gt;state.eth1_deposit_index == state.deposit_requests_start_index&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7732 is in effect&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;beaconblockbody-modifications&quot;&gt;BeaconBlockBody Modifications&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; container is modified to remove the following fields:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Removed fields:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;deposits: List[Deposit, MAX_DEPOSITS]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth1_data: Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The updated &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; structure becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconBlockBody&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    graffiti&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ProposerSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PROPOSER_SLASHINGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attester_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AttesterSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTATIONS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    voluntary_exits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedVoluntaryExit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_VOLUNTARY_EXITS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bls_to_execution_changes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedBLSToExecutionChange&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLS_TO_EXECUTION_CHANGES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; From EIP-7732&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signed_execution_payload_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SignedExecutionPayloadHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PAYLOAD_ATTESTATIONS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validation-changes&quot;&gt;Validation Changes&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Block processing modifications:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove &lt;code&gt;process_eth1_data()&lt;&#x2F;code&gt; function calls from block processing&lt;&#x2F;li&gt;
&lt;li&gt;Remove &lt;code&gt;process_deposits()&lt;&#x2F;code&gt; function calls from block processing&lt;&#x2F;li&gt;
&lt;li&gt;Remove eth1_data voting validation logic&lt;&#x2F;li&gt;
&lt;li&gt;Remove legacy deposit validation logic&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;State transition modifications:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove eth1_data related fields from state transition functions&lt;&#x2F;li&gt;
&lt;li&gt;Remove legacy deposit processing from &lt;code&gt;process_operations()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;beaconstate-cleanup&quot;&gt;BeaconState Cleanup&lt;&#x2F;h4&gt;
&lt;p&gt;The following fields become unused after activation and MAY be removed in future updates:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;eth1_data: Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth1_data_votes: List[Eth1Data, EPOCHS_PER_ETH1_VOTING_PERIOD * SLOTS_PER_EPOCH]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth1_deposit_index: uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: These fields are kept for historical state root verification but are no longer actively used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;timing-of-removal&quot;&gt;Timing of Removal&lt;&#x2F;h3&gt;
&lt;p&gt;The fields are removed after EIP-6110 finalization to ensure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All pending deposits from the legacy system have been processed&lt;&#x2F;li&gt;
&lt;li&gt;No validator can be affected by the removal&lt;&#x2F;li&gt;
&lt;li&gt;The transition is complete and irreversible&lt;&#x2F;li&gt;
&lt;li&gt;State consistency is maintained across all honest nodes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;dependency-on-eip-7732&quot;&gt;Dependency on EIP-7732&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP requires EIP-7732 because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-7732 already modified the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; structure significantly&lt;&#x2F;li&gt;
&lt;li&gt;It provides the architectural foundation for simplified block bodies&lt;&#x2F;li&gt;
&lt;li&gt;The timing aligns with the broader consensus layer improvements&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The removal of legacy fields poses minimal security risk because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The fields are already unused after EIP-6110 finalization&lt;&#x2F;li&gt;
&lt;li&gt;All deposits are processed through the new EIP-6110 mechanism&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Static relative jumps and calls for the EVM</title>
        <published>2025-08-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8013/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8013-static-relative-jumps-and-calls-for-the-evm/25222" />
        

        <id>https://wg-eips.ritovision.com/8013/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:8013"
            label="EIP-8013" />
        

        
        

        
        <summary type="html">Relative jump and call instructions with a signed immediate encoding the jump destination</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8013/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Five new EVM jump instructions are introduced (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;, and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt;) which encode destinations as signed immediate values. These can be useful in almost all &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; use cases and offer improvements in cost, performance, and static analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A recurring discussion topic is that the EVM only has a mechanism for dynamic jumps. They provide a very flexible architecture with only 2 (!) instructions. This flexibility comes at a cost however: it makes analysis of code more complicated, often intractable, and it also (partially) resulted in the need to have the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; marker.&lt;&#x2F;p&gt;
&lt;p&gt;In a great many cases control flow is actually static and there is no need for any dynamic behaviour, though not every use case can be solved by static jumps.&lt;&#x2F;p&gt;
&lt;p&gt;There are various ways to reduce the need for dynamic jumps, some examples:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;With native support for functions &#x2F; subroutines&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;return to caller&quot; instruction -- a form of subroutine return&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;switch-case&quot; table with dynamic indexing&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This proposal introduces a minimal feature set - including the above - to allow compilers to use &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality does not preclude the EVM from introducing other forms of control flow later on. &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; can efficiently co-exists with a higher-level declaration of functions, where static relative jumps should be used for intra-function control flow.  This functionality also does not preclude the use of legacy code.&lt;&#x2F;p&gt;
&lt;p&gt;The main benefit of these instruction is reduced gas cost (both at deploy and execution time), better performance and better static analysis properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce five new instructions, each taking either a two-byte relative offset or else a table of offsets as immediate arguments.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;relative jump:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP (0xe0) relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + relative_offset&lt;&#x2F;code&gt;, where&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is encoded as a 16-bit &lt;strong&gt;signed&lt;&#x2F;strong&gt; (two&#x27;s-complement) big-endian value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;conditional relative jump:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPI (0xe1) relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;pops a value (&lt;code&gt;condition&lt;&#x2F;code&gt;) from the stack, and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((condition == 0) ? 0 : relative_offset)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;relative jump via jump table:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPV (0xe2) max_index relative_offset+&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;pops a value (&lt;code&gt;case&lt;&#x2F;code&gt;) from the stack, and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((case &amp;gt; max_index) ? 0 : relative_offset[case])&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;relative jump to subroutine:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB (0xe3) relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;pushes &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; to the &lt;code&gt;return stack,&lt;&#x2F;code&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + relative_offset&lt;&#x2F;code&gt;, an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;, as if with &lt;code&gt;CALLSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;relative jump to subroutine via jump table:
&lt;ul&gt;
&lt;li&gt;`RJUMPSUBV (0xe4) max_index relative_offset+
&lt;ul&gt;
&lt;li&gt;pops a value (&lt;code&gt;case&lt;&#x2F;code&gt;) from the stack,&lt;&#x2F;li&gt;
&lt;li&gt;pushes &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; to the &lt;code&gt;return stack&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((case &amp;gt; max_index) ? 0 : relative_offset[case])&lt;&#x2F;code&gt;, an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;, as if with &lt;code&gt;CALLSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that the destination of the &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; opcodes MUST be an &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt; and control is returned to a calling &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; via &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; (See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7979&#x2F;&quot;&gt;EIP-7979&lt;&#x2F;a&gt;) -- these two forms of jump provide immediate access to the underlying &quot;return-to-caller&quot; mechanism of the &lt;code&gt;CALLSUB&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;The immediate argument &lt;code&gt;relative_offset&lt;&#x2F;code&gt; is encoded as a 16-bit &lt;strong&gt;signed&lt;&#x2F;strong&gt; (two&#x27;s-complement) big-endian value. Under &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; we mean the &lt;code&gt;PC&lt;&#x2F;code&gt; position after the entire immediate value.&lt;&#x2F;p&gt;
&lt;p&gt;The immediate encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; and &lt;code&gt;RjUMPSUBV&lt;&#x2F;code&gt; are more special: the unsigned 8-bit &lt;code&gt;max_index&lt;&#x2F;code&gt; value determines the maximum index in the jump table. The number of &lt;code&gt;relative_offset&lt;&#x2F;code&gt; values following is &lt;code&gt;max_index+1&lt;&#x2F;code&gt;. This allows table sizes up to 256. The encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; must have at least one &lt;code&gt;relative_offset&lt;&#x2F;code&gt; and thus it will take at minimum 4 bytes. Furthermore, the &lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt; condition falling through means that in many use cases, one would place the &lt;em&gt;default&lt;&#x2F;em&gt; path following the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction. An interesting feature is that &lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt; is an inverted-&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, which can be used in many cases instead of &lt;code&gt;ISZERO RJUMPI relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also extend the validation algorithm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7979&#x2F;&quot;&gt;EIP-7979&lt;&#x2F;a&gt; to verify that every &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; has a &lt;code&gt;relative_offset&lt;&#x2F;code&gt; pointing to an instruction. This means it cannot point to an immediate data of &lt;code&gt;PUSHn&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; and cannot point outside of code bounds.  Further, &lt;em&gt;all and only&lt;&#x2F;em&gt; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; MUST have a &lt;code&gt;relative offset&lt;&#x2F;code&gt; pointing to an `ENTERSUB, whereas the others are allowed to point to a JUMPDEST, but are not required to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The immediate destinations are checked during jumpdest analysis and need not be checked again, so the cost of these instructions can be less than their dynamic counterparts.  We recommend that&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; should be 2,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; should be 4. and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; should be 5.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relative-addressing&quot;&gt;Relative addressing&lt;&#x2F;h3&gt;
&lt;p&gt;We chose relative addressing in order to support code which is relocatable. This also means a code snippet can be injected. A technique seen used prior to this EIP to achieve the same goal was to inject code like &lt;code&gt;PUSHn PC ADD JUMPI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We do not see any significant downside to relative addressing and it allows us to also deprecate the &lt;code&gt;PC&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-size&quot;&gt;Immediate size&lt;&#x2F;h3&gt;
&lt;p&gt;The signed 16-bit immediate means that the largest jump distance possible is 32767. In the case the bytecode at &lt;code&gt;PC=0&lt;&#x2F;code&gt; starts with an &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, it will be possible to jump as far as &lt;code&gt;PC=32770&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given &lt;code&gt;MAX_CODE_SIZE = 24576&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;) and &lt;code&gt;MAX_INITCODE_SIZE = 49152&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;), we think the 16-bit immediate is large enough.&lt;&#x2F;p&gt;
&lt;p&gt;A version with an 8-bit immediate would only allow moving &lt;code&gt;PC&lt;&#x2F;code&gt; backward by 125 or forward by 127 bytes. While that seems to be a good enough distance for many for-loops, it is likely not good enough for cross-function jumps, and since the 16-bit immediate is the same size as what a dynamic jump would take in such cases (3 bytes: &lt;code&gt;JUMP PUSH1 n&lt;&#x2F;code&gt;), we think having less instructions is better.&lt;&#x2F;p&gt;
&lt;p&gt;Should there be a need to have immediate encodings of other size (such as 8-bits, 24-bits or 32-bits), it would be possible to introduce new opcodes, similarly to how multiple &lt;code&gt;PUSH&lt;&#x2F;code&gt; instructions exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pushn-jump-sequences&quot;&gt;&lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; sequences&lt;&#x2F;h3&gt;
&lt;p&gt;If we chose absolute addressing, then &lt;code&gt;RJUMP&lt;&#x2F;code&gt; could be viewed similar to the sequence &lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; (and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; similar to &lt;code&gt;PUSHn JUMPI&lt;&#x2F;code&gt;). In that case one could argue that instead of introducing a new instruction, such sequences should get a discount, because EVMs could optimise them.&lt;&#x2F;p&gt;
&lt;p&gt;We think this is a bad direction to go, and we leave defining the semantics of existing &lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; sequences to EIP-7979 and do not attempt to optimize their gas cost here.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It further complicates the already complex rules of gas calculation.&lt;&#x2F;li&gt;
&lt;li&gt;And it either requires a consensus defined internal representation for EVM code, or forces EVM implementations to do optimisations on their own.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these are risky. Furthermore we think that EVM implementations should be free to chose what optimisations they apply, and the savings do not need to be passed down at all cost.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it requires a potentially significant change to the current implementations which depend on a streaming one-by-one execution without a lookahead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-jumpdest&quot;&gt;Lack of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; serves two purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;To efficiently partition code -- this can be useful for pre-calculating total gas usage for a given &lt;em&gt;block&lt;&#x2F;em&gt; (i.e. instructions between &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s), and for JIT&#x2F;AOT translation.&lt;&#x2F;li&gt;
&lt;li&gt;To explicitly show valid locations (otherwise any non-data location would be valid).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This functionality is not needed for static jumps, as the analysers can easily tell destinations from the static jump immediates during jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;p&gt;There are two benefits here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Not wasting a byte for a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; also means a saving of 200 gas during deployment, for each jump destination.&lt;&#x2F;li&gt;
&lt;li&gt;Saving an extra 1 gas per jump during execution, given &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; itself cost 1 gas and is &quot;executed&quot; during jumping.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rjumpv-and-rjumpsubv-fallback-cases&quot;&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; fallback cases&lt;&#x2F;h3&gt;
&lt;p&gt;If no match is found (i.e. the &lt;em&gt;default&lt;&#x2F;em&gt; case) in the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; or &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; instructions execution will continue without branching. This allows for gaps in the arguments to be filled with &lt;code&gt;0&lt;&#x2F;code&gt;s, and a choice of implementation by the programmer. Alternate options would include exceptional aborts in case of no match.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;valid-cases&quot;&gt;Valid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with instruction other than &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; with various valid table sizes from 1 to 256&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;invalid-cases&quot;&gt;Invalid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with truncated immediate&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target not &lt;code&gt;ENTERSUB&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target outside of code section bounds&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target push data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; target another &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with table containing positive, negative, &lt;code&gt;0&lt;&#x2F;code&gt; offsets&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; outside of table bounds (&lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt;, fallback case)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; &amp;gt; 255&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUBV 0 relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; with table containing positive, negative, &lt;code&gt;0&lt;&#x2F;code&gt; offsets&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; outside of table bounds (&lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt;, fallback case)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; &amp;gt; 255&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Adding new instructions with immediate arguments should be carefully considered when implementing the validation algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Static relative jump execution does not require runtime check of the jump destination. It greatly reduces execution cost. Therefore the gas cost of the new instructions can also be significantly reduced.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;and &lt;code&gt;RJUMPSUBV&lt;&#x2F;code&gt; instruction relative offset tables can have up to 256 one-byte entries, so reading an offset cannot be a potential DoS attack surface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Backward compatible SWAPN, DUPN, EXCHANGE</title>
        <published>2025-08-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8024/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-8024-backward-compatible-swapn-dupn-exchange/25486" />
        

        <id>https://wg-eips.ritovision.com/8024/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8024"
            label="EIP-8024" />
        

        
        

        
        <summary type="html">Introduce additional instructions for manipulating the stack which allow accessing the stack at higher depths</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8024/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, &lt;code&gt;SWAP*&lt;&#x2F;code&gt; and &lt;code&gt;DUP*&lt;&#x2F;code&gt; instructions are limited to a stack depth of 16. Introduce three new instructions, &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; which lift this limitation and allow accessing the stack at higher depths.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the stack is 1024 items deep, easy access is only possible for the top 16 items. Supporting more local variables is possible via manually keeping them in memory or through a &quot;stack to memory elevation&quot; in a compiler. This can result in complex and inefficient code.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, implementing higher level constructs, such as functions, on top of EVM will result in a list of input and output parameters as well as an instruction offset to return to.&lt;&#x2F;p&gt;
&lt;p&gt;The number of these arguments (or stack items) can easily exceed 16 and thus will require extra care from a compiler to lay them out in a way that all of them are still accessible.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, swapping items besides the 1st and Nth items in the stack is very important for compilers implementing stack scheduling algorithms (the analog of register allocation for stack machines), which try to minimize stack traffic given a set of variables and usage analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt;, and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; will provide an option to compilers to simplify accessing deep stack items.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce three new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;     (&lt;code&gt;0xe6&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;    (&lt;code&gt;0xe7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; (&lt;code&gt;0xe8&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each instruction carries one or two immediate operands. Informally, using 1-based indexing, the semantics are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN n&lt;&#x2F;code&gt;: The &lt;code&gt;n&lt;&#x2F;code&gt;&#x27;th stack item is duplicated at the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN n&lt;&#x2F;code&gt;: The &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE n m&lt;&#x2F;code&gt;: The &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the &lt;code&gt;m + 1&lt;&#x2F;code&gt;&#x27;th stack item.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Formally, when &lt;code&gt;code[pc]&lt;&#x2F;code&gt; is one of these opcodes, the VM executes as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;:
&lt;ol&gt;
&lt;li&gt;Charge 3 gas.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;x = code[pc + 1]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;90 &amp;lt; x &amp;lt; 128&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;n = decode_single(x)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;n &amp;gt; len(stack)&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Push &lt;code&gt;stack[top - n + 1]&lt;&#x2F;code&gt; on the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;pc = pc + 2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;:
&lt;ol&gt;
&lt;li&gt;Charge 3 gas.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;x = code[pc + 1]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;90 &amp;lt; x &amp;lt; 128&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;n = decode_single(x)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;n + 1 &amp;gt; len(stack)&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Swap &lt;code&gt;stack[top - n]&lt;&#x2F;code&gt; and &lt;code&gt;stack[top]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;pc = pc + 2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;:
&lt;ol&gt;
&lt;li&gt;Charge 3 gas.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;x = code[pc + 1]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;79 &amp;lt; x &amp;lt; 128&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;n, m = decode_pair(x)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;m + 1 &amp;gt; len(stack)&lt;&#x2F;code&gt;, halt with exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Swap &lt;code&gt;stack[top - n]&lt;&#x2F;code&gt; and &lt;code&gt;stack[top - m]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;pc = pc + 2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;code[pc + 1]&lt;&#x2F;code&gt; evaluates to &lt;code&gt;0&lt;&#x2F;code&gt; if beyond the end of the code, matching &lt;code&gt;PUSH&lt;&#x2F;code&gt; behavior.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;top&lt;&#x2F;code&gt; denotes the index of the value at the top of the stack.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis is unchanged. In particular, if &lt;code&gt;code[i]&lt;&#x2F;code&gt; is at an instruction boundary and is one of these opcodes, and &lt;code&gt;code[i + 1]&lt;&#x2F;code&gt; is &lt;code&gt;0x5b&lt;&#x2F;code&gt; (&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;), then &lt;code&gt;code[i + 1]&lt;&#x2F;code&gt; is a valid jump target. Note that in this case the execution of &lt;code&gt;code[i]&lt;&#x2F;code&gt; would halt at step 2 above (because &lt;code&gt;x = code[i + 1] = 0x5b = 91&lt;&#x2F;code&gt;). Disassemblers must decode such &lt;code&gt;code[i]&lt;&#x2F;code&gt; as &lt;code&gt;INVALID&lt;&#x2F;code&gt; (or &lt;code&gt;INVALID_DUPN&lt;&#x2F;code&gt;, etc.) and &lt;code&gt;code[i + 1]&lt;&#x2F;code&gt; as &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The auxiliary functions &lt;code&gt;decode_single&lt;&#x2F;code&gt; and &lt;code&gt;decode_pair&lt;&#x2F;code&gt; are defined by the following Python code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_single&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 90&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 90&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_pair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    q&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; divmod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;k&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Assemblers and compilers must emit a 1-byte immediate after each of these opcodes that decodes to the required &lt;code&gt;n, m&lt;&#x2F;code&gt; operands. For reference, this can be done by &lt;code&gt;encode_single&lt;&#x2F;code&gt; and &lt;code&gt;encode_pair&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encode_single&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 235&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 107&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; encode_pair&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; m&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        q&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        q&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 29&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; q&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 79&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;use-of-an-immediate-operand&quot;&gt;Use of an immediate operand&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing dynamic selection of the arguments to swap or dup could be used to prevent static analysis of the contents of the stack. Since static analysis is an important tool for security auditors we want to do what we can to make their jobs easier. Hence, the operands require an immediate operand that is not dynamic in nature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disallowed-immediate-range&quot;&gt;Disallowed immediate range&lt;&#x2F;h3&gt;
&lt;p&gt;A property the EVM has is that it&#x27;s not possible to jump to the middle of an instruction. In order to guarantee this property, the immediate operands of &lt;code&gt;PUSH*&lt;&#x2F;code&gt; instructions are masked from jumpdest analysis so that the occurrence of &lt;code&gt;0x5b&lt;&#x2F;code&gt; in them is not mistaken for a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instruction, which should be considered a valid jump target elsewhere.&lt;&#x2F;p&gt;
&lt;p&gt;The new instructions in this EIP preserve this property without changing jumpdest analysis by making it invalid for their immediates to contain &lt;code&gt;0x5b&lt;&#x2F;code&gt;, in addition to &lt;code&gt;0x60&lt;&#x2F;code&gt; to &lt;code&gt;0x7f&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt; to &lt;code&gt;PUSH32&lt;&#x2F;code&gt;) since those would cause the subsequent instructions to be masked.&lt;&#x2F;p&gt;
&lt;p&gt;The alternative, changing jumpdest analysis to introduce new masked opcodes, would create a backwards incompatibility if done without bytecode versioning (EOF). Consider the bytecode sequence &lt;code&gt;e6 5b&lt;&#x2F;code&gt; that decodes to &lt;code&gt;INVALID JUMPDEST&lt;&#x2F;code&gt; prior to this EIP, and thus contains a valid jump target. If an instruction &lt;code&gt;DUPN x&lt;&#x2F;code&gt; were introduced with encoding &lt;code&gt;e6 {x}&lt;&#x2F;code&gt; (opcode immediately followed by operand), and jumpdest analysis changed to mask the operand to &lt;code&gt;e6&lt;&#x2F;code&gt;, the same bytecode sequence &lt;code&gt;e6 5b&lt;&#x2F;code&gt; would then decode to &lt;code&gt;DUPN 0x5b&lt;&#x2F;code&gt;. As a result of the upgrade, &lt;code&gt;e6&lt;&#x2F;code&gt; would become an invalid jump target, breaking contracts that include this sequence. The opposite can happen with push opcodes, for example, &lt;code&gt;e6 60 5b&lt;&#x2F;code&gt; would transform from &lt;code&gt;INVALID PUSH1 0x5b&lt;&#x2F;code&gt; to &lt;code&gt;DUPN 0x60 JUMPDEST&lt;&#x2F;code&gt;, creating a new valid jump target. Furthermore, this may have a cascading effect on arbitrarily many subsequent instructions.&lt;&#x2F;p&gt;
&lt;p&gt;Since the EVM doesn&#x27;t offer a dedicated section for data, arbitrary data may be embedded in code and serve as immutable data storage accessed via &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;. Therefore, we must assume that arbitrary byte sequences may be found in contracts that have been deployed or are included in transactions yet to be published on chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is designed to uphold the following backwards compatibility guarantee: every possible execution trace on a given bytecode that does not attempt to execute an undefined opcode must continue to produce the same effect after the introduction of an instruction. No new &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s must be created in a given bytecode by the introduction of an instruction and none may be removed.&lt;&#x2F;p&gt;
&lt;p&gt;This encoding can be reused in future instructions with immediate operands, although it is not necessary if the range of the operand naturally does not include the bytes &lt;code&gt;0x5b&lt;&#x2F;code&gt; (&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;) or &lt;code&gt;0x60&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt;) to &lt;code&gt;0x7f&lt;&#x2F;code&gt; (&lt;code&gt;PUSH32&lt;&#x2F;code&gt;), in which case masking is not necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange-immediate&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; immediate&lt;&#x2F;h3&gt;
&lt;p&gt;A previous formulation of &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; allowed swapping stack elements only if they were within some distance. As a result, it would be possible to swap the elements at indices 30 and 29, but not possible to move an element from index 30 to 2 with a single instruction. The current formulation prioritizes the latter, on the assumption that it is more valuable to move elements closer to the top of the stack than it is to rearrange elements deeper in the stack.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, the exact formulation was chosen to make &lt;code&gt;decode_pair&lt;&#x2F;code&gt; a simple function using only basic arithmetic, bitwise operations (division by 16), and few branches. A small trade-off in the number of addressable pairs was made to reduce the number of necessary branches; this implies some of the immediate range is not allocated, and it could be used to add a dozen more addressable pairs at the cost of more decoding complexity, potentially in a future network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, note that the operands in the assembly instruction &lt;code&gt;EXCHANGE n m&lt;&#x2F;code&gt; appear &quot;off by one&quot;, i.e. it operates on the stack elements at depths &lt;code&gt;n + 1&lt;&#x2F;code&gt; and &lt;code&gt;m + 1&lt;&#x2F;code&gt;. These offsets were chosen to match the &lt;code&gt;SWAP&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt; opcodes such that &lt;code&gt;EXCHANGE n m&lt;&#x2F;code&gt; has an effect equivalent to the sequence &lt;code&gt;SWAP{n} SWAP{m} SWAP{n}&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-immediate-operand&quot;&gt;Size of immediate operand&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt; a 16-bit size was considered to accommodate the full stack space of 1024 items, however:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;that would require an additional restriction&#x2F;check (&lt;code&gt;n &amp;lt; 1024&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;the 256 depth is a large improvement over the current 16 and the overhead of an extra byte would make it less useful&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Similarly for &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, the proposed scheme allows addressing of 30 items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for these operations is the same as for existing &lt;code&gt;DUP*&lt;&#x2F;code&gt; and &lt;code&gt;SWAP*&lt;&#x2F;code&gt; instructions, because they are just implemented as pointer swaps and immediate decoding is negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange-vs-swapn&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; vs &lt;code&gt;SWAPN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;As mentioned before, &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; is important to compilers implementing stack scheduling algorithms. Specifically, in the case that a stack item is scheduled to be consumed deeper in the stack (for instance, the 3rd item in the stack needs to be moved into 2nd position in order to be consumed by the next operation), that currently takes three instructions, &lt;code&gt;SWAP2 SWAP3 SWAP2&lt;&#x2F;code&gt;. However, in the EVM implementation, the implementation is just a pointer swap, so it could be implemented in a single instruction at no extra runtime cost to the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This has no effect on contracts that would never attempt to execute the opcodes allocated by this EIP. The jump targets of existing contracts are preserved.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;assembly-disassembly&quot;&gt;Assembly&#x2F;Disassembly&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;e600&lt;&#x2F;code&gt; is &lt;code&gt;[DUPN 17]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e780&lt;&#x2F;code&gt; is &lt;code&gt;[SWAPN 108]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e6005b&lt;&#x2F;code&gt; is &lt;code&gt;[DUPN 17, JUMPDEST]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e75b&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_SWAPN, JUMPDEST]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e6605b&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_DUPN, PUSH1 0x5b]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e7610000&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_SWAPN, PUSH2 0x0000]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e65f&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_DUPN, PUSH0]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e812&lt;&#x2F;code&gt; is &lt;code&gt;[EXCHANGE 2 3]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e8d0&lt;&#x2F;code&gt; is &lt;code&gt;[EXCHANGE 1 19]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e850&lt;&#x2F;code&gt; is &lt;code&gt;[INVALID_EXCHANGE, POP]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;60016000808080808080808080808080808080e600&lt;&#x2F;code&gt; results in 18 stack items, the top of the stack valued 1, the bottom of the stack valued 1, the rest valued 0
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;60016000808080808080808080808080808080e6&lt;&#x2F;code&gt; at the end of the code is equivalent to above&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600160008080808080808080808080808080806002e700&lt;&#x2F;code&gt; results in 18 stack items, the top of the stack valued 1, the bottom of the stack valued 2, the rest valued 0
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;600160008080808080808080808080808080806002e7&lt;&#x2F;code&gt; at the end of the code is equivalent to above&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600060016002e801&lt;&#x2F;code&gt; results in 3 stack items, from top to bottom: [2, 0, 1]&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060006000600060016002e8&lt;&#x2F;code&gt; results in 30 stack items, the top of the stack valued 2, the bottom of the stack valued 1, the rest valued 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e75b&lt;&#x2F;code&gt; reverts&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600456e65b&lt;&#x2F;code&gt; executes successfully (&lt;code&gt;PUSH 04 JUMP INVALID_DUPN JUMPDEST&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;600060006000e80115&lt;&#x2F;code&gt; results in 3 stack items, the top of the stack valued 1, the rest valued 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;6000808080808080808080808080808080e600&lt;&#x2F;code&gt; results in exceptional halt&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any additional risks introduced here. The EVM stack is fixed at 1024 items and most implementations keep that in memory at all times. This change will increase the number of stack items accessible via single instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Unified multidimensional fee market</title>
        <published>2025-08-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7999/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7999-unified-multidimensional-fee-market/25010" />
        

        <id>https://wg-eips.ritovision.com/7999/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7999"
            label="EIP-7999" />
        

        
        

        
        <summary type="html">Let transactions specify one aggregate `max_fee` budget for all resources, unify fee markets, normalize gas, and generalize EIP-7918.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7999/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A unified multidimensional fee market is introduced, where each transaction specifies the maximum amount of ETH it is willing to pay for inclusion using a single &lt;code&gt;max_fee&lt;&#x2F;code&gt;. Upon inclusion, the protocol ensures that the transaction is able to pay the gas for all dimensions, treating the &lt;code&gt;max_fee&lt;&#x2F;code&gt; as fungible across resources. This enables a more efficient use of capital, and enshrines the same representation that users have when they interact with Ethereum. The fee market is further unified in terms of a single update fraction under a single fee update mechanism, generalized reserve pricing, and a gas normalization that retains current percentage ranges while keeping the price stable whenever a gas limit changes. Calldata is proposed as the first resource to be added, with avenues for facilitating gas fungibility for EVM resources considered for further expansion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A multidimensional fee market enables precise control over resource consumption. It allows &lt;em&gt;the market&lt;&#x2F;em&gt; to fairly price resources according to targets and limits deemed safe by developers, and it allows resources to be consumed at maximum capacity within these limits. Directly expanding the current fee market design to the multidimensional setting can however have negative effects on the user experience (UX) and on economic efficiency. Users are forced to set a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; for each resource, where a too low allocation in any dimension can render the transaction ineligible.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP leverages the natural fungibility of the user&#x27;s fee budget by letting users set a single unified &lt;code&gt;max_fee&lt;&#x2F;code&gt;. Instead of using non-fungible per-resource budgets, the single ETH budget can then be allocated dynamically to cover costs wherever they arise, ensuring a more efficient use of capital. Users will be able to specify a lower &lt;code&gt;max_fee&lt;&#x2F;code&gt; than the implied aggregate maximum unless all base fees are perfectly correlated (which reduces to the current design), because they do not need to buffer for spurious price movements in a single resource dimension.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum&#x27;s current fee market has &quot;tech debt&quot; in that two separate mechanisms are used: one for regular gas (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;) and the other for blob gas (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;). The proposal unifies the fee market under the preferred EIP-4844 design. That design allows for exact control over long-run resource consumption. In a multidimensional setting with individual base fees, we can then for example achieve precise control over state growth, while accommodating temporary spikes. Excess gas of EIP-4844 is further normalized relative to the limit, allowing for a single update fraction across resources that retains current percentage ranges while keeping the price stable if any gas limit changes.&lt;&#x2F;p&gt;
&lt;p&gt;Calldata is added first, to speed up worst-case payload propagation and expand available EVM gas—without compromising gas introspection. A method for facilitating gas aggregation across resources within the EVM is outlined as an avenue for preserving backward compatibility when expanding further. The logic of EIP-7918 is integrated into the multidimensional setting to ensure that calldata has a higher cost per byte than blob data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The specification inherits its logic from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7706&#x2F;&quot;&gt;EIP-7706&lt;&#x2F;a&gt;, incorporating the changes necessary for facilitating one aggregate fee, a multidimensional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;&quot;&gt;EIP-7918&lt;&#x2F;a&gt; logic, a systematic approach to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt;, and a stable gas normalization function, etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Constant&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MULTIDIM_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt; &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Identifier for the new transaction type&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;EVM_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ratio of EVM gas target to EVM gas limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;CALLDATA_GAS_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Gas cost per token for calldata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;TOKENS_PER_NONZERO_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Tokens per non-zero byte of calldata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ratio of calldata limit to gas limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;CALLDATA_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Ratio of calldata target to calldata limit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_RESERVE_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;[0, 16, 12]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Factor by which the base fee can be below the baseline&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_RESERVE_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;[0, 0, 1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Index of the base fee to compare against&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MIN_BASE_FEE_PER_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Minimum base fee per gas unit&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_NORMALIZATION_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;10**9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Normalization factor for the delta excess gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;4_245_093_508&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;≈ &lt;code&gt;GAS_NORMALIZATION_FACTOR &#x2F; (2 * ln(1.125))&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP via hard fork, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;MULTIDIM_TX_TYPE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, gas_limit, to, value, data, access_list, blob_versioned_hashes, max_fee, max_priority_fee_per_gas, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We require &lt;code&gt;max_fee&lt;&#x2F;code&gt; to be a scalar integer from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**128-1&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; to be a list of integers from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**64-1&lt;&#x2F;code&gt;, either of length 1 or with the same length as the number of resources (initially 3). The &lt;code&gt;gas_limit&lt;&#x2F;code&gt; is initially specified only for the main EVM gas, since other limits can be inferred from the transaction. To facilitate further expansion, the Python spec uses a list with a single element at index 0. Each added integer will range from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from EIP-4844, except that the calldata gas cost (16 per non-zero byte, 4 per zero byte) is removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing-and-transaction-fees&quot;&gt;Block processing and transaction fees&lt;&#x2F;h3&gt;
&lt;p&gt;Helpers for vector operations:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; all_less_or_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; all&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vector_add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Helper functions for computing scalar max fees&#x2F;priority fees for all transaction types:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New tx type already has a max_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account for blobs in blob txs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; is_eip_1559&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-1559 txs have no blobs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Legacy transactions have a gasprice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_priority_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; remaining_fee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Precalculate total gas and fees for non-blob resources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tip_indices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tgas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tip_indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tip_indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New tx type: Single tip or full vector of tips&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ignore blobs (as now)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            tpriority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_priority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tpriority_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_priority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remaining_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; is_legacy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Legacy tx: The remainder after base fees paid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-1559 or Blob tx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tpriority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; tmax_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tfee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tgas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tpriority_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Clamp since blobs reduce the shared max_fee budget&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; remaining_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; max_priority_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The calldata resource pricing under this EIP follows previous gas per byte constants but deprecates the floor pricing specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOKENS_PER_NONZERO_BYTE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CALLDATA_GAS_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The helper for calculating gas limits from EIP-7706 is adjusted to subtract calldata gas from the gas limit of old transactions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;getattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We use tx.gas_limit as is for new tx type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Partition old tx.gas_limit into its execution and calldata components.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        execution_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;execution_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The calculation for the &lt;em&gt;required&lt;&#x2F;em&gt; &lt;code&gt;max_fee&lt;&#x2F;code&gt; to process the transaction is done in a separate function for easy future expansion:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_required_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;At the start of processing a block&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;initialize a vector &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt; to &lt;code&gt;[0, 0, 0]&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;derive the base fee &lt;code&gt;base_fees = get_block_base_fees(block.parent)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the start of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Derive basic properties of the tx:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;max_fee = get_max_fee(tx)&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tx_gas_limits = get_gas_limits(tx)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;max_base = get_required_max_fee(base_fees, tx_gas_limits)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Require that
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;all_less_or_equal(vector_add(gas_used_so_far, tx_gas_limits), gas_limits)&lt;&#x2F;code&gt;. The block&#x27;s &lt;code&gt;gas_limits&lt;&#x2F;code&gt; are defined in the next subsection.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;max_base &amp;lt;= max_fee&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Compute the fees to deduct initially:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;max_priority_fee = get_priority_fee(tx, tx_gas_limits, base_fees, max_fee - max_base)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fee_to_deduct = max_base + max_priority_fee&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Deduct &lt;code&gt;fee_to_deduct&lt;&#x2F;code&gt; wei from the sender, which we define as the address recovered from the transaction’s signature.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compute &lt;code&gt;tx_gas_consumed&lt;&#x2F;code&gt; as a three-item vector, where the first item is the amount of execution gas actually consumed, and the second and third items are the blob and calldata gas amounts, which are equal to their limits from &lt;code&gt;tx_gas_limits&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Burn &lt;code&gt;base_fee_paid = sum(vector_mul(base_fees, tx_gas_consumed))&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Transfer to the coinbase &lt;code&gt;priority_fee_paid = get_priority_fee(tx, tx_gas_consumed, base_fees, fee_to_deduct - base_fee_paid)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Refund the sender &lt;code&gt;fee_to_deduct - base_fee_paid - priority_fee_paid&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Update &lt;code&gt;gas_used_so_far = vector_add(gas_used_so_far, tx_gas_consumed)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a block&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Require each element of &lt;code&gt;block.gas_used&lt;&#x2F;code&gt; (a vector field in the header) to equal the corresponding element in &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BlockHeader&lt;&#x2F;code&gt; is updated to remove the &lt;code&gt;blob_gas_used&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; fields, and the following new fields are added, all of the &lt;code&gt;[int, int, int]&lt;&#x2F;code&gt; type: &lt;code&gt;gas_limits&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;excess_gas&lt;&#x2F;code&gt;. The header sequence of the new fields is &lt;code&gt;[..., withdrawals_root, gas_limits, gas_used, excess_gas]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We define the &lt;code&gt;gas_limits&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_limits[0]&lt;&#x2F;code&gt; follows the existing adjustment formula based on the parent &lt;code&gt;gas_limits[0]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[1]&lt;&#x2F;code&gt; must equal &lt;code&gt;blobSchedule.max * GAS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[2]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[0] &#x2F;&#x2F; CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;and the &lt;code&gt;gas_targets&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_targets[0]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[0] &#x2F;&#x2F; EVM_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_targets[1]&lt;&#x2F;code&gt; must equal &lt;code&gt;blobSchedule.target * GAS_PER_BLOB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_targets[2]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[2] &#x2F;&#x2F; CALLDATA_LIMIT_TARGET_RATIO&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The blobSchedule for referencing target and max blobs was introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7840&#x2F;&quot;&gt;EIP-7840&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;We incorporate EIP-7918 to establish a dynamic reserve price for blob and calldata gas. When the market price for a resource drops below its reserve price, the mechanism for reducing its &lt;code&gt;excess_gas&lt;&#x2F;code&gt; (and thus lowering its base fee) is disabled. This leads the base fee to rise with usage until it meets the reserve price.&lt;&#x2F;p&gt;
&lt;p&gt;We normalize the running excess gas so that all resources operate at the same scale with the same &lt;code&gt;BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;, which also provides a smoother response when any limit is adjusted. Division by &lt;code&gt;gas_limits[i]&lt;&#x2F;code&gt; upholds the same price changes stipulated in EIP-4844 and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7691&#x2F;&quot;&gt;EIP-7691&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_block_base_fees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limits&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    targets&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_block_gas_targets&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_RESERVE_FACTOR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                and&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_RESERVE_FACTOR&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_RESERVE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7918 path. Excess gas rises with usage (up to limit), but cannot fall.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NORMALIZATION_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Regular path. Excess gas rises and falls with usage as normal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NORMALIZATION_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ..or subtract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; targets&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                deltan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NORMALIZATION_FACTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; deltan&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; deltan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_block_base_fees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            MIN_BASE_FEE_PER_GAS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            BASE_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;calldatabasefee-instruction&quot;&gt;CALLDATABASEFEE instruction&lt;&#x2F;h3&gt;
&lt;p&gt;We add a &lt;code&gt;CALLDATABASEFEE (0x4b)&lt;&#x2F;code&gt; instruction that returns the calldata base fee of the current block, following the same principles as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7516&#x2F;&quot;&gt;EIP-7516&lt;&#x2F;a&gt; for the blob base fee.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Output&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x4b&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;censorship-resistance&quot;&gt;Censorship resistance&lt;&#x2F;h3&gt;
&lt;p&gt;In EIP-7805, &lt;em&gt;includers&lt;&#x2F;em&gt; propose inclusion-list (IL) transactions that the block builder must include, subject to rules evaluated post-execution once remaining capacity is known. We define three resource types based on these rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Conditional resource&lt;&#x2F;em&gt; – An IL transaction consuming this resource &lt;em&gt;must be included&lt;&#x2F;em&gt; if the block has sufficient remaining capacity. If such a transaction is excluded, the block should not be accepted, unless the available space (&lt;code&gt;gas_limit[i] - gas_used[i]&lt;&#x2F;code&gt;) for at least one of its required conditional resources was insufficient to fit the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Unconditional resource&lt;&#x2F;em&gt; – An IL transaction consuming this resource &lt;em&gt;must be included&lt;&#x2F;em&gt; as long as sufficient capacity remains for all &lt;em&gt;conditional&lt;&#x2F;em&gt; resources it also uses. A lack of available capacity in the unconditional resource itself is &lt;em&gt;not&lt;&#x2F;em&gt; a valid reason for exclusion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Deconditional resource&lt;&#x2F;em&gt; – An IL transaction consuming this resource &lt;em&gt;can always be excluded&lt;&#x2F;em&gt;, regardless of available capacity. For this reason, there is no incentive for includers to list such a transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If EIP-7805 is implemented, it must: (i) continue to treat EVM gas as a conditional resource; (ii) continue to treat blob gas as a deconditional resource; (iii) treat calldata gas as an unconditional resource. Any transaction listed in an IL that consumes calldata and is excluded from the block, despite there being sufficient capacity in all conditional resources it uses, MUST produce an &lt;code&gt;INVALID_INCLUSION_LIST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-go-multidimensional&quot;&gt;Why go multidimensional?&lt;&#x2F;h3&gt;
&lt;p&gt;Many Ethereum resources such as blobs, calldata, access, and compute are in limited supply each block, constrained by the need to, e.g., timely propagate data or run computations. Upholding the constraints on all these resources via a single meta-resource—&quot;gas&quot;—limits developers&#x27; ability to control both supply &lt;em&gt;and&lt;&#x2F;em&gt; demand. By going multidimensional, developers gain a more fine-grained control over the supply of each resource, preventing one from encroaching on the allotment for another. Resources can then be consumed at maximum capacity within each specified target and limit. With separate base fees for each resource, the market can come to an agreement on the appropriate price that leads to consumption at maximum capacity, given a specific user demand and aforementioned constraints on its supply. A multidimensional fee market is thus inherently a tool for scaling Ethereum.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-experience&quot;&gt;User experience&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum currently uses &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; for EVM gas and &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; for blob gas. A direct expansion of this approach is proposed in EIP-7706, with a vector of fees per gas for each resource. This may be considered unfortunate from a UX perspective, given that the vector will expand with expanding dimensionality. Our casual users tend to be moderately confused already by a single &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;. Most do not primarily think in terms of the individual prices for the resources that the transaction will consume. They think in terms of how much ETH they need to pay for their transactions (or in terms of dollars&#x2F;fiat). A unified &lt;code&gt;max_fee&lt;&#x2F;code&gt; is in this context an improvement to UX. A unified &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; is possible, but might cause confusion in that the required gas price will differ from the base fees when using several resources—and thus also differ between transactions using different proportions of the resources.&lt;&#x2F;p&gt;
&lt;p&gt;When it comes to the priority fee, the optimal UX between using &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; is a bit more nuanced. We decided to use &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;. Ethereum already today unifies the priority fee for blob gas and regular gas under a single &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;. It is thus natural to retain this representation, if only for removing friction for wallets. Furthermore, the priority fee should be determined from actual gas usage and not the gas limit. This is however perfectly possible when using &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; as well, because the max priority fee can be treated as proportional to the limit during processing, thus falling if less gas is consumed.&lt;&#x2F;p&gt;
&lt;p&gt;Retaining &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; can be considered slightly safer for users, in that they will never risk manually submitting a &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; for an old transaction type. Advanced users may wish to specify one priority fee per resource, to granularly pay according to usage when consuming below the gas limit. This ability was therefore preserved as an optional vector-based priority fee.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;economic-efficiency&quot;&gt;Economic efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;Besides UX, resource-specific fee limits can also be unfortunate at a deeper economic level. Once a user has specified a &lt;code&gt;gas_limit&lt;&#x2F;code&gt; for any non-deterministic dimension, potentially with the assistance of their wallets, multiple separate &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; could exclude transactions that specify a sufficient aggregate fee, due to a drift in relative levels of the base fees.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a multidimensional transaction with a &lt;code&gt;gas_limit&lt;&#x2F;code&gt; vector $\mathbf{l} = (l_1, l_2,\dots, l_n)$, a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{f} = (f_1, f_2, \dots, f_n)$, and a &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{p} = (p_1, p_2, \dots, p_n)$. The consumed gas of the transaction is denoted $\mathbf{g} = (g_1, g_2, \dots, g_n)$, and the vector of base fees is denoted $\mathbf{b} = (b_1, b_2, \dots, b_n)$. The realized priority fee, after ensuring a sufficient base fee, is then&lt;&#x2F;p&gt;
&lt;p&gt;$p{\prime}_i = \min(p_i, f_i-b_i)$&lt;&#x2F;p&gt;
&lt;p&gt;for all resources $i$. Assume that when the transaction is submitted, the user specifies a &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{f}$ such that all entries individually satisfy all base fee $\mathbf{b}$  criteria&lt;&#x2F;p&gt;
&lt;p&gt;$f_i \ge b_i \quad \text{for all resources } i.$&lt;&#x2F;p&gt;
&lt;p&gt;The gas limits also satisfy the actual gas consumption&lt;&#x2F;p&gt;
&lt;p&gt;$l_i \ge g_i \quad \text{for all resources } i.$&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; vector $\mathbf{p}$ is also considered sufficient by many proposers, when they jointly weigh the reward against competing transactions using a weight vector $\mathbf{w}$, considering contention across relevant resources:&lt;&#x2F;p&gt;
&lt;p&gt;$\sum p{\prime}_i g_i \ge \sum w_i g_i.$&lt;&#x2F;p&gt;
&lt;p&gt;While not evaluated in the existing EIP, the base fees $\mathbf{b}$ could also be satisfied in aggregate against the max fees:&lt;&#x2F;p&gt;
&lt;p&gt;$\sum f_i l_i \ge \sum b_i l_i.$&lt;&#x2F;p&gt;
&lt;p&gt;Now assume that the base fee for any of the resources rapidly rises before the transaction is included, such that it becomes higher than the &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; in that dimension. In this scenario, the transaction can no longer be included. This may happen, even though the &lt;em&gt;aggregate&lt;&#x2F;em&gt; fees that the user is offering to pay, $\sum f_i l_i$, remain at a level above the aggregate fees that the protocol demands to execute it, $\sum b_i l_i$, just as initially. The aggregate priority fees may still also satisfy the proposer. The welfare loss consists of a user, a proposer, and a protocol willing to process a transaction, hamstrung by rigidity in the protocol design.&lt;&#x2F;p&gt;
&lt;p&gt;The analysis leads to the following conclusions, all of which apply with increasing emphasis the higher the dimensionality:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The UX would be simplified by one aggregate ETH fee.&lt;&#x2F;li&gt;
&lt;li&gt;The protocol would be best served by taking a single aggregate ETH fee from the user.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer already considers the aggregate impact when making its inclusion decision.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Thus, the proposal is that the user specifies a single ETH &lt;code&gt;max_fee&lt;&#x2F;code&gt;. The protocol first ensures that the &lt;code&gt;max_fee&lt;&#x2F;code&gt; $F$ covers the base fee across gas limits in all dimensions, $F &amp;gt; \sum b_i l_i$, and finally charges the minimum aggregate fee possible. The total fee paid to the protocol is thus the same as in the original multidimensional fee market design. The design is future-proof in that additional dimensions easily are incorporated, retaining the single &lt;code&gt;max_fee&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;priority-fee&quot;&gt;Priority fee&lt;&#x2F;h3&gt;
&lt;p&gt;Considerations for the priority fee were already outlined in the UX section. Here, we first expand on why a vector &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; &lt;em&gt;can&lt;&#x2F;em&gt; be beneficial to some users for fine-grained control, but not to most. The user has full control over the priority fee with a single input, as long as gas usage is deterministic across all resources. This input can be either &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; or &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;—they are equivalent under deterministic gas usage. They are furthermore equivalent under any circumstances if the protocol makes sure to scale the &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; according to realized gas usage &lt;em&gt;relative&lt;&#x2F;em&gt; to the specified limit. Otherwise, the &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; will not be reduced when a transaction uses less gas than the limit (this is more often a drawback than a benefit for the user).&lt;&#x2F;p&gt;
&lt;p&gt;The priority fee a user wishes to provide per gas for a resource depends on the (likelihood of) contention across this resource. We can thus expect it to differ between resources. It follows from the principle of degrees of freedom that to gain full control over the transaction&#x27;s priority fee, a user needs a separate parameter for each independent variable. When gas usage is non-deterministic in one resource—as today—the user needs two priority fees to achieve full granularity. When gas usage is non-deterministic in two resources (and their non-deterministic usage is not perfectly correlated), the user needs three priority fees, etc.&lt;&#x2F;p&gt;
&lt;p&gt;It should here be noted that the required priority fee per gas for some resource cannot be directly ascertained from the priority fee per gas that has been stipulated for that resource in recent transactions. Assume that there are 10 resource and each transaction includes a vector stipulating &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; for each. The builder will in its inclusion decision operate on the aggregate, and its requirements across dimensions can thus only be inferred, not observed directly. This means that per-resource estimates of required priority fees are not trivial, and most may still prefer the simplicity of a single one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unified-gas-accounting-normalization-and-reserve-pricing-mechanism&quot;&gt;Unified gas accounting, normalization, and reserve pricing mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;Ethereum currently uses two separate fee mechanisms, one for execution gas (EIP-1559) and one for blob gas (EIP-4844). This EIP unifies these mechanisms under the EIP-4844 standard, similar to EIP-7706 but with a few additions. We normalize the excess gas delta by dividing by the gas limit in &lt;code&gt;calc_excess_gas&lt;&#x2F;code&gt;, thus enabling all resources to operate under the same &lt;code&gt;BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; while also keeping each fee fixed during a hard fork whenever a limit changes.&lt;&#x2F;p&gt;
&lt;p&gt;The reserve pricing mechanism from EIP-7918 is also generalized such that it can be applied to any resource, using another resource as an anchor. The mechanism imposes that if the base fee multiplied by &lt;code&gt;GAS_RESERVE_FACTOR&lt;&#x2F;code&gt; is less than the anchor base fee, the base fee cannot fall any further. Calldata uses blob data as an anchor to ensure that we do not charge less for calldata than blob data (see the separate section on the calldata resource for further details).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;wallet-fee-estimation-logic&quot;&gt;Wallet fee estimation logic&lt;&#x2F;h3&gt;
&lt;p&gt;To suggest a &lt;code&gt;max_fee&lt;&#x2F;code&gt;, the wallet first simulates the transaction to obtain an estimate of the required limit(s) $\mathbf{l}$. It then queries the network for the current vector of base fees $\mathbf{b}$. The expected total fee is $\sum b_i l_i$. The wallet recommends a &lt;code&gt;max_fee&lt;&#x2F;code&gt; that consists of this expected total cost plus a single buffer to account for aggregate volatility in base fees before the transaction is included. To suggest a &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, the wallet analyzes recent blocks to determine the priority fees that ensure timely inclusion. It focuses on priority fees paid by recently included transactions consuming a similar distribution of resources, as well as overall network contention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-building&quot;&gt;Block building&lt;&#x2F;h3&gt;
&lt;p&gt;Historical data show that around 90% of blocks are below the gas limit. It is only when blocks are full that the builder is constrained in its block construction (disregarding timing games). Furthermore, a multidimensional knapsack problem only manifests in the event that a block is simultaneously full in multiple dimensions. Ignoring blobs, this is expected to be rare with the proposal, since calldata is assigned a limit four times above the target, which is already set higher than current consumption. The calldata limit is thus unlikely to be reached frequently. The blob dimension is a special case, in that this dimension already exists today, and the number of blob-carrying transactions is fairly low. Generally, the impact on revenue from sophisticated packing algorithms will likely be dwarfed by more significant MEV factors such as transaction ordering and private order flow.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-calldata-resource&quot;&gt;The calldata resource&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;byte-sizes&quot;&gt;Byte sizes&lt;&#x2F;h4&gt;
&lt;p&gt;Calldata is separated into its own resource. With the proposed constants, at 60M execution gas, each block will on average contain &lt;code&gt;60M&#x2F;(CALLDATA_GAS_LIMIT_RATIO * CALLDATA_LIMIT_TARGET_RATIO) = 3.75M&lt;&#x2F;code&gt; gas of calldata. Focusing on non-zero bytes that cannot be Snappy-compressed, this gas corresponds to around &lt;code&gt;3.75M&#x2F;16 = 234kB&lt;&#x2F;code&gt;. The average block size has been around &lt;code&gt;90kB&lt;&#x2F;code&gt; at a 36M gas limit, which would expand to &lt;code&gt;150kB&lt;&#x2F;code&gt; at a 60M gas limit if the proportion of calldata in the block remains the same. Using basic assumptions, this proposal thus increases the amount of calldata that will be consumed by over 50%, from &lt;code&gt;150kB&lt;&#x2F;code&gt; to &lt;code&gt;234kB&lt;&#x2F;code&gt; at 60M gas. As pointed out in EIP-7706, this will serve to decrease the cost of calldata for our users.&lt;&#x2F;p&gt;
&lt;p&gt;The limit is &lt;code&gt;60M&#x2F;CALLDATA_GAS_LIMIT_RATIO = 15M&lt;&#x2F;code&gt; gas of calldata, corresponding to around &lt;code&gt;15M&#x2F;16 = 938kB&lt;&#x2F;code&gt;. This is well below the limit under the current specification incorporating EIP‑7623, which is &lt;code&gt;60M&#x2F;40 = 1.5MB&lt;&#x2F;code&gt; at 60M gas. Since calldata gas is also no longer accounted for as execution gas, the implied &quot;aggregate&quot; gas limit expands to &lt;code&gt;75M&lt;&#x2F;code&gt; gas, without materially affecting the maximum workload in terms of execution. In conclusion, the separation of calldata into its own resource increases calldata throughput while reducing costs. It furthermore facilitates scaling by allowing for faster payload propagation in the worst case and keeping all EVM gas available for other operations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;censorship-resistance-1&quot;&gt;Censorship resistance&lt;&#x2F;h4&gt;
&lt;p&gt;For censorship resistance (CR) purposes, under the currently proposed CR implementation EIP-7805, builders must include all transactions surfaced in any of the &lt;code&gt;16&lt;&#x2F;code&gt; inclusion lists (ILs) of each slot (each up to &lt;code&gt;8KiB&lt;&#x2F;code&gt;). However, if the block is full, builders can ignore the ILs, to not incentivize them to influence includers for MEV purposes.&lt;&#x2F;p&gt;
&lt;p&gt;When resources have separate limits, the block is treated as &quot;full&quot; already when any single conditional resource reaches its limit. Transactions that use that resource can then be excluded, even if they were surfaced by an IL. This makes it potentially cheaper to &quot;stuff the block&quot; to censor transactions. Specifically, a builder can create dummy transactions consuming a single resource to fill that dimension, ensuring that the block is treated as &quot;full&quot; when evaluating IL transactions. When resources have separate base fees, the builder may target a resource with a lower base fee, at a cost of roughly $b_i \cdot \Delta g_i$, where $\Delta g_i$ is the additional gas in resource $i$ required to reach its limit.&lt;&#x2F;p&gt;
&lt;p&gt;The good news is that calldata has properties allowing the builder to extract MEV while at the same time unconditionally adhering to its gas limit under EIP-7805. This means that this EIP does not impede censorship resistance. Specifically, in the case where all ILs are filled with disjoint transactions, the aggregate size of included transactions can still be at most &lt;code&gt;8KiB*16 = 131kB&lt;&#x2F;code&gt;. This leaves at the very minimum &lt;code&gt;938kB - 131kB = 807kB&lt;&#x2F;code&gt; of calldata for the builder to use as it sees fit when extracting MEV, which is sufficient according to the usage patterns we know.&lt;&#x2F;p&gt;
&lt;p&gt;Accordingly, calldata is treated as an &quot;unconditional&quot; resource, as defined in the specification. An includer MUST therefore signal &lt;code&gt;INVALID_INCLUSION_LIST&lt;&#x2F;code&gt; if—and only if—a calldata‑using IL transaction is omitted despite sufficient capacity remaining in all conditional resources it uses. When considering expansion into further resources with tighter conditional limits, it may be necessary to adopt a version of FOCIL with ranked transactions (FOCILR).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reserve-price&quot;&gt;Reserve price&lt;&#x2F;h4&gt;
&lt;p&gt;An EIP-7918 reserve price is used for calldata just as for blobs. This ensures that the equilibrium price does not fall to levels where the fee market update mechanism stops working satisfactorily. Furthermore, the expiry window for blobs is much shorter than the planned rolling expiry window for calldata, making a modest relative reserve price motivated from a resource preservation perspective. Finally, without a reserve price on calldata, it could become cheaper than blob data (particularly below the blob reserve price), and thus a rational choice for L2s.&lt;&#x2F;p&gt;
&lt;p&gt;The latter rationale also motivates the specific parameterization chosen. The EIP-7918 reserve price per byte for calldata is set 1&#x2F;3 above the price per byte for blob data. This is achieved by tying the EIP-7918 if clause to the &lt;em&gt;blob base fee&lt;&#x2F;em&gt;. The gas per byte is 16 for calldata and 1 for blob data, and the price floor is triggered when &lt;code&gt;base_fees[1] &amp;gt; GAS_RESERVE_FACTOR[2] * base_fees[2]&lt;&#x2F;code&gt;. Given &lt;code&gt;GAS_RESERVE_FACTOR[2] = 12&lt;&#x2F;code&gt;, the EIP-7918 condition activates when the blob base fee is more than &lt;code&gt;12&lt;&#x2F;code&gt; times higher than the calldata base fee, at which point calldata costs less than &lt;code&gt;16&#x2F;12 = 1+1&#x2F;3&lt;&#x2F;code&gt; of the blob price per byte. The calldata base fee is then imposed to not fall further.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;relationship-to-previous-eips-and-other-resources&quot;&gt;Relationship to previous EIPs and other resources&lt;&#x2F;h4&gt;
&lt;p&gt;We acknowledge that calldata already has been limited by EIP-7623, with further repricings proposed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;&quot;&gt;EIP-7976&lt;&#x2F;a&gt;. These EIPs limit worst-case block sizes by metering and conditionally pricing calldata at the transaction level as opposed to at the block level, having the calldata price vary with a transaction&#x27;s execution usage. This may lead to secondary markets if users wish to combine different transactions to take advantage of the &quot;rebate&quot; on calldata when consumed together with EVM gas. Treating calldata as a separate resource with a price based on block usage would allow for a more precise control over usage, and transactors would not need to interact with a secondary market to achieve the best price.&lt;&#x2F;p&gt;
&lt;p&gt;Given that the EIP-7623 design already achieves calldata moderation, it must be remembered that an individual fee market for calldata would merely be a first step toward a multidimensional fee market. Calldata is not an endgame. It is likely best to transition over several hard forks, and the options available at the present must then be considered, which leads to a focus on calldata. Another present consideration is block level access lists (BALs) and their interaction.&lt;&#x2F;p&gt;
&lt;p&gt;A resource such as state is more attractive to separate than calldata. We could achieve exact control over state growth, while allowing temporary spikes many times above current gas limits. However, an expansion into other resources requires a multidimensional gas repricing, which has currently not yet been completed. The next section will further discuss remaining complexities of multidimensional EVM gas, and the strategies available for overcoming them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expansion-paths-for-multiple-evm-resources&quot;&gt;Expansion paths for multiple EVM resources&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP has been designed to facilitate a future expansion into multiple EVM resources. We conclude by outlining the challenges inherent to such an expansion, and the different paths that it can take.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;evm-without-gas-observability&quot;&gt;EVM without gas observability&lt;&#x2F;h4&gt;
&lt;p&gt;One long-term vision for the EVM is to move away from gas observability. This is one of the features of EOF (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt;), e.g., through revamped &lt;code&gt;CALL&lt;&#x2F;code&gt; instructions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7069&#x2F;&quot;&gt;EIP-7069&lt;&#x2F;a&gt; such as &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;. The new calls no longer accept a gas stipend as an input parameter, and the EVM instead makes available some reasonable fraction of all gas across dimensions (e.g., 63&#x2F;64). Legitimate use cases previously handled via gas observability are then instead taken over by, e.g., the &lt;code&gt;PAY&lt;&#x2F;code&gt; opcode &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5920&#x2F;&quot;&gt;EIP-5920&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For compatibility with legacy code, the EVM can in this scenario reinterpret legacy subcalls with a gas parameter by forwarding the same fraction of the caller’s remaining budget in each resource dimension. Concretely, if the call stipulates $g_c$ and the aggregate remaining EVM-gas budget is $g_a$, the callee receives, for each EVM resource with remaining budget $g_r$, the amount $\bigl\lfloor g_r \cdot \min!\bigl(1,\tfrac{g_c}{g_a}\bigr) \bigr\rfloor$. For completeness, the &lt;code&gt;GAS&lt;&#x2F;code&gt; opcode could likewise return, e.g., $g_a$ (the per-call aggregate remaining budget at this point across all resource dimensions). Note, however, that reinterpreting legacy calls and &lt;code&gt;GAS&lt;&#x2F;code&gt; in this way can still change the behavior of contracts that rely on precise gas observability or gas-capped subcalls, and such contracts may break.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;evm-that-retains-gas-observability&quot;&gt;EVM that retains gas observability&lt;&#x2F;h4&gt;
&lt;p&gt;It is possible to expand into multiple EVM resource dimensions without breaking existing contracts that rely on gas observability. By treating gas as &lt;em&gt;fungible across resources&lt;&#x2F;em&gt; (just as today), a single budget can be forwarded and counted toward any resource that consumes it. It should be noted that old contracts may still break due to repricing of the resources they use; indeed, a gas repricing effort is currently underway in Ethereum that likely will cause such breakage. But this may be treated as a separate concern.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-types-under-multiple-evm-resources-with-non-deterministic-limits&quot;&gt;Transaction types under multiple EVM resources with non-deterministic limits&lt;&#x2F;h4&gt;
&lt;p&gt;A key difference between the new and old transaction types is that the old transaction types set only one limit, whereas the new can set several. When adding deterministic resources such as calldata, this is not a concern, because consumption of this resource can be deducted from the user-specified limit as a pre-processing step. But once there is more than one non-deterministic resource—as can be the case when EVM gas is separated into several resources—things get slightly more complicated. If we wish to ensure that old transaction types still can function properly under these circumstances, we must apply the single limit to multiple non-deterministic resources. The following subsections will outline how this can be achieved by aggregating the gas of these separate resources during EVM processing.&lt;&#x2F;p&gt;
&lt;p&gt;The new transaction type can supply several limits, making expansion into multiple EVM resources more straightforward. However, it turns out that we may also wish to retain the ability of the new transaction type to set a single limit for EVM gas. The reason is that the single limit and aggregate processing facilitates backward compatibility for contracts that rely on gas observability. As previously noted, these contracts must be able to supply subcalls with an aggregate gas stipend, to be counted against any EVM resource. Furthermore, there is an inherent simplicity of the single limit that is not to be discounted.&lt;&#x2F;p&gt;
&lt;p&gt;In all considered approaches below, the number of non-deterministic EVM resources still increases at the &lt;em&gt;block level&lt;&#x2F;em&gt;. To retain the ability to reject a transaction that may require more gas for a resource than its associated block limit, it becomes necessary to alter the check on &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt;. Specifically, when a transaction stipulates only the main EVM gas limit, then this limit must be conservatively counted toward all underspecified dimensions of &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt; before the limit check:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_used_so_far&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Same check as previously&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_less_or_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_used_so_far&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The joint EVM gas limit is expanded to cover all block resources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    all_less_or_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas_used_so_far&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits_exp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;multidimensional-gas-metering&quot;&gt;Multidimensional gas metering&lt;&#x2F;h4&gt;
&lt;p&gt;An existing proposal by Inês Silva and Crapis is &lt;em&gt;Multidimensional gas metering&lt;&#x2F;em&gt; (not yet submitted as an EIP), which prices gas in one dimension, but applies limits at the block level across several dimensions when updating the (single) EVM base fee. The EVM will thus track multidimensional gas consumption, but perform the limit check on the aggregate, which is also passed on in subcalls. The proposed EIP could be combined with Multidimensional gas metering, for example by using a single EVM gas and calculating metered block gas usage separately, before submitting the outcome as a single resource dimension to the revamped &lt;code&gt;calc_excess_gas()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market-with-aggregate-evm-gas&quot;&gt;Multidimensional fee market with aggregate EVM gas&lt;&#x2F;h4&gt;
&lt;p&gt;To promote full resource utilization while maintaining backward compatibility for subcalls and old transaction formats, we could instead use &lt;em&gt;separate&lt;&#x2F;em&gt; gas prices for each EVM resource, while retaining within the EVM the ability to &lt;em&gt;aggregate the gas&lt;&#x2F;em&gt; consumption across resources. We refer to this as a &lt;em&gt;Multidimensional fee market with aggregate gas&lt;&#x2F;em&gt;. In the fully aggregated scenario, the user stipulates a single &lt;code&gt;gas_limit&lt;&#x2F;code&gt; for EVM gas, and the protocol must make sure that the &lt;code&gt;max_fee&lt;&#x2F;code&gt; covers the maximum possible fee, from consuming &lt;code&gt;gas_limit&lt;&#x2F;code&gt; of the EVM resource that has the most expensive base fee. Execution is then fully backward compatible, and the EVM operates the same way as with Multidimensional gas metering.&lt;&#x2F;p&gt;
&lt;p&gt;The downside is that the user must stipulate an unnecessarily high &lt;code&gt;max_fee&lt;&#x2F;code&gt; allocation, if the most expensive resource is not used. We present three options for alleviating this. The first two options transfer to the block producer the responsibility to ensure that the &lt;code&gt;max_fee&lt;&#x2F;code&gt; indeed covers a transaction&#x27;s fees determined post-execution. The third option instead enables the transactor to alternatively provide better guarantees in the form of full gas limits.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Option 1:&lt;&#x2F;em&gt; Invalidate a block when the post-transaction check shows that the total fee for a transaction exceeded &lt;code&gt;max_fee&lt;&#x2F;code&gt;. We could either completely remove the pre-execution check &lt;code&gt;max_fee &amp;gt;= get_required_max_fee(base_fees, tx_gas_limits)&lt;&#x2F;code&gt;, or only check for deterministic resources in addition to EVM gas across the cheapest EVM resource. During processing, there would still be an aggregated check against the transaction&#x27;s gas limit, which is the sender&#x27;s responsibility. In extension, the block&#x27;s gas limit is already safeguarded pre-execution by conservatively counting &lt;code&gt;tx_gas_limits_exp&lt;&#x2F;code&gt; against it, as outlined in the previous subsection.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the inclusion guarantees of EIP-7805 will not apply to the transactions where the &lt;code&gt;max_fee&lt;&#x2F;code&gt; does not cover the worst-case pre-execution check. These transactions are to be ignored when validating the block post-execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Option 2:&lt;&#x2F;em&gt; Give the block producer the ability and responsibility to supply any missing funds as part of the post-transaction check. This could potentially rely on staked builders currently envisioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt;, albeit it would be more intuitive to use execution layer balances for this purpose. Another alternative is to charge a block-based base fee at the end of processing a block rather than per transaction, as has been discussed in the past. This naturally extends to a multidimensional setting. Note that (2) reverts to (1) upon failure of the builder to ensure the base fees are covered.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Option 3:&lt;&#x2F;em&gt; Give the transactor the ability to provide limits for all dimensions, if they so wish. The pre-execution check can then be more fine-grained, inheriting the higher capital efficiency previously outlined. This is a hybrid design, where the transactor can choose the option most suitable to their needs if they use the new transaction type.  This option will be discussed in more detail in the next subsection. Note that (3) can be combined with (1) if desirable.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;multidimensional-fee-market-with-hybrid-evm-gas&quot;&gt;Multidimensional fee market with hybrid EVM gas&lt;&#x2F;h4&gt;
&lt;p&gt;In a &lt;em&gt;Multidimensional fee market with hybrid EVM gas&lt;&#x2F;em&gt;, the user has separate options:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Provide a single gas limit for the EVM resources. The EVM can then operate as in the aggregate gas model, after the initial restrictive fee allocation check.&lt;&#x2F;li&gt;
&lt;li&gt;Provide a gas limit for each EVM resource. Capital efficiency is then preserved. The EVM operates without gas observability as previously outlined, with the gas parameter of old subcalls converted to a multidimensional counterpart. The transaction is during processing checked against its multiple limits, as opposed to the aggregate.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It is further possible to give the user the freedom to stipulate &lt;em&gt;some&lt;&#x2F;em&gt; EVM gas limits, but not all. The user can for example set the gas limit to 0 for any resource it knows that it will not use, instead of not setting a gas limit for that resource. The aggregation then takes place only across resources without an individual stipulated limit, reducing the required &lt;code&gt;max_fee&lt;&#x2F;code&gt; allocation while preserving full&#x2F;a higher level of backward compatibility. These features come at a cost of somewhat increased complexity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;specification-for-aggregate-and-hybrid-evm-gas&quot;&gt;Specification for aggregate and hybrid EVM gas&lt;&#x2F;h4&gt;
&lt;p&gt;For the hybrid model, the &lt;code&gt;get_gas_limits()&lt;&#x2F;code&gt; function must be updated to alternatively return multiple EVM gas limits, in the case the user stipulates the full list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MULTIDIM_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the aggregate model, the &lt;code&gt;get_required_max_fee()&lt;&#x2F;code&gt; must be updated such that the protocol applies the worst-case EVM base fees across the EVM gas. The new constant &lt;code&gt;EVM_INDICES&lt;&#x2F;code&gt; specifies the EVM resource indices. Note that &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; is treated as a deterministic component of the EVM gas to reduce required capital allocation. Note that even when pursuing Options 1-2 for aggregate gas, the aggregation step is still applied in consideration of EIP-7805.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_required_max_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fully specified gas limits, apply baseline pattern&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vector_mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Otherwise: 1. TX_BASE_COST is treated deterministically (assumed resource 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    determ_evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Limit MUST cover TX_BASE_COST.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    variable_evm_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Determine EVM cost based on most expensive resource&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_evm_base_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EVM_INDICES&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; determ_evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; variable_evm_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; max_evm_base_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Return total EVM cost + blob cost + calldata cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; evm_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fees&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;tx_gas_limits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the hybrid model, the line stipulating &lt;code&gt;tip_indices&lt;&#x2F;code&gt; in &lt;code&gt;get_max_priority_fee()&lt;&#x2F;code&gt; must be updated to include all new EVM resources &lt;code&gt;tip_indices = [2] + EVM_INDICES&lt;&#x2F;code&gt;. It is also feasible to adjust the functioning of legacy transactions, to let them tip only according to the headroom between the EVM resource with the highest base fee and the &lt;code&gt;gasprice&lt;&#x2F;code&gt;. The aim would be to prevent them from having to pay an excessive tip when the &lt;code&gt;gasprice&lt;&#x2F;code&gt; was set high merely to cover for the EVM resource with the highest base fee (of which they use little). The tip would then be calculated as the premium above the highest EVM resource base fee.&lt;&#x2F;p&gt;
&lt;p&gt;To allow transactors to specify &lt;em&gt;some&lt;&#x2F;em&gt; limits, the &lt;code&gt;tx.gas_limit&lt;&#x2F;code&gt; list must instead have a nested format, where &lt;code&gt;gas_limit[0]&lt;&#x2F;code&gt; is the aggregate limit for unspecified EVM resources, and &lt;code&gt;[index, limit]&lt;&#x2F;code&gt; pairs then follow: &lt;code&gt;tx.gas_limit = [aggregate, [[index, limit], [index, limit],...]]&lt;&#x2F;code&gt;. The protocol then computes the required max fee from resources with both specified and unspecified limits. The maximum base fee among the resources with unspecified limits is in this case multiplied with the aggregate, and this fee is summed together with the fees of specified limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; of the EIP-1559 and EIP-4844 transaction types are converted to a &lt;code&gt;max_fee&lt;&#x2F;code&gt; by multiplication with the stipulated gas limit(s). The converted EIP-4844 transactions will no longer adhere to the individual &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt;, but instead to the aggregated &lt;code&gt;max_fee&lt;&#x2F;code&gt;. This is a deliberate choice since previous individual checks have lower economic efficiency to no clear benefit, but it should nevertheless be noted by transactors. The priority fee retains the same functionality as previously. The old &lt;code&gt;gasprice&lt;&#x2F;code&gt; can be used both for the &lt;code&gt;max_fee&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;. The &lt;code&gt;gas_limit&lt;&#x2F;code&gt; is finally derived deterministically. The section on expansion paths outlined how old transactions can retain functionality as we expand into several non-deterministic EVM resources.&lt;&#x2F;p&gt;
&lt;p&gt;Backward compatibility for contracts that rely on gas introspection can be resolved by giving users the ability to rely on aggregated EVM gas, while still potentially pricing EVM resources separately. Wallets must be updated to handle multidimensional gas accounting with several base fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;One concern is the risk of increasing builder centralization due to increased revenue from sophisticated packing algorithms. While the builder is constrained in its block construction when blocks are full, it is only when several limits are reached at the same time that packing complexity markedly changes from today. Given that around 90% of blocks are below the gas limit, and the calldata limit is set to be very permissive, we argue that this will happen very rarely.&lt;&#x2F;p&gt;
&lt;p&gt;One reason for using &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; instead of &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt; is to establish the priority fee as always having a non-aggregate representation. We could possibly otherwise imagine a scenario where a user in the old transaction format manually submits an aggregate &lt;code&gt;max_fee&lt;&#x2F;code&gt; and &lt;code&gt;max_priority_fee&lt;&#x2F;code&gt;, causing loss of funds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deterministic Factory Predeploy</title>
        <published>2025-08-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francisco Giordano</name><uri>https://github.com/frangio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7997/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7997-deterministic-factory-predeploy/24998" />
        

        <id>https://wg-eips.ritovision.com/7997/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7997"
            label="EIP-7997" />
        

        
        

        
        <summary type="html">A minimal `CREATE2` factory shared by EVM chains.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7997/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A minimal &lt;code&gt;CREATE2&lt;&#x2F;code&gt; factory is inserted as a system contract in the precompile range, to enable deterministic deployments at identical addresses across EVM chains. This benefits developer experience, user experience, and security, in particular for multi-chain and cross-chain applications, including account abstraction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are now a large number of EVM chains where users want to transact and developers want to deploy applications, and we can expect this number to continue to grow in line with Ethereum&#x27;s rollup-centric roadmap and the general adoption of programmable blockchains.&lt;&#x2F;p&gt;
&lt;p&gt;Most applications support multiple chains and aspire to support as many as possible, and their developers widely prefer to deploy contracts at identical addresses across all chains, a setup which we will call &lt;em&gt;multi-chain deterministic deployment&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This kind of deployment reduces the number of addresses that must be distributed to use the application, so that it no longer scales with the number of supported chains. This simplification has many benefits throughout the stack: interfaces and SDKs need to embed and trust fewer addresses, and other contracts that depend on them can be implemented without chain-specific customization (which in turn makes them amenable to multi-chain deployment).&lt;&#x2F;p&gt;
&lt;p&gt;This kind of deployment is also highly desirable and important for account abstraction. Without it, a user&#x27;s smart contract accounts are deployed at different addresses on different chains, and each account is tied to a single chain. This limitation is difficult to explain to users and has caused loss of funds. If smart contract accounts cannot be multi-chain like EOAs, they offer downgraded UX and are more prone to error.&lt;&#x2F;p&gt;
&lt;p&gt;There is currently no native or fully robust way to perform multi-chain deterministic deployments. While &lt;code&gt;CREATE2&lt;&#x2F;code&gt; enables deterministic deployments, the created address is computed from that of the contract that invokes the instruction, so a &lt;em&gt;factory&lt;&#x2F;em&gt; that is itself multi-chain is required for bootstrapping. Four workarounds are currently known to deploy such a factory, each with their own issues:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A keyless transaction is crafted using Nick&#x27;s method that can be posted permissionlessly to new chains. For this to work, the chain must support legacy transactions without &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; replay protection, and the fixed gas price and gas limit must be sufficiently high, but not so high as to exceed the limits of the chain.&lt;&#x2F;li&gt;
&lt;li&gt;Private keys held by some party are used to sign creation transactions for each chain as needed. This creates a dependency on that party, does not provide a hard guarantee that the factory will be available on every chain, and can also irreversibly fail if transactions are not properly parameterized.&lt;&#x2F;li&gt;
&lt;li&gt;A private key is intentionally leaked so that any party can permissionlessly create an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; signed delegation and deploy a factory from the leaked account. While this approach improves on the previous two, its reliance on ECDSA keys makes it non-quantum-resistant, and will fail once chains stop supporting ECDSA keys. Additionally, it requires EIP-7702, an orthogonal feature which is not guaranteed to spread to all chains; for example, those chains that tackle account abstraction through other means have no use for it, and arguably weaker ecosystem pressure to implement it (compared to other EIPs) given that it is a feature not directly used by applications (which instead access AA capabilities through an abstraction like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5792&#x2F;&quot;&gt;EIP-5792&lt;&#x2F;a&gt;). Lastly, there is a possibility that a future upgrade allows EIP-7702 delegations to become permanent, which breaks this scheme.&lt;&#x2F;li&gt;
&lt;li&gt;Factories already deployed on other chains (by any of the previous methods) are inserted in a new chain at genesis or via a hard fork. This has not been widely adopted by chains, despite the standardization efforts of RIP-7740. Since these factories are applications deployed by users through normal means, this kind of hardcoding of accounts may be seen by chain developers as too intrusive.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP aims to coordinate a widely available multi-chain &lt;code&gt;CREATE2&lt;&#x2F;code&gt; factory without the above downsides by placing a factory in the precompile range.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; = &lt;code&gt;0x12&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;factory-contract&quot;&gt;Factory Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, the account at &lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; becomes a contract that, when called, invokes the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instruction (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt;) with a salt equal to the first 32 bytes of the call&#x27;s input data, init code equal to the remaining data, and value equal to the call&#x27;s value. If input data is smaller than 32 bytes, the call reverts with empty return data. If creation fails (&lt;code&gt;CREATE2&lt;&#x2F;code&gt; outputs &lt;code&gt;0&lt;&#x2F;code&gt;), the call reverts with return data equal to that of the creation frame.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, the code of &lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; is set to &lt;code&gt;60203610602f5760003560203603806020600037600034f5806026573d600060003e3d6000fd5b60005260206000f35b60006000fd&lt;&#x2F;code&gt;. This code implements the specification above and corresponds to the following assembly:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#pragma target &amp;quot;constantinople&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Input: salt (32 bytes) || initcode (variable size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Verify input is at least 32 bytes long.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi @throw&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Load salt.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Compute initcodesize = calldatasize - 32.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Copy initcode to memory at position 0.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Invoke create2 with salt and initcode, forwarding all callvalue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;create2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Check if create2 produced nonzero.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push @success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; Fallthrough if zero, and revert with identical returndata.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returndatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;returndatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;;; On success, return the created address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;success:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;throw:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;precompile-range-system-contract&quot;&gt;Precompile-range system contract&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike previous system contracts, this factory cannot be deployed using a normal transaction because, as explained in the Motivation section, that transaction could not be guaranteed to be valid on other chains. Since the purpose of this factory is to be available in all EVM chains that a contract could be deployed to, an irregular insertion of the code into a special address seems necessary.&lt;&#x2F;p&gt;
&lt;p&gt;The address &lt;code&gt;0x12&lt;&#x2F;code&gt; (&lt;code&gt;0x0000000000000000000000000000000000000012&lt;&#x2F;code&gt;) is chosen as the next lowest address after currently accepted precompiles, on the assumption that other EVM chains would have reserved this range for future Ethereum precompiles.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;input-validation&quot;&gt;Input validation&lt;&#x2F;h3&gt;
&lt;p&gt;The factory reverts if the input is smaller than 32 bytes, the minimum size that contains the salt, to provide an explicit error when the factory is not correctly invoked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-frontrunning-protection&quot;&gt;No frontrunning protection&lt;&#x2F;h3&gt;
&lt;p&gt;As explained in the Security Considerations, deployments using this factory can potentially be frontrun.&lt;&#x2F;p&gt;
&lt;p&gt;A different factory could avoid this issue if it invokes &lt;code&gt;CREATE2&lt;&#x2F;code&gt; with a salt computed from the caller address in combination with the caller-provided salt input. This prevents frontrunning, but makes deployments permissioned to a deployer account, without the ability to recover permissionless deployments across chains because of the bootstrapping problem this EIP is itself meant to solve.&lt;&#x2F;p&gt;
&lt;p&gt;A factory could also support both permissioned and permissionless deployments by making the mechanism opt-in. However, the addition of this complexity to an otherwise very simple contract was deemed unnecessary, since once the bootstrapping problem is solved, further factories with a more comprehensive set of features and security measures can be deterministically deployed across chains. We expect this to be the case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-a-new-transaction-type&quot;&gt;Not a new transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative approach would consist of a new creation transaction type where the address of the created contract is computed in a way independent of the transaction origin. A system contract was considered a simpler approach that will be more robust to changes in the base layer in the future or across chains.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constantinople-target-avoidance-of-push0&quot;&gt;Constantinople target, avoidance of &lt;code&gt;PUSH0&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The system contract is written to avoid the use of newer opcodes such as &lt;code&gt;PUSH0&lt;&#x2F;code&gt; to make it viable to be adopted by chains that don&#x27;t yet support them, decoupling the decision to adopt this EIP from that of adopting other EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;FACTORY_ADDRESS&lt;&#x2F;code&gt; must not be used by other precompiles or predeploys upon activation of this EIP on a chain. The constant must be chosen to minimize likelihood that this happens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;frontrunnable-deployments&quot;&gt;Frontrunnable deployments&lt;&#x2F;h3&gt;
&lt;p&gt;The deployment of contracts that read the environment (&lt;code&gt;ORIGIN&lt;&#x2F;code&gt;, &lt;code&gt;NUMBER&lt;&#x2F;code&gt;, etc.) may be frontrun and created with attacker-chosen parameters. It&#x27;s recommended to use this factory to deploy fully deterministic contracts only.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Turn `randao_reveal` into a VRF</title>
        <published>2025-08-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alberto La Rocca</name><uri>https://github.com/71104</uri>
	</author>
	
	<author>
		<name>Aryaethn</name><uri>https://github.com/aryaethn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7998/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7998-turn-randao-reveal-into-a-vrf/24999" />
        

        <id>https://wg-eips.ritovision.com/7998/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7998"
            label="EIP-7998" />
        

        
        

        
        <summary type="html">Transforms Ethereum’s `randao_reveal` into a per-slot BLS-based VRF by signing the previous epoch’s mix and current slot.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7998/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a modification to the data signed by a block proposer for the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt;. The current &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is a BLS signature over the current epoch number, which is predictable. This proposal incorporates the RANDAO mix of the previous epoch and the current slot number into the signed data. This change transforms the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; into a Verifiable Random Function (VRF), making it unpredictable across epochs even for the revealer itself. This enhancement strengthens Ethereum&#x27;s native randomness source and enables protocols such as Single Secret Leader Election (SSLE).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This change creates a secure, per-slot VRF output from the proposer, with several benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;it &lt;strong&gt;paves the way for secret proposer election&lt;&#x2F;strong&gt;, which would in turn reduce MEV and completely eliminate the well-known RANDAO bias attack vector;&lt;&#x2F;li&gt;
&lt;li&gt;it supports other proposals like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7956&#x2F;&quot;&gt;EIP-7956&lt;&#x2F;a&gt; that rely on a source of verifiable randomness.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Using a BLS signature as a VRF is sound under the Computational Diffie-Hellman (CDH) assumption, rather than Decisional Diffie-Hellman. The BLS verification process inherently proves the correctness of the VRF output without requiring a separate proof.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc2119&quot;&gt;RFC 2119&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rfc-editor.org&#x2F;rfc&#x2F;rfc8174&quot;&gt;RFC 8174&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gist of the change is in &lt;code&gt;process_randao&lt;&#x2F;code&gt;, which now uses the RANDAO mix of the previous epoch and the current slot number to seed the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; signature. We are introducing a new SSZ-serializable container called &lt;code&gt;RandaoRevealSeed&lt;&#x2F;code&gt; containing that information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-ssz-container&quot;&gt;New SSZ Container&lt;&#x2F;h3&gt;
&lt;p&gt;A new SSZ &lt;code&gt;Container&lt;&#x2F;code&gt; is introduced to serve as the message for the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; signature post-fork.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RandaoRevealSeed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_mix&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; last RANDAO mix of the previous epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;             #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current slot number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;modified-process-randao&quot;&gt;Modified &lt;code&gt;process_randao&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The block processing function &lt;code&gt;process_randao&lt;&#x2F;code&gt; in the beacon state transition is modified.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;FORK_EPOCH&lt;&#x2F;code&gt; be the epoch of the network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;The logic for verifying &lt;code&gt;body.randao_reveal&lt;&#x2F;code&gt; within &lt;code&gt;process_randao&lt;&#x2F;code&gt; is updated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_randao&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; body&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockBody&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify RANDAO reveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;get_beacon_proposer_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_signing_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_RANDAO&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_previous_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_mix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_randao_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; previous_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RandaoRevealSeed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;previous_mix&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_signing_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_RANDAO&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; bls&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proposer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mix in RANDAO reveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; xor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_randao_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;randao_mixes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_HISTORICAL_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;choice-of-vrf-input&quot;&gt;Choice of VRF Input&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is effectively transformed into &lt;code&gt;VRF(sk, message)&lt;&#x2F;code&gt; where the &lt;code&gt;message&lt;&#x2F;code&gt; is the SSZ serialization of the &lt;code&gt;RandaoRevealSeed&lt;&#x2F;code&gt; container.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;previous_mix&lt;&#x2F;code&gt;: Including the RANDAO mix from the previous epoch (&lt;code&gt;previous_mix&lt;&#x2F;code&gt;) is the core of this proposal. Since the previous epoch&#x27;s final mix is not known until the end of that epoch, a proposer cannot compute their &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; of future epochs, beforehand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;slot&lt;&#x2F;code&gt;: Including the current &lt;code&gt;slot&lt;&#x2F;code&gt; number ensures that the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is unique for each slot and unpredictable to other validators. Without it, a validator chosen to propose multiple times in an epoch would produce the same reveal, which is undesirable for protocols that require unique randomness per instance, such as SSLE.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alternatives-considered&quot;&gt;Alternatives Considered&lt;&#x2F;h3&gt;
&lt;p&gt;We considered adding the &lt;em&gt;latest&lt;&#x2F;em&gt; RANDAO mix rather than that from the previous epoch so that we could obtain per-slot unpredictability, but that would cause fork ambiguity in the future if &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is used to implement SSLE.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change to the consensus rules and MUST be activated as part of a scheduled network upgrade (i.e., a hard fork).&lt;&#x2F;p&gt;
&lt;p&gt;Blocks produced after the &lt;code&gt;FORK_EPOCH&lt;&#x2F;code&gt; that do not use the new &lt;code&gt;RandaoRevealSeed&lt;&#x2F;code&gt; structure for the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; signature SHALL be considered invalid. Pre-fork blocks remain valid under the old rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;vrf-security&quot;&gt;VRF Security&lt;&#x2F;h3&gt;
&lt;p&gt;The security of the BLS signature scheme as a VRF relies on the Computational Diffie-Hellman (CDH) assumption in the target group. This is a standard cryptographic assumption. The output of the signature (a uniformly distributed G2 point in compressed format) can be treated as a pseudorandom number.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;grinding&quot;&gt;Grinding&lt;&#x2F;h3&gt;
&lt;p&gt;The value of &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; is deterministic and cannot be manipulated. It will be verified with the public BLS key of the validator, so it must be calculated using the corresponding private key. There are no grindable elements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;slot-by-slot-unpredictability&quot;&gt;Slot-by-slot Unpredictability&lt;&#x2F;h3&gt;
&lt;p&gt;Including the slot number is superfluous at the moment because it does not make the VRF slot-by-slot unpredictable to the revealer, only to other validators. But it will become critical in the future if and when we decide to implement secret proposer election and&#x2F;or EIP-7956.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ed25519 transaction support</title>
        <published>2025-06-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7980/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7980-adding-ed25519-as-a-signature-scheme-to-test-eip-7932/24663" />
        

        <id>https://wg-eips.ritovision.com/7980/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7980"
            label="EIP-7980" />
        

        
        

        
        <summary type="html">Adds an EIP-7932 algorithm type for Ed25519 support of type `0x0`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7980/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithm of type &lt;code&gt;0x0&lt;&#x2F;code&gt; for supporting Ed25519 signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ed25519 is one of the most widely used forms of Elliptic Curve Cryptography and is one of the defaults for SSH keys,
this makes it a good contender to be able to sign transactions with. It also provides an algorithm to write test
cases against during the implementation phase of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt; algorithmic type with the following parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ALG_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PENALTY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;96&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature_info&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  public_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature_info&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the `Verify` function described in [RFC 8032 Section 5.1.7](https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;doc&#x2F;html&#x2F;rfc8032#section-5.1.7),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This MUST be processed as raw `Ed25519` and not `Ed25519ctx` or `Ed25519ph`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ed25519_verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; payload_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;additional-1000-gas-penalty&quot;&gt;Additional 1000 gas penalty&lt;&#x2F;h3&gt;
&lt;p&gt;The gas penalty discourages people from attempting to migrate off current secp256k1 accounts, and also covers the additional overhead (in regards to hashing) that the ed25519 curve applies.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-ed25519&quot;&gt;Why Ed25519?&lt;&#x2F;h3&gt;
&lt;p&gt;Ed25519 has significant tooling backing it, this makes it a good candidate for using as a &quot;dummy&quot; algorithm.
This allows it to be an algorithm for client teams to easily test &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It may also be useful for signing in Hardware security modules in server environments designed for serving
as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; bundlers. It may also improve interoperability with other components such as TPM chips.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;appending-the-public-key-to-the-signature&quot;&gt;Appending the public key to the signature&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, without changing the algorithm itself, it is impossible to efficiently recover the public key
from a signature and message.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Calldata Floor Cost</title>
        <published>2025-06-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7976/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7976-further-increase-calldata-cost/24597" />
        

        <id>https://wg-eips.ritovision.com/7976/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7976"
            label="EIP-7976" />
        

        
        

        
        <summary type="html">Increase the calldata floor cost to 15&#x2F;60 gas per byte to reduce maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7976/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an adjustment to calldata pricing by raising the floor cost from 10&#x2F;40 to 15&#x2F;60 gas per zero&#x2F;non-zero calldata byte. This reduces the worst-case block size by ~33% with minimal impact.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; successfully reduced the maximum possible block size by introducing a floor cost of 10&#x2F;40 gas per byte for data-heavy transactions, continued increases in gas limit demands further optimization. The current floor cost still permits relatively large data-heavy payloads that contribute to block size variance.&lt;&#x2F;p&gt;
&lt;p&gt;By increasing the floor cost to 15&#x2F;60 gas per byte, this proposal aims to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Further reduce the maximum possible block size for data-heavy transactions&lt;&#x2F;li&gt;
&lt;li&gt;Create additional headroom for potential block gas limit increases&lt;&#x2F;li&gt;
&lt;li&gt;Maintain the same exemption for transactions with significant EVM computation&lt;&#x2F;li&gt;
&lt;li&gt;Have minimal impact on users&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STANDARD_TOKEN_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;15&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Let &lt;code&gt;tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;isContractCreation&lt;&#x2F;code&gt; be a boolean indicating the respective event.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;execution_gas_used&lt;&#x2F;code&gt; be the gas used for EVM execution with the gas refund subtracted.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; be 2 as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The formula for determining the gas used per transaction changes from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&#x27;s implementation to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;21000 + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata&lt;&#x2F;code&gt; or below its intrinsic gas cost (take the maximum of these two calculations) is considered invalid. This limitation exists because transactions must cover the floor price of their calldata without relying on the execution of the transaction. There are valid cases where &lt;code&gt;gasUsed&lt;&#x2F;code&gt; will be below this floor price, but the floor price needs to be reserved in the transaction gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&#x27;s implementation, data-heavy transactions cost 10&#x2F;40 gas per zero&#x2F;non-zero byte, reducing the maximum possible EL payload size to approximately 1.07 MB (&lt;code&gt;45s_000_000&#x2F;40&lt;&#x2F;code&gt;). This EIP further reduces this to approximately 0.72 MB (&lt;code&gt;45_000_000&#x2F;60&lt;&#x2F;code&gt;) for non zero bytes and maintains proportional costs for non-zero bytes.&lt;&#x2F;p&gt;
&lt;p&gt;By increasing calldata costs from 10&#x2F;40 to 15&#x2F;60 gas per byte for data-heavy transactions, this EIP provides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Enhanced block size reduction&lt;&#x2F;strong&gt;: Maximum data-heavy payload size drops by ~33%.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Maintained user experience&lt;&#x2F;strong&gt;: Regular users engaging in DeFi, token transfers, and other EVM-heavy operations remain unaffected&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Better blob incentivization&lt;&#x2F;strong&gt;: Higher calldata costs further encourage migration to blob usage for data availability&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The floor cost mechanism ensures that transactions involving significant EVM computation continue to pay the standard 4&#x2F;16 gas per byte for calldata, preserving the user experience for regular Ethereum operations.&lt;&#x2F;p&gt;
&lt;p&gt;Analyzing the block range 20644414 - 23272414 (Sept. 2024 - Sept. 2025), 1.5% of all transactions would have been affected.&lt;&#x2F;p&gt;
&lt;p&gt;An empirical analysis summarizing the impact of this EIP can be found in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;assets&#x2F;eip7976_empirical_analysis&#x2F;&quot;&gt;this&lt;&#x2F;a&gt; report.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Wallets&lt;&#x2F;strong&gt;: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated &lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt; parameter of 15. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Node Software&lt;&#x2F;strong&gt;: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new floor cost values.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Testing for this EIP should verify the correct application of the new calldata cost floor of 15&#x2F;60 gas per zero&#x2F;non-zero byte:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Data-heavy transactions&lt;&#x2F;strong&gt;: Verify transactions with minimal EVM execution pay the floor cost of 15 gas per calldata token&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EVM-heavy transactions&lt;&#x2F;strong&gt;: Confirm transactions with significant computation continue using standard 4&#x2F;16 gas per byte&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Edge cases&lt;&#x2F;strong&gt;: Test transactions at the boundary where execution gas equals or exceeds the floor cost&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas estimation&lt;&#x2F;strong&gt;: Validate that &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; correctly accounts for the new &lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt; value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Invalid transactions&lt;&#x2F;strong&gt;: Ensure transactions with insufficient gas limits are properly rejected&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As the maximum possible block size is further reduced compared to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;, no additional security concerns are introduced beyond those already addressed in the original proposal.&lt;&#x2F;p&gt;
&lt;p&gt;The same transaction bundling considerations from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; apply:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transaction bundling was already possible and remains so&lt;&#x2F;li&gt;
&lt;li&gt;Bundling does not compromise the block size reduction objectives&lt;&#x2F;li&gt;
&lt;li&gt;Practical limitations (trust, coordination) continue to limit widespread bundling&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The increased floor cost strengthens the incentive structure for appropriate data availability method selection without introducing new attack vectors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Warm Account Write Metering</title>
        <published>2025-06-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7973/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7973-warm-account-write-metering/25907" />
        

        <id>https://wg-eips.ritovision.com/7973/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7973"
            label="EIP-7973" />
        

        
        

        
        <summary type="html">Introduce warm account writes, decreasing the cost of writing to an account after the first write.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7973/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces warm metering for account writes. Namely, if one of the account fields (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;codehash&lt;&#x2F;code&gt;) is changed more than once in a transaction, the later writes are cheaper, since the state root update only happens once.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Updating the state root is one of the most expensive parts of block construction. Currently, multiple writes to storage are subject to a net gas metering, which reduces the cost of a storage write after the first write. However, updates to the account are subject to the same cost every time.&lt;&#x2F;p&gt;
&lt;p&gt;This means that, for example, making multiple WETH transfers to an account in a single transaction gets successfully cheaper as the cold access cost is amortized over the remaining accesses. At the same time, the same discount does not occur when making multiple native ETH transfers. This discourages people from using native ETH transfers, and unfairly penalizes potential future opcodes that involve value transfer, like &lt;code&gt;PAY&lt;&#x2F;code&gt; and &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP brings the gas cost of the account update more in line with the actual execution cost. Multiple writes within a transaction can be batched, meaning that, after the first write, the cost of updating the state root does not need to be charged again.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The parameters &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; and &lt;code&gt;GAS_STORAGE_UPDATE&lt;&#x2F;code&gt; are removed, and the following parameters are introduced:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Parameter&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Value&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_STORAGE_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Cost of a single update to the storage trie&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Cost of a single update to the account trie&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;GAS_WARM_WRITE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;TBD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;Cost of a warm update to a trie (i.e. does not trigger a new state root calculation)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;On the account-updating opcodes &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, and &lt;code&gt;*CALL&lt;&#x2F;code&gt;, instead of charging &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;code&gt; is charged if the account fields &lt;strong&gt;are equal&lt;&#x2F;strong&gt; to the transaction start values (i.e., they have not yet been updated by the transaction), or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_WARM_WRITE&lt;&#x2F;code&gt; is charged if the account fields &lt;strong&gt;are not equal&lt;&#x2F;strong&gt; to the transaction start values (i.e., they have already been updated before by the transaction).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; is also subjected to warm account metering. That is, this EIP splits the cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; into two components, the cost to update the account tuple, and the cost to update the state trie. Note that if the state trie has already been updated once in a transaction, the account tuple is already dirty, and so we can amortize the cost of updating the account tuple again. Thus, the gas cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and its refund logic is updated to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get original_value and current_value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_storage_original&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get account info&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;original_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account_original&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initialize gas cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge account write cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; original_account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_WRITE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge slot-specific costs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;message&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_target&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_SLOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_STORAGE_SET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_STORAGE_WRITE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_SLOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refund Counter Calculation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage is cleared for the first time in the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_STORAGE_CLEAR_REFUND&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; current_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Gas refund issued earlier to be reversed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_STORAGE_CLEAR_REFUND&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; new_value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage slot being restored to its original value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; original_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot was originally empty and was SET earlier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_STORAGE_SET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot was originally non-empty and was UPDATED earlier&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;                GAS_COLD_STORAGE_WRITE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_SLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_WARM_ACCESS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Refund account writting cost (only if cold)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; original_account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;refund_counter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_COLD_ACCOUNT_WRITE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; and parallel execution, if the accessed account shows updates in the Block-Level Access List (BAL) in a transaction indexed before the current transaction, then the values to compare against are taken from this entry instead of the account trie.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An account is represented within Ethereum as a tuple &lt;code&gt;(nonce, balance, storage_root, codehash)&lt;&#x2F;code&gt;. The account is a leaf of a Merkle Patricia Tree (MPT), while the &lt;code&gt;storage_root&lt;&#x2F;code&gt; is itself the root of the account&#x27;s MPT key-value store. An update to the account&#x27;s storage requires updating two MPTs (the account&#x27;s &lt;code&gt;storage_root&lt;&#x2F;code&gt;, as well as the global state root). Meanwhile, updating the other fields in an account requires updating only one MPT.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal clarifies the cost of updating state by introducing the &lt;code&gt;*_WRITE&lt;&#x2F;code&gt; parameters. It also separates the cost of a storage state root update (&lt;code&gt;GAS_COLD_STORAGE_ACCESS&lt;&#x2F;code&gt;) and the cost of an account state root update (&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;). This parametrization allows us to apply warm costing to account updates. When the same account is updated multiple times in the same transaction, the state root calculation can be batched and all updates can be done in the same calculation. Therefore, the cost of making more updates to an already updated account is not the same as the first update.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarking&quot;&gt;Benchmarking&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal does not yet have finalized numbers. To achieve this, we require stateful benchmarks, which are currently in development. Once we collect that data, we will set the final numbers.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;– TODO –&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;net-metering&quot;&gt;Net metering&lt;&#x2F;h3&gt;
&lt;p&gt;Net metering (i.e., issuing a refund if the final value at the end of the transaction is equal to the transaction start, à la &lt;code&gt;SSTORE&lt;&#x2F;code&gt;) was considered, but not added for simplicity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new account access cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in overestimating gas, leading to potential attacks vectors.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new cost values.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Decreasing the cost of account access operations could introduce new attack vectors. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hard Limits for Transient Storage</title>
        <published>2025-06-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7971/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-eip-hard-limit-and-cost-reduction-for-transient-storage-allocation/24542" />
        

        <id>https://wg-eips.ritovision.com/7971/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7971"
            label="EIP-7971" />
        

        
        

        
        <summary type="html">Decrease costs for TLOAD and TSTORE with a transaction-global limit</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7971/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to reduce the gas costs for transient storage operations (&lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;) by implementing constant pricing. To prevent denial-of-service attacks through excessive memory allocation, a transaction-global limit on transient storage slots is introduced. This approach provides lower costs for common use cases while maintaining security against resource exhaustion attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; introduced transient storage with gas costs equivalent to warm storage operations (100 gas). The current pricing model presents several limitations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reentrancy Protection Cost: At 100 gas per operation, implementing reentrancy locks by default remains expensive enough to discourage universal adoption at the language level, leaving contracts vulnerable to one of the most common attack vectors.&lt;&#x2F;li&gt;
&lt;li&gt;Underutilization: The high cost is still punishing to developers who wish to use transient storage for other legitimate use cases such as temporary approvals, callback metadata, and cross-frame communication within transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Pricing Inconsistency: Transient storage fundamentally requires fewer resources than persistent storage (no disk I&#x2F;O, no state root updates), yet is priced identically to warm storage operations.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP addresses these issues by implementing constant, lower pricing for transient storage operations while introducing a transaction-global limit to prevent denial-of-service attacks. It also makes the cost of warm storage cheaper. This provides lower costs and enables broader adoption of transient storage, while also providing hard resource limits for clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces the following parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left&quot;&gt;Constant&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_TLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Gas cost of &lt;code&gt;TLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_TSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Gas cost of &lt;code&gt;TSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;131072&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;The maximum number of transient slots allowed in a single transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: left&quot;&gt;&lt;code&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;24&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Cost of additional allocated slots&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;gas-cost-changes&quot;&gt;Gas Cost Changes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The gas cost for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; (opcode &lt;code&gt;0x5c&lt;&#x2F;code&gt;) is reduced from &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; (100) to &lt;code&gt;GAS_TLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The base gas cost for &lt;code&gt;TSTORE&lt;&#x2F;code&gt; (opcode &lt;code&gt;0x5d&lt;&#x2F;code&gt;) is reduced from &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; (100) to &lt;code&gt;GAS_TSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;transaction-global-transient-storage-limit&quot;&gt;Transaction-Global Transient Storage Limit&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction-global counter tracks the number of unique transient storage slots written across all contracts during transaction execution:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;At the beginning of each transaction, initialize a counter &lt;code&gt;transient_slots_used&lt;&#x2F;code&gt; to 0.&lt;&#x2F;li&gt;
&lt;li&gt;When &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is executed:
&lt;ul&gt;
&lt;li&gt;If the slot has not been written to during this transaction (across any contract), increment &lt;code&gt;transient_slots_used&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;transient_slots_used&lt;&#x2F;code&gt; exceeds &lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt;, the transaction MUST exceptionally halt.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The counter persists across all message calls in the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The counter is reset to 0 at the end of the transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-note&quot;&gt;Implementation Note&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations MUST track transient storage allocated across all contracts. A slot is considered unique based on the tuple &lt;code&gt;(contract_address, storage_key)&lt;&#x2F;code&gt;. Writing to the same slot multiple times within a transaction does not generally increment the counter after the first write (unless the slot gets deallocated with a revert).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constant-pricing-with-hard-limit&quot;&gt;Constant Pricing with Hard Limit&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP implements constant pricing with a hard limit for several reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A hard limit provides guarantees on the total resource consumption which are easier to reason about for clients, rather than needing to perform a calculation as a function of current gas limits to find out what total memory consumption could be.&lt;&#x2F;li&gt;
&lt;li&gt;Common use cases (e.g., reentrancy locks using 1-2 slots) are not penalized for worst case resource usage (like in DOS attacks).&lt;&#x2F;li&gt;
&lt;li&gt;Clients can safely pre-reserve all memory which could be used by transient storage up-front at the beginning of a transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-cost-selection&quot;&gt;Gas Cost Selection&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GAS_TLOAD&lt;&#x2F;code&gt; (5 gas): Transient storage reads require only memory access without disk I&#x2F;O.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_TSTORE&lt;&#x2F;code&gt; (12 gas): Transient storage writes require memory allocation and journaling for revert support.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;code&gt; (24 gas): Writes to fresh slots require memory allocation, which is more expensive than writing to an existing slot.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;TSTORE&lt;&#x2F;code&gt; currently has a fixed cost. However, writing to fresh slots requires memory allocation, which is more expensive than writing to an existing slot. Therefore, we may consider introducing charging more for the first slot allocation through the parameter &lt;code&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;code&gt;. However, we would also need to introduce a mechanism to check for the first slot allocation versus subsequent allocations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;benchmarking&quot;&gt;Benchmarking&lt;&#x2F;h4&gt;
&lt;p&gt;This proposal does not yet have finalized numbers. To achieve this, we require benchmarks on the transient memory operations, which are currently in development. Once we collect that data, we will set the final numbers. We will also use this to understand whether the difference in performance justifies pricing new slot allocations differently.&lt;&#x2F;p&gt;
&lt;p&gt;We should note that warm storage loads from cache are expected to have similar performance characteristics to transient storage reads. Therefore, the final parameters should be consistent with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8038&#x2F;&quot;&gt;EIP-8038&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;– TODO –&amp;gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hard-limit-selection&quot;&gt;Hard Limit Selection&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt; of 131072 allows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Sufficient slots for typical user applications&lt;&#x2F;li&gt;
&lt;li&gt;Memory usage bounded to approximately 8 MB per transaction (131072 slots * 64 bytes), which prevents OOM-based denial-of-service attacks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;design-alternatives-considered&quot;&gt;Design Alternatives Considered&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Per-Contract Limits: Increased complexity in reasoning about resource consumption based on the shape of the call stack.&lt;&#x2F;li&gt;
&lt;li&gt;Superlinear Pricing: Adds complexity, and still punishes &quot;common&quot; (non-DOS) use cases.&lt;&#x2F;li&gt;
&lt;li&gt;No Limit: May allow memory-based DOS attack if transaction-level gas limits change, or if pricing changes in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The benefit of a hard limit is that the resource consumption is bounded predictably even in the presence of other parameter changes in the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues, besides the gas cost of existing operations being cheaper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This reference implementation includes the mechanism to price &lt;code&gt;TSTORE&lt;&#x2F;code&gt; depending on whether the slot was previously allocated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pseudo-code for transaction execution with global transient storage limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TLOAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 131072&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionContext&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_storage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (address, key) -&amp;gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; set of (address, key) tuples&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_slots_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TLOAD&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return value or zero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Charge gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if this is a new unique slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        slot_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; slot_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GAS_TSTORE_ALLOCATE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slot_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;unique_slots&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TRANSIENT_SLOTS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                raise&lt;&#x2F;span&gt;&lt;span&gt; ExceptionalHalt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Transient storage limit exceeded&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Store value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transient_storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot_id&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;code&gt;MAX_TRANSIENT_SLOTS&lt;&#x2F;code&gt; = 131072, maximum memory allocation is bounded to 8 MB per transaction (131072 * 64 bytes). Compared to limits under current pricing (100 gas), a 60M gas transaction can allocate up to 600,000 slots (38.4 MB). This EIP reduces the maximum allocated amount by 79%.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Maximum Contract Size</title>
        <published>2025-06-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7954/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/increase-maximum-contract-size-to-48kb/24509" />
        

        <id>https://wg-eips.ritovision.com/7954/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7954"
            label="EIP-7954" />
        

        
        

        
        <summary type="html">Raise the maximum contract code size from 24KiB to 32KiB and initcode size from 48KiB to 64KiB.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7954/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to raise the maximum allowed size for contract code deployed on Ethereum from 24,576 bytes to 32,768 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current 24KiB contract size limit can be restrictive for complex contracts and applications. Increasing the limit to 32KiB allows for more feature-rich contracts while maintaining reasonable constraints on block and state growth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; contract code size limit of 24KiB (&lt;code&gt;0x6000&lt;&#x2F;code&gt; bytes) to 32KiB (&lt;code&gt;0x8000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; initcode size limit of 48KiB (&lt;code&gt;0xC000&lt;&#x2F;code&gt; bytes) to 64KiB (&lt;code&gt;0x10000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Developer Flexibility:&lt;&#x2F;strong&gt; Enables more complex contracts and features.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Backward Compatibility:&lt;&#x2F;strong&gt; Existing contracts are unaffected.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Simplicity:&lt;&#x2F;strong&gt; Only the size limit is changed, with no other protocol modifications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and must be activated via a network upgrade (hard fork). Contracts larger than 24KiB, up to 32KiB, will be deployable after activation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A higher contract size limit may marginally increase the risk of denial-of-service attacks via large contracts, but the new limit remains conservative.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Extended types section</title>
        <published>2025-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7960/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-series-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7960/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7960"
            label="EIP-7960" />
        

        
        

        
        <summary type="html">Extend EOF container&#x27;s types section with an extra type parameter.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7960/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the definition of &lt;code&gt;types_section&lt;&#x2F;code&gt; in EOF format (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) with an additional &lt;code&gt;type&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An additional &lt;code&gt;type&lt;&#x2F;code&gt; parameter allows the EOF EVM interpreter to identify the &quot;type&quot; of a code section. This allows the interpreter to &quot;interpret&quot; each code section differently, allowing EOF function calls to, for example, invoke pure EVM64 code or even later support RISC-V.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;types_section&lt;&#x2F;code&gt;, as defined in EIP-3540, is changed to be of the following format &lt;code&gt;(type, reserved, inputs, outputs, max_stack_increase)&lt;&#x2F;code&gt;. &lt;code&gt;type&lt;&#x2F;code&gt; is &lt;code&gt;uint8&lt;&#x2F;code&gt;, &lt;code&gt;reserved&lt;&#x2F;code&gt; is 24 bits, and &lt;code&gt;inputs&lt;&#x2F;code&gt;, &lt;code&gt;outputs&lt;&#x2F;code&gt;, &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; are defined as &lt;code&gt;uint8&lt;&#x2F;code&gt;, &lt;code&gt;uint8&lt;&#x2F;code&gt;, &lt;code&gt;uint16&lt;&#x2F;code&gt; respectively, the same as before. The only valid &lt;code&gt;type&lt;&#x2F;code&gt; defined in this EIP is &lt;code&gt;0x01&lt;&#x2F;code&gt;. Additional EIPs may be defined for other code section &lt;code&gt;type&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;version&lt;&#x2F;code&gt;, as defined in EIP-3540, is changed to &lt;code&gt;0x02&lt;&#x2F;code&gt;, to avoid the backward compatibility issue if a third-party chain already deployed EOF in production.&lt;&#x2F;p&gt;
&lt;p&gt;In EOF container, the following validation rules are added:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a &lt;code&gt;type&lt;&#x2F;code&gt; in &lt;code&gt;types_section&lt;&#x2F;code&gt; is not of a known type, then the validation fails.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;reserved&lt;&#x2F;code&gt; in &lt;code&gt;types_section&lt;&#x2F;code&gt; must be all zeros.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The new &lt;code&gt;type&lt;&#x2F;code&gt; parameter allows a contract to &quot;dispatch&quot; to different variants of the interpreter to better suit its need.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The portion of the code where it mainly interacts with Ethereum addresses, balances, storages may run &quot;normal&quot; EVM.&lt;&#x2F;li&gt;
&lt;li&gt;The portion of the code that is computationally heavy may run faster EVM64, but loses the ability to directly interact with Ethereum addresses and balances.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Allowing this &lt;code&gt;type&lt;&#x2F;code&gt; to be defined for each code section ensures that a contract remains concise -- it can quickly switch between its computational needs and system&#x2F;runtime needs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;reserved&lt;&#x2F;code&gt; is added to &lt;code&gt;types_section&lt;&#x2F;code&gt; to maintain the proper padding. Each item in &lt;code&gt;types_section&lt;&#x2F;code&gt; is now 64 bits in total.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As we know, EOF, including EIP-3540, was extremely close to being deployed before it was decided to withdraw from Fusaka. To avoid the issue that some third-party chains have already deployed EOF in production (given the state of EOF we can consider this to be likely), we bump &lt;code&gt;version&lt;&#x2F;code&gt; of EOF to &lt;code&gt;0x02&lt;&#x2F;code&gt;. &lt;code&gt;0x01&lt;&#x2F;code&gt; is now invalid.&lt;&#x2F;p&gt;
&lt;p&gt;No other backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - EOF code section</title>
        <published>2025-05-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7961/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-series-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7961/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7961"
            label="EIP-7961" />
        

        
        

        
        <summary type="html">Define &quot;pure&quot; EVM64 mode, as an EOF code section.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7961/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An EOF-only specification for EVM64 instruction set. This defines a separate &quot;EVM64&quot; type for EOF code section in addition to &quot;regular EVM&quot;. The interpreter then enters EVM64 mode when entering the code section. This EIP is an alternative to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-7937 has maximum compatibility with existing EVM. It implements EVM64 simply as a group of additional opcodes (using a prefix opcode). This EIP defines an alternative method, using EOF container&#x27;s code section. It has its pros and cons. The code size will obviously become shorter, due to not needing multibyte opcodes any more. On the other hand, interop with EVM system calls become more difficult because it cannot be done in an EVM64 code section. The advantages and disadvantages are discussed further in the Rationale section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Define &lt;code&gt;0x02&lt;&#x2F;code&gt; as an allowed &lt;code&gt;type&lt;&#x2F;code&gt; in &lt;code&gt;types_section&lt;&#x2F;code&gt;, as defined in EIP-7960. This denotes an EVM64 code section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-function-execution&quot;&gt;EOF function execution&lt;&#x2F;h3&gt;
&lt;p&gt;When entering an EOF code section (either at the beginning of the contract call, or through &lt;code&gt;CALLF&lt;&#x2F;code&gt;), it enters &quot;pure EVM64 mode&quot;. Unless defined below, no other opcodes are allowed. Those opcodes all only operate on the least significant 64-bit, in little endian.&lt;&#x2F;p&gt;
&lt;p&gt;During EOF validation, the validation function should enforce that only allowed opcodes exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-constants&quot;&gt;Gas cost constants&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following gas cost constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;G_BASE64&lt;&#x2F;code&gt;: 1&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;: 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_LOW64&lt;&#x2F;code&gt;: 3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_MID64&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_HIGH64&lt;&#x2F;code&gt;: 7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_STATIC&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_DYNAMIC&lt;&#x2F;code&gt;: 25&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;: 3&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;arithmetic-opcodes&quot;&gt;Arithmetic opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode arithmetic opcodes are defined the same as non-64-bit mode, except that they only operate on the least significant 64-bits. In the below definition, &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;, &lt;code&gt;N&lt;&#x2F;code&gt; is &lt;code&gt;a mod 2^64&lt;&#x2F;code&gt;, &lt;code&gt;b mod 2^64&lt;&#x2F;code&gt; and &lt;code&gt;N mod 2^64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ADD (&lt;code&gt;01&lt;&#x2F;code&gt;) and SUB (&lt;code&gt;03&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUL (&lt;code&gt;02&lt;&#x2F;code&gt;), DIV (&lt;code&gt;04&lt;&#x2F;code&gt;), SDIV (&lt;code&gt;05&lt;&#x2F;code&gt;), MOD (&lt;code&gt;06&lt;&#x2F;code&gt;), SMOD (&lt;code&gt;07&lt;&#x2F;code&gt;), SIGNEXTEND (&lt;code&gt;0B&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_LOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;ADDMOD (&lt;code&gt;08&lt;&#x2F;code&gt;), MULMOD (&lt;code&gt;09&lt;&#x2F;code&gt;): &lt;code&gt;a op b % N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_MID64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;EXP (&lt;code&gt;0A&lt;&#x2F;code&gt;): &lt;code&gt;a EXP b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;static_gas = G_EXP64_STATIC, dynamic_gas = G_EXP64_DYNAMIC * exponent_byte_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;comparison-and-bitwise-opcodes&quot;&gt;Comparison and bitwise opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode comparison and bitwise opcodes are defined the same as non-64-bit mode, except that they only operate on the least significant 64 bits.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;LT (&lt;code&gt;10&lt;&#x2F;code&gt;), GT (&lt;code&gt;11&lt;&#x2F;code&gt;), SLT (&lt;code&gt;12&lt;&#x2F;code&gt;), SGT (&lt;code&gt;13&lt;&#x2F;code&gt;), EQ (&lt;code&gt;14&lt;&#x2F;code&gt;), AND (&lt;code&gt;16&lt;&#x2F;code&gt;), OR (&lt;code&gt;17&lt;&#x2F;code&gt;), XOR (&lt;code&gt;18&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;ISZERO (&lt;code&gt;15&lt;&#x2F;code&gt;), NOT (&lt;code&gt;19&lt;&#x2F;code&gt;): &lt;code&gt;op a mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHL (&lt;code&gt;1B&lt;&#x2F;code&gt;), SHR (&lt;code&gt;1C&lt;&#x2F;code&gt;), SAR (&lt;code&gt;1D&lt;&#x2F;code&gt;): &lt;code&gt;a op N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;BYTE (&lt;code&gt;1A&lt;&#x2F;code&gt;) is defined as &lt;code&gt;(x &amp;gt;&amp;gt; i * 8) &amp;amp; 0xFF&lt;&#x2F;code&gt;. Note that the definition is changed from big endian to little endian.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;memory-opcodes&quot;&gt;Memory opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; (0x51) will load a 64-bits integer in little endian onto the stack. &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; (0x52) will read an 64-bits integer from the stack, and store it to memory in little endian.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for both opcodes is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;. The memory resizing costs count as 8 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MSTORE8&lt;&#x2F;code&gt; is available in EVM64 mode, and its gas cost is the same as in &quot;normal&quot; EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stack-opcodes&quot;&gt;Stack opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PUSH0&lt;&#x2F;code&gt; (0x5f) to &lt;code&gt;PUSH8&lt;&#x2F;code&gt; (0x67) follows 0-byte to 8-byte literal. The literal is read little endian and pushed onto the stack. The gas cost for them is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;POP&lt;&#x2F;code&gt;, &lt;code&gt;SWAPn&lt;&#x2F;code&gt; and &lt;code&gt;DUPn&lt;&#x2F;code&gt; are available in EVM64 mode, and their gas costs are the same as in &quot;normal&quot; EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other-opcodes&quot;&gt;Other opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;Contract opcodes &lt;code&gt;RETURN&lt;&#x2F;code&gt;, &lt;code&gt;REVERT&lt;&#x2F;code&gt;, &lt;code&gt;INVALID&lt;&#x2F;code&gt; are available in EVM64 mode. Their behaviors, including gas costs, are unchanged. However, for all stack items, only the least significant 64 bits are read.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt;, &lt;code&gt;RETF&lt;&#x2F;code&gt;, &lt;code&gt;RJUMP&lt;&#x2F;code&gt; are available in EVM64 mode. Their behaviors, including gas costs, are unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;For flow operations RJUMPI and RJUMPV, the 64-bit mode has following changes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;RJUMPI64&lt;&#x2F;code&gt; (0xe1), the condition popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;RJUMPV64&lt;&#x2F;code&gt; (0xe2), the case popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;stack-behavior&quot;&gt;Stack behavior&lt;&#x2F;h3&gt;
&lt;p&gt;&quot;Pure&quot; in &quot;pure EVM64&quot; refers to the fact that all opcodes in EVM64 mode only operate on the least significant 64 bits. In this specification, we don&#x27;t specifically define 64-bit stack. As far as this EIP is concerned, stack is still 256-bit. However, because they only operate on the least significant 64 bits. The most significant 192 bits becomes unobservable as long as the interpreter is in an EVM64 code section. Thus an EVM interpreter can optimize EVM64 execution as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When entering EVM64 code section, truncate &lt;code&gt;inputs&lt;&#x2F;code&gt; to 64 bits.&lt;&#x2F;li&gt;
&lt;li&gt;Use 64-bit stack during EVM64 execution.&lt;&#x2F;li&gt;
&lt;li&gt;When exiting EVM64 code section, prepend &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;outputs&lt;&#x2F;code&gt; to make it 256 bits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;discussions&quot;&gt;Discussions&lt;&#x2F;h3&gt;
&lt;p&gt;This alternative definition (compared with EIP-7937) has the advantage that the code size is now shorter (because no multibyte opcodes are needed). It however will only work with EOF contract but not &quot;legacy&quot; EVM. The interaction between EVM64 and &quot;system calls&quot; (those calls that read Ethereum block values, addresses, balances and storages) will be more difficult. It&#x27;s not &quot;seamless&quot; like EIP-7937 where one can enter&#x2F;exit 64-bit mode at ease. Depending on how the 64-bit optimization works out, this may be an advantage or a disadvantage.&lt;&#x2F;p&gt;
&lt;p&gt;The memory is, as usual, still shared during the entire execution. So in EVM64, the contract can always use the memory to push&#x2F;fetch data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;!-- TODO: Add test cases and reference implementation --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for secp256r1 Curve Support</title>
        <published>2025-05-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/carlbeek</uri>
	</author>
	
	<author>
		<name>Ulaş Erdoğan</name><uri>https://github.com/ulerdogan</uri>
	</author>
	
	<author>
		<name>Doğan Alpaslan</name><uri>https://github.com/doganalpaslan</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7951/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7951-precompile-for-secp256r1-curve-support/24360" />
        

        <id>https://wg-eips.ritovision.com/7951/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7951"
            label="EIP-7951" />
        

        
        

        
        <summary type="html">Add precompiled contract for secp256r1 ECDSA signature verification with proper security checks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7951/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add functionality to efficiently perform ECDSA signature verification over the secp256r1 elliptic curve (also known as P-256 or prime256v1). This precompile enables native support for signatures generated by modern secure hardware including Apple Secure Enclave, Android Keystore, and FIDO2&#x2F;WebAuthn devices.&lt;&#x2F;p&gt;
&lt;p&gt;This specification addresses critical security issues discovered in RIP-7212 while maintaining full interface compatibility with existing Layer 2 implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The secp256r1 elliptic curve is a NIST-standardized curve widely supported in modern secure hardware and authentication systems. Adding native support for secp256r1 signature verification to Ethereum enables several important use cases that are currently impossible or prohibitively expensive.&lt;&#x2F;p&gt;
&lt;p&gt;Modern secure hardware devices, including Apple Secure Enclave, Android Keystore, HSMs, TEEs, and FIDO2&#x2F;WebAuthn authenticators, use secp256r1 for key storage and signing operations. Native secp256r1 support enables sophisticated account abstraction patterns like device-native signing, multi-factor authentication, and simplified key management - ultimately reducing friction for mainstream adoption through familiar authentication flows.&lt;&#x2F;p&gt;
&lt;p&gt;The secp256r1 curve is already widely supported across blockchain networks and protocols, including Layer 2 networks, enterprise blockchains, and interoperability protocols. This broad compatibility enables seamless integration with existing infrastructure while maintaining security through hardware-backed signing capabilities.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP supersedes RIP-7212 by implementing the same functionality with the same interface, but without the vulnerability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompile&quot;&gt;Precompile&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce &lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; a precompile at the address &lt;code&gt;0x100&lt;&#x2F;code&gt; which performs ECDSA signature verification over the secp256r1 curve with a gas cost of &lt;code&gt;6900&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h3 id=&quot;curve-parameters&quot;&gt;Curve Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;The secp256r1 curve is fully defined by the following set of parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = p = 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve equation: y^2 = x^3 + ax + b (mod p)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve coefficient a = 0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve coefficient b = 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base point G:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Gx = 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Gy = 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Subgroup order = n = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Cofactor = h = 0x1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These parameters are standardized by NIST in SP 800-186&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fields-and-groups&quot;&gt;Fields and Groups&lt;&#x2F;h3&gt;
&lt;p&gt;The field Fp is defined as the finite field of size &lt;code&gt;p&lt;&#x2F;code&gt; with elements represented as integers between 0 and p-1 (both inclusive).&lt;&#x2F;p&gt;
&lt;p&gt;The group G is defined as a set of Fp pairs (points) &lt;code&gt;(x,y)&lt;&#x2F;code&gt; such that either &lt;code&gt;(x,y)&lt;&#x2F;code&gt; is &lt;code&gt;(0,0)&lt;&#x2F;code&gt; (representing the point at infinity) or &lt;code&gt;x,y&lt;&#x2F;code&gt; satisfy the curve equation &lt;code&gt;y^2 = x^3 + ax + b (mod p)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;points-and-encoding&quot;&gt;Points and Encoding&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field Elements Encoding&lt;&#x2F;h4&gt;
&lt;p&gt;A base field element (Fp) is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer &lt;strong&gt;must&lt;&#x2F;strong&gt; be less than the field modulus &lt;code&gt;p&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-points-in-g&quot;&gt;Encoding of Points in G&lt;&#x2F;h4&gt;
&lt;p&gt;Points in G are encoded as byte concatenation of the respective encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; coordinates. Total encoding length for a G point is thus &lt;code&gt;64&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-of-infinity-encoding&quot;&gt;Point of Infinity Encoding&lt;&#x2F;h4&gt;
&lt;p&gt;For secp256r1, the point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (zeroes in Fp) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, so a sequence of &lt;code&gt;64&lt;&#x2F;code&gt; zero bytes is used by convention to encode the point of infinity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars&quot;&gt;Encoding of Scalars&lt;&#x2F;h4&gt;
&lt;p&gt;A scalar is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer is &lt;strong&gt;not&lt;&#x2F;strong&gt; required to be less than or equal to the subgroup order &lt;code&gt;n&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior-on-invalid-inputs&quot;&gt;Behavior on Invalid Inputs&lt;&#x2F;h4&gt;
&lt;p&gt;On inputs that cannot be valid encodings of field elements or points, the precompile &lt;em&gt;must&lt;&#x2F;em&gt; return `` (failure).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-p256verify-operation&quot;&gt;ABI for &lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; Operation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; call expects &lt;code&gt;160&lt;&#x2F;code&gt; bytes as input that is interpreted as byte concatenation of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: message hash &lt;code&gt;h&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: signature component &lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: signature component &lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: public key x-coordinate &lt;code&gt;qx&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;32&lt;&#x2F;code&gt; bytes: public key y-coordinate &lt;code&gt;qy&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;p&gt;Output is &lt;code&gt;32&lt;&#x2F;code&gt; bytes on successful verification and &lt;code&gt;0&lt;&#x2F;code&gt; bytes on failure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt; for valid signatures&lt;&#x2F;li&gt;
&lt;li&gt;`` for invalid signatures or invalid inputs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;input-validation&quot;&gt;Input Validation&lt;&#x2F;h4&gt;
&lt;p&gt;The precompile MUST perform the following validation checks and return `` (failure) if any check fails:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Input length&lt;&#x2F;strong&gt;: Input MUST be exactly &lt;code&gt;160&lt;&#x2F;code&gt; bytes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Signature component bounds&lt;&#x2F;strong&gt;: Both &lt;code&gt;r&lt;&#x2F;code&gt; and &lt;code&gt;s&lt;&#x2F;code&gt; MUST satisfy &lt;code&gt;0 &amp;lt; r &amp;lt; n&lt;&#x2F;code&gt; and &lt;code&gt;0 &amp;lt; s &amp;lt; n&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Public key bounds&lt;&#x2F;strong&gt;: Both &lt;code&gt;qx&lt;&#x2F;code&gt; and &lt;code&gt;qy&lt;&#x2F;code&gt; MUST satisfy &lt;code&gt;0 ≤ qx &amp;lt; p&lt;&#x2F;code&gt; and &lt;code&gt;0 ≤ qy &amp;lt; p&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Point validity&lt;&#x2F;strong&gt;: The point &lt;code&gt;(qx, qy)&lt;&#x2F;code&gt; MUST satisfy the curve equation &lt;code&gt;qy^2 ≡ qx^3 + a*qx + b (mod p)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Point not at infinity&lt;&#x2F;strong&gt;: The point &lt;code&gt;(qx, qy)&lt;&#x2F;code&gt; MUST NOT be the point at infinity (represented as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;signature-verification-algorithm&quot;&gt;Signature Verification Algorithm&lt;&#x2F;h4&gt;
&lt;p&gt;The verification algorithm follows these steps:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Input validation (as specified above)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if input_length != 160:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if not (0 &amp;lt; r &amp;lt; n and 0 &amp;lt; s &amp;lt; n):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if not (0 ≤ qx &amp;lt; p and 0 ≤ qy &amp;lt; p):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if qy^2 ≢ qx^3 + a*qx + b (mod p):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (qx, qy) == (0, 0):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Signature verification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;s1 = s^(-1) (mod n)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Recover the random point used during signing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R&amp;#39; = (h * s1) * G + (r * s1) * (qx, qy)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Check for point at infinity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if R&amp;#39; is the point at infinity:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Extract x-coordinate from r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;r&amp;#39; = R&amp;#39;.x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Compare with modular reduction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if r&amp;#39; ≡ r (mod n):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;error-cases&quot;&gt;Error Cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Invalid input length (not exactly 160 bytes)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid field element encoding (≥ field modulus)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid signature component bounds (r or s not in range (0, n))&lt;&#x2F;li&gt;
&lt;li&gt;Invalid public key (point at infinity or not on curve)&lt;&#x2F;li&gt;
&lt;li&gt;Signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas Schedule&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;p256verify-operation&quot;&gt;&lt;code&gt;P256VERIFY&lt;&#x2F;code&gt; operation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;6900&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;p&gt;This cost is based on benchmarking against the existing &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; precompile (&lt;code&gt;3000&lt;&#x2F;code&gt; gas). During benchmarks we found that the actual cost of R1 verification was significantly slower than the &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; precompile and the decision was made to increase the gas cost to &lt;code&gt;6900&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-burning-on-error&quot;&gt;Gas Burning on Error&lt;&#x2F;h4&gt;
&lt;p&gt;The precompile MUST NOT revert under any circumstances. Invalid inputs or verification failures MUST return `` and consume the same amount of gas had verification succeeded.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;security-fixes&quot;&gt;Security Fixes&lt;&#x2F;h3&gt;
&lt;p&gt;This specification addresses two critical vulnerabilities in RIP-7212:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Point-at-infinity check&lt;&#x2F;strong&gt;: The original RIP-7212 failed to check if the recovered point R&#x27; is the point at infinity. This could lead to non-deterministic behavior where the verification result depends on the underlying implementation&#x27;s handling of infinity points, potentially causing consensus failures.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Modular comparison&lt;&#x2F;strong&gt;: The original comparison &lt;code&gt;r&#x27; == r&lt;&#x2F;code&gt; should be &lt;code&gt;r&#x27; ≡ r (mod n)&lt;&#x2F;code&gt; to handle cases where the x-coordinate of R&#x27; exceeds the curve order n. This ensures mathematically correct verification according to ECDSA standards.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;verification-vs-recovery&quot;&gt;Verification vs Recovery&lt;&#x2F;h3&gt;
&lt;p&gt;This specification uses signature verification rather than public key recovery (like &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt;) because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Most secp256r1 implementations in hardware and software verify signatures directly&lt;&#x2F;li&gt;
&lt;li&gt;The NIST FIPS 186-5 standard[^2] specifies verification, not recovery&lt;&#x2F;li&gt;
&lt;li&gt;Verification is more efficient than recovery for this curve&lt;&#x2F;li&gt;
&lt;li&gt;Existing hardware implementations provide verification interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-cost-justification&quot;&gt;Gas Cost Justification&lt;&#x2F;h3&gt;
&lt;p&gt;The 6900 gas cost does not maintain compatibility with L2s, but it matches closer the benchmarks of actual implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP maintains full interface compatibility with RIP-7212 implementations deployed on Layer 2 networks. The same contract bytecode that works with RIP-7212 will work with this specification.&lt;&#x2F;p&gt;
&lt;p&gt;The security fixes are transparent to correctly implemented callers - they only affect edge cases that should have failed verification anyway. No existing valid use cases are broken.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interface-compatibility&quot;&gt;Interface Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The precompile maintains a similar interface as RIP-7212 to ensure compatibility with existing Layer 2 deployments:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Same address: &lt;code&gt;0x100&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Same input format: 160 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Same output format: 32 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Different gas cost: 3450 gas vs 6900 gas&lt;&#x2F;li&gt;
&lt;li&gt;Same return values&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A set of test vectors for verifying implementations is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7951&#x2F;.&#x2F;assets&#x2F;test-vectors.json&quot;&gt;file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is not supplied due to the ubiquity of secp256r1, if however a reference is needed, the NIST specification in FIPS 186-5[^2]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;cryptographic-security&quot;&gt;Cryptographic Security&lt;&#x2F;h3&gt;
&lt;p&gt;The secp256r1 curve provides approximately 128 bits of security, equivalent to secp256k1 already in use in Ethereum. The curve parameters are standardized by NIST SP 800-186&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-2&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; and have undergone extensive cryptographic analysis by the wider cryptographic community in addition to this curve being deployed to several L2s in the form of RIP-7212.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;malleability&quot;&gt;Malleability&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike secp256k1 ECDSA signatures, secp256r1 ECDSA signatures are not required to be non-malleable per NIST FIPS 186-5 standard [^2]. Applications requiring non-malleability should implement additional checks at the application layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;side-channel-resistance&quot;&gt;Side-Channel Resistance&lt;&#x2F;h3&gt;
&lt;p&gt;We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Chen, L., Moody, D., Regenscheid, A., Randall, K., &amp;amp; Robinson, A. (2023). &lt;span style=&quot;font-style: italic;&quot;&gt;Recommendations for Discrete Logarithm-based Cryptography: Elliptic Curve Domain Parameters&lt;&#x2F;span&gt; (Nos. 800–186). National Institute of Standards and Technology. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.6028&#x2F;NIST.SP.800-186&quot;&gt;10.6028&#x2F;NIST.SP.800-186&lt;&#x2F;a&gt;[^2]: National Institute of Standards and Technology. (2023). &lt;span style=&quot;font-style: italic;&quot;&gt;Digital Signature Standard (DSS)&lt;&#x2F;span&gt; (Nos. 186–5). National Institute of Standards and Technology. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.6028&#x2F;NIST.FIPS.186-5&quot;&gt;10.6028&#x2F;NIST.FIPS.186-5&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt; &lt;a href=&quot;#fr-1-2&quot;&gt;↩2&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - EOF support</title>
        <published>2025-05-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7957/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7937-64-bit-mode-evm-opcodes-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7957/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7957"
            label="EIP-7957" />
        

        
        

        
        <summary type="html">EVM Object Format support for EVM64</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7957/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines EOF support for EVM64 with its additional code validation rules and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOF defines a stricter code validation rule to improve efficiency. Due to EVM64 using multibyte opcode (the mode opcode &lt;code&gt;C0&lt;&#x2F;code&gt;), a small adaptation is needed. This EIP also additionally defines a 64-bit mode &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; to be 64-bit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;We define the following gas cost constant:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;At EOF contract creation time as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;, if the opcode &lt;code&gt;C0&lt;&#x2F;code&gt; is encountered and it is not part of PUSH opcode&#x27;s data, then the interpreter MUST validate that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The next opcode exists.&lt;&#x2F;li&gt;
&lt;li&gt;The next opcode is &lt;code&gt;RJUMPI64&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPV64&lt;&#x2F;code&gt;, or one of the core 64-bit opcode defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt; minus &lt;code&gt;JUMP64&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For flow operations RJUMPI and RJUMPV, the 64-bit mode has following changes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;RJUMPI64&lt;&#x2F;code&gt; (0xc0e1), the condition popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;RJUMPV64&lt;&#x2F;code&gt; (0xc0e2), the case popped from stack is only read for the last 64 bits. Gas cost is &lt;code&gt;G_RJUMPIV64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; is automatically in 64-bit mode because it does not read or write the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;For detailed rationale discussion, please see the core EVM64 definition &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - Little endian opcodes</title>
        <published>2025-05-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7958/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7937-64-bit-mode-evm-opcodes-evm64/23794" />
        

        <id>https://wg-eips.ritovision.com/7958/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7958"
            label="EIP-7958" />
        

        
        

        
        <summary type="html">Little endian opcodes `BYTE64`, `MLOAD64`, `MSTORE64`, and `PUSH*64` for EVM64</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7958/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines additional little endian opcodes that can be deployed alongside &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The core EIP that defines EVM64 (EIP-7937) is endianness-independent. This EIP defines those additional opcodes that must expose endianness. They are the bitwise opcode &lt;code&gt;BYTE64&lt;&#x2F;code&gt;, memory opcodes &lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt;, and stack opcodes &lt;code&gt;PUSH*64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;We define the following gas cost constant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;: 2&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;byte64&quot;&gt;&lt;code&gt;BYTE64&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;BYTE64&lt;&#x2F;code&gt; (0xc01a) is defined as &lt;code&gt;(x &amp;gt;&amp;gt; i * 8) &amp;amp; 0xFF&lt;&#x2F;code&gt;. Note that the definition is changed from big endian to little endian.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mload64-and-mstore64&quot;&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; (0xc051) will load a 64-bit integer in little endian onto the stack. &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; (0xc052) will read an 64-bit integer from the stack, and store it to memory in little endian.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for both opcodes is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;. The memory resizing costs count as 8 bytes.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, &lt;code&gt;[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]&lt;&#x2F;code&gt; is an array of 8 bytes (64 bits). Calling &lt;code&gt;MLOAD64&lt;&#x2F;code&gt; to load this 8-byte value to stack will read it in little endian, resulting in 64-bit integer &lt;code&gt;0x0807060504030201&lt;&#x2F;code&gt;. 64-bit mode always operate on only the least significant 64 bits. When another 256-bit opcodes encounter this value on stack, it will be &lt;code&gt;0x00..00 0807060504030201&lt;&#x2F;code&gt;. Calling &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; to store this value to memory will result in the array &lt;code&gt;[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;push-64&quot;&gt;&lt;code&gt;PUSH*64&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;PUSH2_64&lt;&#x2F;code&gt; (0xc061) to &lt;code&gt;PUSH8_64&lt;&#x2F;code&gt; (0xc067) follows 2-byte to 8-byte literal. The literal is read little endian and pushed onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for them is &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, &lt;code&gt;0xc0 0x67 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08&lt;&#x2F;code&gt; will result in a stack with single value &lt;code&gt;0x00..00 0807060504030201&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;For detailed rationale discussion, please see the core EVM64 definition &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7937&#x2F;&quot;&gt;EIP-7937&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Tx Ordering via Block-level Randomness</title>
        <published>2025-05-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Aryaethn</name><uri>https://github.com/aryaethn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7956/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/potential-eip-mev-decrease-by-deterministic-transaction-ordering-via-block-level-randomness/24084" />
        

        <id>https://wg-eips.ritovision.com/7956/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7956"
            label="EIP-7956" />
        

        
        

        
        <summary type="html">Decreasing MEV attacks by forcing a deterministic transaction ordering via block-level randomness.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7956/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Proposers and builders can currently permute pending transactions arbitrarily, enabling reorder‑driven MEV.  This EIP introduces a consensus rule that sorts all transactions inside a block by XOR‑ing each transaction hash with fresh slot randomness.  The randomness is unknown until the slot starts, so the order is deterministic once known but unpredictable beforehand.  The mechanism &lt;strong&gt;significantly reduces reorder‑based MEV&lt;&#x2F;strong&gt;; latency‑driven back‑running, censorship, and other classes of MEV remain and should be mitigated through complementary techniques (encrypted mempools, reputation, PBS marketplaces, etc.).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Unrestricted ordering is the key enabler of sandwich and classic front‑running attacks.  Deterministic ordering collapses these vectors to latency racing and information asymmetry.  Clear candidate‑set and bundle semantics preserve fee markets while removing the need for trusted sequencers.  Academic works shows deterministic ordering drives sandwich profits toward zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Julia Ofoegbu, “Maximal Extractable Value (MEV): A Tale As Old As Time,” Medium (2024).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;J. Qian et al., “Deterministic Transaction Ordering Without Trusted Sequencers,” arXiv:2411.03327 v1 (2024).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;“Shutter Network Introduces Plan for First Encrypted Mempool on Ethereum,” GlobeNewswire, 13 Feb 2025.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;slot-randomness-r&quot;&gt;Slot Randomness &lt;code&gt;R&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We define our randomness &lt;code&gt;R&lt;&#x2F;code&gt; as the &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; of the each slot, after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7998&#x2F;&quot;&gt;EIP-7998&lt;&#x2F;a&gt;, since this EIP provides slot-by-slot randomness for &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; (only predictable for the builder). This provides enough randomness for our purpose of reducing MEV attacks by MEV bots.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;R = body.randao_reveal[0:32]     : bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;builder-flow&quot;&gt;Builder Flow&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Candidate‑set selection&lt;&#x2F;strong&gt; – Builders &lt;strong&gt;MAY&lt;&#x2F;strong&gt; choose &lt;strong&gt;any subset&lt;&#x2F;strong&gt; of the mempool based on priority fees, side agreements, or policy.  Transactions not chosen are ignored.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Canonical sorting&lt;&#x2F;strong&gt; – Sort the chosen set by primary key &lt;code&gt;H(tx) ⊕ R&lt;&#x2F;code&gt; ascending, then secondary key &lt;code&gt;H(tx)&lt;&#x2F;code&gt; ascending, in case of collision on the primary key.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas‑limit packing&lt;&#x2F;strong&gt; – Append items in order until adding the next would exceed the block gas &lt;strong&gt;limit&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bundles (optional cross‑address atomicity)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Definition&lt;&#x2F;strong&gt; – A bundle is a user‑signed list of fully‑signed transactions.  Each &lt;code&gt;child_tx_rlp&lt;&#x2F;code&gt; is the canonical &lt;strong&gt;signed&lt;&#x2F;strong&gt; RLP encoding, including signature fields &lt;code&gt;(v, r, s)&lt;&#x2F;code&gt;.  The bundle begins with a &lt;em&gt;fee‑payment&lt;&#x2F;em&gt; transaction that covers gas and builder tip for the entire bundle.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Hashing &#x2F; sort key&lt;&#x2F;strong&gt; – Treat the bundle as a &lt;em&gt;virtual transaction&lt;&#x2F;em&gt; with key &lt;code&gt;H(concat(child_tx_rlps))&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;child_tx_rlps[i]&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the exact bytes that will later appear in the block body for that transaction, i.e. the &lt;em&gt;canonical RLP of the fully‑signed transaction&lt;&#x2F;em&gt; per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP‑2718&lt;&#x2F;a&gt; &#x2F; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP‑155&lt;&#x2F;a&gt; rules (for typed transactions the leading &lt;em&gt;type byte&lt;&#x2F;em&gt; and length prefix are included).&lt;&#x2F;li&gt;
&lt;li&gt;Implementations &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; strip or normalise the signature fields &lt;code&gt;(v,r,s)&lt;&#x2F;code&gt;; those 65 bytes are hashed as‑is so every participant derives an identical bundle key.&lt;&#x2F;li&gt;
&lt;li&gt;The concatenation order is the author‑declared execution order of the child transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas accounting&lt;&#x2F;strong&gt; – Bundle gas is the &lt;strong&gt;sum of the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; fields&lt;&#x2F;strong&gt; of all child transactions.  Builders use that sum when evaluating step 3.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Fit‑or‑skip rule&lt;&#x2F;strong&gt; – If the bundle (fee‑payment + children) would exceed the remaining gas limit, the bundle is skipped atomically.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;5&quot;&gt;
&lt;li&gt;&lt;strong&gt;Fee dynamics&lt;&#x2F;strong&gt; – Priority fees influence membership in the candidate set (step 1) but &lt;strong&gt;never&lt;&#x2F;strong&gt; override the canonical order once a tx or bundle is selected.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Here is a pseudocode for the above flow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Inputs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; mempool          : All pending txs &amp;amp; user-signed bundles visible to the builder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; R                : 32-byte slot randomness supplied by randao_reveal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; BLOCK_GAS_LIMIT  : Max gas allowed in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Helper functions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HASH(obj)           → bytes32       &#x2F;&#x2F; Keccak-256 of the byte sequence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function PRIMARY_KEY(h, R)   → bytes32       &#x2F;&#x2F; h XOR R (bit-wise)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function bundleGas(bundle):                      &#x2F;&#x2F; sum of gasLimit of children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total ← 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for childTx in bundle.children:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        total ← total + childTx.gasLimit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 0. Candidate-set selection  (builder policy &#x2F; side deals &#x2F; fee filter)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;candidates ← pickSubsetFrom(mempool)            &#x2F;&#x2F;  ANY subset is allowed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 1. Compute canonical keys &amp;amp; gas cost for every candidate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for item in candidates:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if item.type == &amp;quot;single_tx&amp;quot;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        item.gasCost  ← item.gasLimit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseHash      ← HASH(item.RLP)          &#x2F;&#x2F; canonical signed RLP (EIP-2718)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else if item.type == &amp;quot;bundle&amp;quot;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        concatRlps    ← CONCAT(item.child_rlps) &#x2F;&#x2F; fee-tx + children in author order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        item.gasCost  ← bundleGas(item)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        baseHash      ← HASH(concatRlps)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    item.primaryKey   ← PRIMARY_KEY(baseHash, R)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    item.secondaryKey ← baseHash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 2. Canonical sorting  (primaryKey asc, then secondaryKey asc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sort(candidates, by = (primaryKey ASC, secondaryKey ASC))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 3. Gas-limit packing with fit-or-skip for bundles&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blockList ← empty list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gasUsed   ← 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for item in candidates:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if gasUsed + item.gasCost &amp;gt; BLOCK_GAS_LIMIT:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        continue               &#x2F;&#x2F; skip whole tx or bundle atomically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    append(blockList, item)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasUsed ← gasUsed + item.gasCost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; 4. Output — assemble block body &amp;amp; header field&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;---------------------------------------------------------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block.randomness          ← R               &#x2F;&#x2F; bytes16 in the payload header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block.txOrderingVersion   ← 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block.body                ← flatten(blockList)   &#x2F;&#x2F; bundles explode into children&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-rule&quot;&gt;Consensus Rule&lt;&#x2F;h3&gt;
&lt;p&gt;A block is &lt;strong&gt;invalid&lt;&#x2F;strong&gt; if the executed list deviates from the canonical order derived from its &lt;code&gt;randomness&lt;&#x2F;code&gt; and the included transactions&#x2F;bundles.  Verification is objective; fork‑choice remains unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h3&gt;
&lt;p&gt;Sorting ≤ 1 500 transactions remains &lt;code&gt;O(n log n)&lt;&#x2F;code&gt; (&amp;lt; 1 ms), on today&#x27;s hardware.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;added-parameters&quot;&gt;Added Parameters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;randomness&lt;&#x2F;code&gt;: Specified in the specification.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;txOrderingVersion = 1&lt;&#x2F;code&gt; flag: To be compatible with the existing consensus rule and adding compatibility for future rules if needed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;fork-parameters&quot;&gt;Fork Parameters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt;: Beacon‑chain epoch at which execution clients start to recognise the new fields &lt;code&gt;randomness&lt;&#x2F;code&gt; and &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ORDERING_TRANSITION_EPOCHS&lt;&#x2F;code&gt; window activate the rule: 64 epochs (~13.6 h). Length of the transition window during which blocks with either ordering version are accepted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both parameters are constants in the fork config and may be tuned during test‑net experiments.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;activation-flow&quot;&gt;Activation Flow&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Consensus‑layer upgrade —  Beacon‑chain fork at &lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt; activates &lt;strong&gt;&lt;code&gt;EL‑VRF‑exposure&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; (companion EIP) and begins populating the &lt;code&gt;vrf_output_proposer&lt;&#x2F;code&gt; field.  Execution clients receiving the &lt;code&gt;ExecutePayload&lt;&#x2F;code&gt; after this epoch expect a non‑zero &lt;code&gt;randomness&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Execution‑layer handshake —  Builders and proposers include the new &lt;code&gt;randomness&lt;&#x2F;code&gt; and &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt; fields in Engine API &lt;code&gt;engine_newPayloadV3&lt;&#x2F;code&gt; calls.  Legacy nodes that have not upgraded will reject the payload, causing a natural chain split and economic incentive to upgrade.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Transition window —  For &lt;code&gt;ORDERING_TRANSITION_EPOCHS&lt;&#x2F;code&gt; after &lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt;, clients accept:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Version 0 blocks —  &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt; == 0; no randomness; legacy ordering.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Version 1 blocks —  &lt;code&gt;txOrderingVersion&lt;&#x2F;code&gt; == 1; valid randomness; canonical ordering enforced. During this period proposers are encouraged (but not forced) to adopt version 1 so that fee markets and MEV supply chains have time to adjust.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Finalisation —  At &lt;code&gt;ORDERING_FORK_EPOCH&lt;&#x2F;code&gt; + &lt;code&gt;ORDERING_TRANSITION_EPOCHS&lt;&#x2F;code&gt; the consensus rule changes: blocks MUST set &lt;code&gt;txOrderingVersion == 1&lt;&#x2F;code&gt; and pass canonical‑order validation.  A version‑0 block after this point is treated as invalid and will not be considered by fork‑choice.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-randomness-driven-ordering&quot;&gt;Why randomness‑driven ordering?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Objective &amp;amp; Verifiable –  Using a function of on‑chain randomness (R) and a transaction’s own hash gives every validator an identical, cheap check on order validity.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Unpredictable Until Slot Start –  The XOR of slot‑level RANDAO and the proposer’s VRF output ensures that neither users nor builders can know the final sort key before the slot begins, closing the classic front‑run window.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Minimal Surface Area –  A single 16‑byte field in the execution payload plus a hash operation keeps consensus changes small and auditable.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-xor-as-the-mixing-function&quot;&gt;Why XOR as the mixing function?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;XOR is associative, fast, and requires no extra cryptographic assumptions beyond SHA‑2 already used for H(tx).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any bias in one entropy component (e.g., RANDAO) is negated unless the attacker also controls the VRF output.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-allow-builders-to-curate-the-candidate-set-first&quot;&gt;Why allow builders to curate the candidate set first?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Preserves fee‑market incentives: high‑tip transactions still rise to the top of inclusion competition.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoids forced inclusion of low‑value spam that could bloat blocks if the entire mempool were blindly sorted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-a-secondary-key-h-tx-for-tie-breaking&quot;&gt;Why a secondary key H(tx) for tie‑breaking?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Guarantees total order with negligible extra cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Leverages a value already known to every node; no extra field is needed.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-optional-bundles-instead-of-implicit-nonce-chain-folding&quot;&gt;Why optional bundles instead of implicit nonce‑chain folding?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Cross‑address atomicity (e.g., borrower + lender tx pair) cannot be expressed via nonce order alone.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Requiring an explicit fee‑payment transaction embeds pricing for the externality a bundle imposes on ordering neutrality.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-the-fit-or-skip-bundle-rule&quot;&gt;Why the &quot;fit‑or‑skip&quot; bundle rule?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Ensures all clients compute the same gas impact, preventing divergent execution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Avoids partial bundle execution, which would undermine user intent.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-the-version-flag-transition-window&quot;&gt;Why the version flag + transition window?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Prevents accidental consensus splits by giving node operators a grace period.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Mirrors previous successful hard forks (e.g., London’s BASE_FEE activation sequence).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Old nodes&lt;&#x2F;strong&gt; —  Execution clients that ignore the new fields will treat version‑1 blocks as malformed and fork away.  The short transition window gives operators time to upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Light clients&lt;&#x2F;strong&gt; —  No additional work; they track headers chosen by upgraded full nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;randomness-bias-randao-manipulation&quot;&gt;Randomness Bias &amp;amp; RANDAO Manipulation&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Single‑validator bias&lt;&#x2F;em&gt; – A block proposer can not change its &lt;code&gt;randao_reveal&lt;&#x2F;code&gt; output after EIP-7998, only predictable to him.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Coalition bias&lt;&#x2F;em&gt; – Multiple consecutive‑slot proposers could attempt to influence RANDAO by withholding signatures, but the protocol already slashes equivocation and missed attestations.  The cost rises exponentially with coalition size, and the added VRF entropy further randomizes &lt;code&gt;R&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Forkable bias&lt;&#x2F;em&gt; – Re‑org attempts longer than depth 1 must overcome the usual consensus finality thresholds.  Because &lt;code&gt;R&lt;&#x2F;code&gt; is embedded in the execution payload, any fork conflicts are objectively detectable by all nodes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Conclusion: Collusion attacks are economically unattractive; the mixed entropy from RANDAO and VRF provides strong unpredictability guarantees.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;hash-grinding&quot;&gt;Hash Grinding&lt;&#x2F;h3&gt;
&lt;p&gt;New signatures are required only when &lt;code&gt;calldata&lt;&#x2F;code&gt; changes, but attacks must begin &lt;strong&gt;after&lt;&#x2F;strong&gt; block is built.  Propagation delays and inclusion fees sharply limit profitable grinding to high‑value trades.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tie-collisions&quot;&gt;Tie Collisions&lt;&#x2F;h3&gt;
&lt;p&gt;Secondary key &lt;code&gt;H(tx)&lt;&#x2F;code&gt; guarantees total order; collision probability (&lt;code&gt;2^{-256}&lt;&#x2F;code&gt;) is negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundle-gas-consistency&quot;&gt;Bundle Gas Consistency&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit summation rule ensures every client computes identical gas usage for bundles, preventing divergent validation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;residual-mev-vectors&quot;&gt;Residual MEV Vectors&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Back‑running &amp;amp; latency&lt;&#x2F;em&gt; – Persist.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Builder discretion&lt;&#x2F;em&gt; – Builders may censor or selectively include transactions while forming the candidate set; exactly like the current status of Ethereum.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Available Attestation</title>
        <published>2025-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mingfei Zhang</name><uri>https://github.com/Mart1i1n</uri><email>mingfei.zh@outlook.com</email>
	</author>
	
	<author>
		<name>Rujia Li</name><email>rujia@tsinghua.edu.cn</email>
	</author>
	
	<author>
		<name>Xueqian Lu</name><email>xueqian.lu@bitheart.org</email>
	</author>
	
	<author>
		<name>Sisi Duan</name><email>duansisi@tsinghua.edu.cn</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7942/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7942-available-attestation-a-reorg-resilient-solution-for-ethereum/23927" />
        

        <id>https://wg-eips.ritovision.com/7942/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7942"
            label="EIP-7942" />
        

        
        

        
        <summary type="html">A reorg-resilient solution for Ethereum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7942/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes Available Attestation (AA), a protocol enhancement to make Ethereum PoS resilient against reorganization attacks. The proposal introduces a stability criterion for blocks based on attestation quorums, requiring that a block must include at least one-third of validators&#x27; attestations from the previous slot to be considered stable. The proposal includes three main changes: (1) modifying the parent selection rule to require AA from the previous slot, (2) replacing HLMD-GHOST with a Longest Stable Chain fork choice rule, and (3) adding a reference field to recent unstable blocks to preserve transaction continuity. These changes collectively prevent Byzantine validators from successfully executing reorganization attacks in synchronous networks while maintaining safety and liveness properties in partially synchronous networks. A full technical analysis is available in our &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7942&#x2F;.&#x2F;assets&#x2F;available-attestation-paper.pdf&quot;&gt;companion paper&lt;&#x2F;a&gt; accepted to USENIX Security 2025.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We find that all known effective attacks on Ethereum PoS belong to reorganization attacks, although they emphasize different types of adversarial strategies. According to how the canonical chain is manipulated by the adversary, we classify known attacks into two categories: attacks from &lt;em&gt;changing block weight&lt;&#x2F;em&gt; and attacks from &lt;em&gt;filtering block tree&lt;&#x2F;em&gt;. The attacks from changing block weight refer to the strategy where Byzantine validators modify the &lt;em&gt;weight&lt;&#x2F;em&gt; of their proposed blocks to make their fork eventually become the canonical chain. Meanwhile, the attacks from filtering block tree do not change the block weight. Instead, these attacks make honest validators prune the canonical chain. This is often achieved by changing the &lt;em&gt;state&lt;&#x2F;em&gt; of honest validators. We summarize these malicious reorganization attacks in the following table.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;attack type&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;scheme&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;timing assumption&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;mitigation solution&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;limitation&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;changing block weight&lt;&#x2F;td&gt;&lt;td&gt;ex-ante reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;proposer boosting v1&lt;&#x2F;td&gt;&lt;td&gt;cause sandwich reorg&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;balancing attack&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;proposer boosting v1&lt;&#x2F;td&gt;&lt;td&gt;cause sandwich reorg&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;sandwich reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;proposer boosting v2⋆&lt;&#x2F;td&gt;&lt;td&gt;cannot fully prevent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;filtering block tree&lt;&#x2F;td&gt;&lt;td&gt;bouncing attack&lt;&#x2F;td&gt;&lt;td&gt;partial synchrony†&lt;&#x2F;td&gt;&lt;td&gt;safe-slots&lt;&#x2F;td&gt;&lt;td&gt;cannot fully prevent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;unrealized justification reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;Capella upgrade&lt;&#x2F;td&gt;&lt;td&gt;cause staircase attack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;justification withholding reorg&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;Capella upgrade&lt;&#x2F;td&gt;&lt;td&gt;cause staircase attack&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;staircase attack&lt;&#x2F;td&gt;&lt;td&gt;synchrony&lt;&#x2F;td&gt;&lt;td&gt;Deneb upgrade&lt;&#x2F;td&gt;&lt;td&gt;cannot fully prevent&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;⋆ Proposer boosting parameter decreases from 0.7 to 0.4.&lt;br &#x2F;&gt;
† The attack is conducted after the network is synchronous.&lt;&#x2F;p&gt;
&lt;p&gt;In response to these vulnerabilities, mitigation approaches have been proposed from both academia and industry. They are often designed in an ad-hoc way, addressing one issue at a time. Without formal proof, these mitigation approaches may create new issues. For instance, to mitigate the ex-ante reorg attack and balancing attack, Ethereum implements the &lt;em&gt;proposer boosting&lt;&#x2F;em&gt; mechanism. By temporarily adjusting the weight of the block in the current slot, the forks created by the adversary will not become the canonical chain. However, this mitigation approach introduces new issues. A so-called &lt;em&gt;sandwich reorg attack&lt;&#x2F;em&gt; was later proposed, exploiting proposer boosting to create a reorg attack. The sandwich reorg attack is a variant of ex-ante reorg attacks where two Byzantine proposers collude to make the blocks by honest validators orphaned. Additionally, many known mitigation solutions lack formal analysis or introduce additional assumptions, e.g., by assuming that the ratio of stake controlled by the adversary is no more than 20%. Therefore, our approach aims to provide a provably secure and efficient solution that is resilient to reorg attacks in Ethereum PoS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;We provide a lightweight yet efficient solution for Ethereum PoS which is:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;reorg resilient in a synchronous network;&lt;&#x2F;li&gt;
&lt;li&gt;safe and live in a partially synchronous network;&lt;&#x2F;li&gt;
&lt;li&gt;easy to implement and deploy.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We introduce AA, an approach inspired by conventional BFT protocols from &lt;em&gt;weak quorum&lt;&#x2F;em&gt; of attestations. Namely, consider a system with $N$ validators, among which at most $f$ are faulty. If $f+1$ validators vote for a block $b$ in slot $t$, at least one honest validator has validated $b$. The $f+1$ attestations become a &lt;em&gt;proof&lt;&#x2F;em&gt; of the availability of $b$. We use $AA_t$ to denote a block with $f+1$ attestations in slot $t$.&lt;&#x2F;p&gt;
&lt;p&gt;Putting the concept of weak quorums in the context of Ethereum PoS, we define AA as a mechanism that checks &lt;em&gt;whether a block includes matching attestations from at least one-third of validators&lt;&#x2F;em&gt; (For simplicity, we assume that all validators attest in every slot in this section). In particular, if $b$ is a block for slot $t$, its child must include attestations for $b$ from at least one-third of validators in slot $t$. We use the notion of &lt;em&gt;stable block&lt;&#x2F;em&gt; to describe this scenario.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition&quot;&gt;Definition&lt;&#x2F;h3&gt;
&lt;p&gt;Formally, we give the following definitions for AA:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;(AA) We use $AA_t$ to denote a block that receives more than one-third of attestations voting for it in slot $t$.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(Stable block) &lt;em&gt;A block $b$ proposed in slot $t$ is a stable block if the parent of block $b$ is $AA_{t-1}$&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(Unstable block) &lt;em&gt;Block $b$ is an unstable block if $b$ is not a stable block.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;(Stable chain) &lt;em&gt;The chain $c$ is a stable chain if the leaf block of $c$ is a stable block.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In practice, the validators are divided into 32 disjoint committees randomly. Since the committees are sampled pseudorandomly, the number of Byzantine validators in each committee can be approximated by a binomial distribution. We use $f$ as the number of total Byzantine validators and $f&#x27;$ as the expected number of Byzantine validators in each committee.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We use $\vartheta$ to denote a threshold on the number of Byzantine validators in each committee and $p$ as the desirable failure probability (i.e., the probability that the number of Byzantine validators in a committee is greater than $\vartheta$).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Given the desired value $p$, the value of $\vartheta$ can be calculated using $\vartheta = \lfloor\mu + \sigma \cdot \Phi^{-1}(1 - p)\rfloor,$ where $\mu = f&#x27;$, $\sigma^2 = f&#x27;(1 - f&#x2F;n)$, and $\Phi^{-1}$ is the inverse of the cumulative distribution function of the normal distribution. We show some concrete examples of the ratio of Byzantine validators in a committee.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;n     \ p&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁶&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁷&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁸&lt;&#x2F;th&gt;&lt;th&gt;10⁻⁹&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2¹⁴&lt;&#x2F;td&gt;&lt;td&gt;0.4316&lt;&#x2F;td&gt;&lt;td&gt;0.4414&lt;&#x2F;td&gt;&lt;td&gt;0.4492&lt;&#x2F;td&gt;&lt;td&gt;0.4570&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2¹⁶&lt;&#x2F;td&gt;&lt;td&gt;0.3828&lt;&#x2F;td&gt;&lt;td&gt;0.3872&lt;&#x2F;td&gt;&lt;td&gt;0.3916&lt;&#x2F;td&gt;&lt;td&gt;0.3955&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2¹⁸&lt;&#x2F;td&gt;&lt;td&gt;0.3580&lt;&#x2F;td&gt;&lt;td&gt;0.3603&lt;&#x2F;td&gt;&lt;td&gt;0.3625&lt;&#x2F;td&gt;&lt;td&gt;0.3645&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2²⁰&lt;&#x2F;td&gt;&lt;td&gt;0.3457&lt;&#x2F;td&gt;&lt;td&gt;0.3468&lt;&#x2F;td&gt;&lt;td&gt;0.3479&lt;&#x2F;td&gt;&lt;td&gt;0.3489&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Ethereum now has approximately $2^{20}$ validators. The maximum desirable probability $10^{-6}$ means that the protocol fails once every $10^{6}$ slots, i.e., 138 days. If the desirable failure probability is $10^{-9}$, malicious reorganization occurs once every 380 years. We can then draw the following conclusion:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;For a large $n$, the ratio of Byzantine validators is closer to $f&#x2F;n$. In this way, we can simply set $\vartheta$ as one-third of the committee size.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;protocol-changes&quot;&gt;Protocol Changes&lt;&#x2F;h3&gt;
&lt;p&gt;We make four main changes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Modify the selection rule of parent.&lt;&#x2F;strong&gt; As mentioned in the overview, we require that a block $b$ in slot $t$ must include $\vartheta+1$ attestations to prove that the parent of block $b$ is a valid output in slot $t-1$. Therefore, the parent of block $b$ is the $AA_{t-1}$. Such a block is a stable block. If no $AA_{t-1}$ exists, the parent of block $b$ is the output of the fork choice rule. Such a block is an unstable block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Replace HLMD-GHOST with Longest Stable Chain fork choice rule.&lt;&#x2F;strong&gt; We replace the HLMD GHOST with the longest chain as the fork choice rule. Our longest chain fork choice rule is very simple: it outputs the head of the chain with the most stable blocks. In case of a tie, the longest chain fork choice rule chooses the chain such that the leaf block has the largest slot number.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Blocks carry a reference &lt;code&gt;unstable_root&lt;&#x2F;code&gt; to recent unstable blocks to preserve transaction continuity.&lt;&#x2F;strong&gt; We additionally include a field &lt;code&gt;unstable_root&lt;&#x2F;code&gt; in a block b. Each proposer sets its &lt;code&gt;unstable_root&lt;&#x2F;code&gt; field as the hash of an unstable block. If there is no such unstable block, set &lt;code&gt;unstable_root&lt;&#x2F;code&gt; as None. The transactions in the unstable blocks should not conflict with the transactions in the longest chain. The transactions in &lt;code&gt;unstable_root&lt;&#x2F;code&gt; can also be finalized once block b (that includes &lt;code&gt;unstable_root&lt;&#x2F;code&gt;) is finalized.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Simplify the filtering rule and the justification process.&lt;&#x2F;strong&gt; We simplify the filtering rule as it only considers the chain that justifies the last justified checkpoint. Additionally, the justification process only updates when a chain crosses the epoch boundary.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h3&gt;
&lt;p&gt;The modifications are based on validator and fork-choice.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;modification-1&quot;&gt;Modification 1&lt;&#x2F;h4&gt;
&lt;p&gt;For the validator behavior specification (validator in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;To propose, the validator selects a &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt;, &lt;code&gt;parent&lt;&#x2F;code&gt; using this process:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute AA blocks at the start of slot. Let &lt;code&gt;aa&lt;&#x2F;code&gt; be the later AA block and &lt;code&gt;aa_root&lt;&#x2F;code&gt; be the root of &lt;code&gt;aa&lt;&#x2F;code&gt;.
Set &lt;code&gt;parent_root = aa_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If no AA block exists, compute fork choice&#x27;s view of the head at the start of &lt;code&gt;slot&lt;&#x2F;code&gt;, after running
&lt;code&gt;on_tick&lt;&#x2F;code&gt; and applying any queued attestations from &lt;code&gt;slot - 1&lt;&#x2F;code&gt;. Set &lt;code&gt;parent_root = get_head(store)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;parent&lt;&#x2F;code&gt; be the block with &lt;code&gt;parent_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;modification-2&quot;&gt;Modification 2&lt;&#x2F;h4&gt;
&lt;p&gt;For the fork choice specification (fork_choice in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;Add a class called &lt;code&gt;chain&lt;&#x2F;code&gt; to manage the stable chains.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Chain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    leaf&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    length&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add chains in &lt;code&gt;store&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Store&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chains&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Chain&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Modify &lt;code&gt;get_head&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;store&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get filtered block tree that only includes viable branches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_filtered_block_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute the longest stable chain fork choice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chains&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;lambda&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; c&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;modification-3&quot;&gt;Modification 3&lt;&#x2F;h4&gt;
&lt;p&gt;For the validator behavior specification (validator in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;Modify &lt;code&gt;Preparing for a BeaconBlock&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;To construct a &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;, a &lt;code&gt;block&lt;&#x2F;code&gt; (&lt;code&gt;BeaconBlock&lt;&#x2F;code&gt;) is defined with the necessary context for a block proposal:&lt;&#x2F;p&gt;
&lt;h5 id=&quot;unstable-root&quot;&gt;unstable_root&lt;&#x2F;h5&gt;
&lt;p&gt;Set &lt;code&gt;block.unstable_root&lt;&#x2F;code&gt; as the hash of the latest unstable block if such block exists. If none exists, set &lt;code&gt;block.unstable_root = None&lt;&#x2F;code&gt;. The transactions in &lt;code&gt;unstable_root&lt;&#x2F;code&gt; must not conflict with the stable chain and will be finalized once &lt;code&gt;block&lt;&#x2F;code&gt; is finalized.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;modification-4&quot;&gt;Modification 4&lt;&#x2F;h4&gt;
&lt;p&gt;For the fork choice specification (fork_choice in consensus-specs):&lt;&#x2F;p&gt;
&lt;p&gt;Modify &lt;code&gt;get_filtered_block_tree&lt;&#x2F;code&gt;. Only consider the chain that justifies the latest justified checkpoint.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_filtered_block_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;store&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Store&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Chain&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chains&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chains&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_equal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;store&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chains&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; chains&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Remove the fields &lt;code&gt;unrealized_justified_checkpoint&lt;&#x2F;code&gt; and &lt;code&gt;unrealized_finalized_checkpoint&lt;&#x2F;code&gt;. Remove &lt;code&gt;compute_pulled_up_tip&lt;&#x2F;code&gt;, i.e., remove the justification and finalization process that occurs during an epoch. The &lt;code&gt;justified_checkpoint&lt;&#x2F;code&gt; field of a chain is only updated when crossing an epoch boundary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The reason why our approach is reorg resilient is that the AA mechanism &lt;em&gt;prevents&lt;&#x2F;em&gt; Byzantine validators from creating conflicting branches. As summarized in the table, there are two strategies for Byzantine validators: (1) Byzantine validators directly propose a block conflicting with the canonical chain and (2) Byzantine validators propose a block that extends the canonical chain and delay releasing the block. Neither of these strategies works anymore after AA is implemented. For the first type, only the leaf blocks in the block tree can be the output of the fork choice rule. If a Byzantine validator tries to create a block $b_1$ that extends a block $b_0$ that is not a leaf block, $b_0$ will receive no attestations from honest validators. Thus, block $b_1$ is an unstable block. For the second type, our approach ensures that if Byzantine validators withhold at least two stable blocks, one of them must have already been observed by &lt;em&gt;all&lt;&#x2F;em&gt; honest validators (see Lemma 2 in our paper for details).&lt;&#x2F;p&gt;
&lt;p&gt;Now it becomes clear why we use the &lt;em&gt;longest chain&lt;&#x2F;em&gt; rule to replace the HLMD-GHOST rule. Informally, as the HLMD-GHOST rule determines the canonical chain based on the weight of the blocks, and the weight is determined by the number of attestations, the HLMD-GHOST rule cannot prevent adversaries from withholding their attestations.&lt;&#x2F;p&gt;
&lt;p&gt;Our modified protocol can achieve the safety and liveness properties of the consensus protocol. Safety still holds since we do not modify Casper, the finality gadget protocol. Liveness is achieved after GST mainly because our protocol is reorg resilient in a synchronous network. As all honest validators consider the blocks proposed by honest validators to be part of the longest chain, their attestations will be considered valid by all honest validators, so eventually some block is finalized.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal modifies the fork choice logic and attestation format, which may not be compatible with existing clients. A hard fork or protocol version flag will be required for deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Resilience to reorg attacks&lt;&#x2F;strong&gt;: The protocol is provably resilient to all known forms of reorg attacks in synchronous networks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;No new attack surfaces&lt;&#x2F;strong&gt;: The protocol avoids introducing new message types or unnecessary overhead.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Safe and live&lt;&#x2F;strong&gt;: Maintains standard safety and liveness in partially synchronous networks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A full formal proof of correctness and evaluation over 16,384 validators is provided in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7942&#x2F;.&#x2F;assets&#x2F;available-attestation-paper.pdf&quot;&gt;companion paper&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Count leading zeros (CLZ) opcode</title>
        <published>2025-04-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vectorized</name><uri>https://github.com/Vectorized</uri>
	</author>
	
	<author>
		<name>Georgios Konstantopoulos</name><uri>https://github.com/gakonst</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7939/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/create-a-new-opcode-for-counting-leading-zeros-clz/10805" />
        

        <id>https://wg-eips.ritovision.com/7939/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7939"
            label="EIP-7939" />
        

        
        

        
        <summary type="html">Opcode to count the number of leading zero bits in a 256-bit word</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7939/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new opcode, &lt;code&gt;CLZ(x)&lt;&#x2F;code&gt;, which pops &lt;code&gt;x&lt;&#x2F;code&gt; from the stack and pushes the number of leading zero bits in &lt;code&gt;x&lt;&#x2F;code&gt; to the stack. If &lt;code&gt;x&lt;&#x2F;code&gt; is zero, pushes 256.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Count leading zeros (CLZ) is a native opcode in many processor architectures (even in RISC architectures like ARM).&lt;&#x2F;p&gt;
&lt;p&gt;It is a basic building block used in math operations, byte operations, compression algorithms, data structures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;lnWad&lt;&#x2F;li&gt;
&lt;li&gt;powWad&lt;&#x2F;li&gt;
&lt;li&gt;lambertW0Wad&lt;&#x2F;li&gt;
&lt;li&gt;sqrt&lt;&#x2F;li&gt;
&lt;li&gt;cbrt&lt;&#x2F;li&gt;
&lt;li&gt;byte string comparisons&lt;&#x2F;li&gt;
&lt;li&gt;generalized calldata compression&#x2F;decompression&lt;&#x2F;li&gt;
&lt;li&gt;bitmaps (for finding the next&#x2F;previous set&#x2F;unset bit)&lt;&#x2F;li&gt;
&lt;li&gt;post quantum signature schemes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Adding a &lt;code&gt;CLZ&lt;&#x2F;code&gt; opcode will:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Lead to cheaper compute.&lt;&#x2F;li&gt;
&lt;li&gt;Lead to cheaper ZK proving costs. The fastest known Solidity implementation uses several dynamic bitwise right shifts &lt;code&gt;shr&lt;&#x2F;code&gt;, which are very expensive to prove. In SP1 rv32im, a 32-bit right shift costs 1.6x more than a 32-bit mul.&lt;&#x2F;li&gt;
&lt;li&gt;Lead to smaller bytecode size. The fastest known Solidity implementation contains several large constants and is often inlined for performance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode is introduced: &lt;code&gt;CLZ&lt;&#x2F;code&gt; (&lt;code&gt;0x1e&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pops 1 value from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes a value to the stack, according to the following code:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; @dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Count leading zeros.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the number of zeros preceding the most significant one bit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If `x` is zero, returns 256.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is the fastest known `CLZ` implementation in Solidity and uses about 184 gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; @solidity memory-safe-assembly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shl&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; forgefmt: disable-next-item&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;xor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; byte&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;and&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x1f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;shr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x8421084210842108cc6318c6db6d54be&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or in Python,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Returns the number of zeros preceding the most significant one bit.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;clz is undefined for negative numbers&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;clz is undefined for numbers larger than 2**256 - 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert to binary string and remove any &amp;#39;0b&amp;#39; prefix.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bin_str&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;replace&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bin_str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Or in C++,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;inline&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFF0000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FF000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;F0000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;C0000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80000000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `x` is a uint256 bit number represented with 8 uint32 limbs.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This implementation is optimized for SP1 proving via rv32im.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; For regular compute, it performs similarly to `ADD`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;inline&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 160&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cost of the opcode is 5, matching MUL (raised from 3 to avoid under-pricing DoS risk).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-special-0-case&quot;&gt;The special 0 case&lt;&#x2F;h3&gt;
&lt;p&gt;256 is the smallest number after 255. Returning a small number allows the result to be compared with minimal additional bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;For byte scanning operations, one can get the number of bytes to be skipped for a zero word by simply computing &lt;code&gt;256 &amp;gt;&amp;gt; 3&lt;&#x2F;code&gt;, which gives 32.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;preference-over-ctz-count-trailing-zeros&quot;&gt;Preference over &lt;code&gt;CTZ&lt;&#x2F;code&gt; (count trailing zeros)&lt;&#x2F;h3&gt;
&lt;p&gt;Computing the least significant bit can be easily implemented with &lt;code&gt;CLZ&lt;&#x2F;code&gt; by isolating the smallest bit via &lt;code&gt;x &amp;amp; -x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is not possible to implement &lt;code&gt;CLZ&lt;&#x2F;code&gt; with &lt;code&gt;CTZ&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;We have benchmarked the &lt;code&gt;CLZ&lt;&#x2F;code&gt; implementation against the &lt;code&gt;ADD&lt;&#x2F;code&gt; implementation in the intx library. &lt;code&gt;CLZ&lt;&#x2F;code&gt; uses approximately the same amount of compute cycles as &lt;code&gt;ADD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The SP1 rv32im optimized variant uses less compute cycles than &lt;code&gt;ADD&lt;&#x2F;code&gt;, in the average and worst cases.&lt;&#x2F;p&gt;
&lt;p&gt;In SP1 rv32im, a 256-bit &lt;code&gt;CLZ&lt;&#x2F;code&gt; is cheaper to prove than &lt;code&gt;ADD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new opcode not present prior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x4000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CLZ&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x00000000000000000000000000000000000000000000000000000000000000ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;CLZ&lt;&#x2F;code&gt; is a stateless opcode that has a low worst-case constant cost in memory usage, compute and proving costs. It is therefore safe from being exploited for denial of service attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM64 - 64-bit mode EVM opcodes</title>
        <published>2025-04-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7937/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-9687-64-bit-mode-evm-operations/23794" />
        

        <id>https://wg-eips.ritovision.com/7937/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7937"
            label="EIP-7937" />
        

        
        

        
        <summary type="html">Multibyte opcodes for 64-bit arithmetic, comparison, bitwise and flow operations in EVM.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7937/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces multibyte opcodes prefixed by &lt;code&gt;C0&lt;&#x2F;code&gt; for 64-bit arithmetic (&lt;code&gt;C001&lt;&#x2F;code&gt;-&lt;code&gt;C00B&lt;&#x2F;code&gt;), comparison (&lt;code&gt;C010&lt;&#x2F;code&gt;-&lt;code&gt;C015&lt;&#x2F;code&gt;), bitwise (&lt;code&gt;C016&lt;&#x2F;code&gt;-&lt;code&gt;C019&lt;&#x2F;code&gt;) and flow (&lt;code&gt;C056&lt;&#x2F;code&gt; and &lt;code&gt;C057&lt;&#x2F;code&gt;) operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Not all computations in EVM can utilize the full 256-bit integer width. It can therefore be beneficial to have a &quot;64-bit mode&quot; to avoid unnecessary cycles. This EIP uses a &quot;prefix&quot; opcode &lt;code&gt;C0&lt;&#x2F;code&gt;, essentially forming multibyte opcodes to avoid polluting the EVM opcode space too much.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prefix-opcode-behavior&quot;&gt;Prefix opcode behavior&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP uses the prefix opcode &lt;code&gt;C0&lt;&#x2F;code&gt;, and it only occupies this single EVM opcode space. Upon the interpreter encountering opcode &lt;code&gt;C0&lt;&#x2F;code&gt;, it MUST continue to seek the next byte in code. It then executes things in &quot;64-bit mode&quot;, based on the second byte, described below. If the execution is successful, then the interpreter MUST increase &lt;code&gt;PC&lt;&#x2F;code&gt; by 2 (instead of 1).&lt;&#x2F;p&gt;
&lt;p&gt;If the second byte is not a valid 64-bit mode operation, then the interpreter MUST OOG.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;general-64-bit-mode-behavior&quot;&gt;General 64-bit mode behavior&lt;&#x2F;h3&gt;
&lt;p&gt;In 64-bit mode, all operations only work on the least significant 64-bit of each stack value. The most significant 192-bit is discarded. When a result value is pushed back onto the stack, then it MUST ensures that observable effects will see that the most significant 192-bit is zero. Note that here it&#x27;s not necessary for an interpreter to reset the most significant 192-bit to zero every time -- if the next opcode is still in 64-bit mode, then the most significant 192-bit is still unobservable. We discuss the full details in the &quot;rationale&quot; section. The interpreter only needs to reproduce the full 256-bit value upon entering non-64-bit mode. If the full computational heavy part can be written in pure 64-bit mode, then this can result in noticeable performance gain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-constants&quot;&gt;Gas cost constants&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following gas cost constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;G_BASE64&lt;&#x2F;code&gt;: 1&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;: 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_LOW64&lt;&#x2F;code&gt;: 3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_MID64&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_HIGH64&lt;&#x2F;code&gt;: 7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_STATIC&lt;&#x2F;code&gt;: 5&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;G_EXP64_DYNAMIC&lt;&#x2F;code&gt;: 25&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;arithmetic-opcodes&quot;&gt;Arithmetic opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode arithmetic opcodes are defined the same as non-64-bit mode, except that it only operates on the least significant 64-bits. In the below definition, &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;, &lt;code&gt;N&lt;&#x2F;code&gt; is &lt;code&gt;a mod 2^64&lt;&#x2F;code&gt;, &lt;code&gt;b mod 2^64&lt;&#x2F;code&gt; and &lt;code&gt;N mod 2^64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ADD (&lt;code&gt;C001&lt;&#x2F;code&gt;) and SUB (&lt;code&gt;C003&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;MUL (&lt;code&gt;C002&lt;&#x2F;code&gt;), DIV (&lt;code&gt;C004&lt;&#x2F;code&gt;), SDIV (&lt;code&gt;C005&lt;&#x2F;code&gt;), MOD (&lt;code&gt;C006&lt;&#x2F;code&gt;), SMOD (&lt;code&gt;C007&lt;&#x2F;code&gt;), SIGNEXTEND (&lt;code&gt;C00B&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_LOW64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;ADDMOD (&lt;code&gt;C008&lt;&#x2F;code&gt;), MULMOD (&lt;code&gt;C009&lt;&#x2F;code&gt;): &lt;code&gt;a op b % N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_MID64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;EXP (&lt;code&gt;C00A&lt;&#x2F;code&gt;): &lt;code&gt;a EXP b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;static_gas = G_EXP64_STATIC, dynamic_gas = G_EXP64_DYNAMIC * exponent_byte_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;comparison-and-bitwise-opcodes&quot;&gt;Comparison and bitwise opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The 64-bit mode comparison and bitwise opcodes are defined the same as non-64-bit mode, except that they only operates on the least significant 64 bits.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;LT (&lt;code&gt;C010&lt;&#x2F;code&gt;), GT (&lt;code&gt;C011&lt;&#x2F;code&gt;), SLT (&lt;code&gt;C012&lt;&#x2F;code&gt;), SGT (&lt;code&gt;C013&lt;&#x2F;code&gt;), EQ (&lt;code&gt;C014&lt;&#x2F;code&gt;), AND (&lt;code&gt;C016&lt;&#x2F;code&gt;), OR (&lt;code&gt;C017&lt;&#x2F;code&gt;), XOR (&lt;code&gt;C018&lt;&#x2F;code&gt;): &lt;code&gt;a op b mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;ISZERO (&lt;code&gt;C015&lt;&#x2F;code&gt;), NOT (&lt;code&gt;C019&lt;&#x2F;code&gt;): &lt;code&gt;op a mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;SHL (&lt;code&gt;C01B&lt;&#x2F;code&gt;), SHR (&lt;code&gt;C01C&lt;&#x2F;code&gt;), SAR (&lt;code&gt;C01D&lt;&#x2F;code&gt;): &lt;code&gt;a op N mod 2^64&lt;&#x2F;code&gt;, gas cost &lt;code&gt;G_VERYLOW64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;64-bit EQ (&lt;code&gt;C014&lt;&#x2F;code&gt;) may return true for two different integers because it&#x27;ll only compare the least significant 64 bits.&lt;&#x2F;li&gt;
&lt;li&gt;64-bit ISZERO (&lt;code&gt;C015&lt;&#x2F;code&gt;) may return true for non-zero 256-bit integers as long as the last 64 bits are zero.&lt;&#x2F;li&gt;
&lt;li&gt;BYTE (&lt;code&gt;1A&lt;&#x2F;code&gt;) does not have 64-bit mode because it affects endianness.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;jump-jumpi&quot;&gt;JUMP, JUMPI&lt;&#x2F;h3&gt;
&lt;p&gt;For flow operations JUMP and JUMPI, the behavior is as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;JUMP&lt;&#x2F;code&gt; (&lt;code&gt;C056&lt;&#x2F;code&gt;) will only read the last 64 bits from the stack value. The rest 192 bits are discarded without reading. Gas cost is &lt;code&gt;G_MID64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPI&lt;&#x2F;code&gt; (&lt;code&gt;C057&lt;&#x2F;code&gt;) will only read the last 64 bits from the stack as destination, and the condition check will only read the last 64 bits. Gas cost is &lt;code&gt;G_HIGH64&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; validation phrase, &lt;code&gt;C0&lt;&#x2F;code&gt; is considered a standalone &quot;mode&quot; opcode and if the next byte followed is &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, it continues to mark a valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; destination. Note that because there&#x27;s no 64-bit &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, during execution, &lt;code&gt;C0 JUMPDEST&lt;&#x2F;code&gt; would result in OOG.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;When a smart contract uses the 64-bit mode, it&#x27;s expected that once entered, it will want to stay in 64-bit mode, and only exit to non-64-bit mode when the computationally intensive function is finished. This EIP is designed particularly with this fact in mind.&lt;&#x2F;p&gt;
&lt;p&gt;All 64-bit opcodes only operates on the 64-bit value. It totally discards the rest 192 bits. The interpreter only needs to ensure that when it exits into non-64-bit mode and next time when a value result is read, that value has the first 192 bits reset to zero. The EVM interpreter can therefore use a typed stack for optimization:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;haskell&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; StackItem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Value&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; U256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; Value64&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The typed stack can also be implemented as a bitmap for memory alignment.&lt;&#x2F;p&gt;
&lt;p&gt;For all inputs of 64-bit opcodes, it will either read in a &lt;code&gt;Value&lt;&#x2F;code&gt;, when it&#x27;ll only take the last 64 bits, or a &lt;code&gt;Value64&lt;&#x2F;code&gt;, which is what is needed. It then always outputs a &lt;code&gt;Value64&lt;&#x2F;code&gt;. After exiting into non-64-bit mode and upon a &lt;code&gt;Value64&lt;&#x2F;code&gt; is read, the interpreter then translate the value back to 256-bit &lt;code&gt;Value&lt;&#x2F;code&gt; by extending the first 192 bits with zero.&lt;&#x2F;p&gt;
&lt;p&gt;The 64-bit mode does not contain any opcodes which depends on the value&#x27;s endianness, therefore &lt;code&gt;Value64&lt;&#x2F;code&gt; can also be stored in the optimal endianness of the architecture.&lt;&#x2F;p&gt;
&lt;p&gt;The 64-bit mode will not save any memory usage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;discussions&quot;&gt;Discussions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;prefix-modes-opcodes&quot;&gt;Prefix (modes) opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP also recommends that we reserve &lt;code&gt;C0&lt;&#x2F;code&gt;-&lt;code&gt;CF&lt;&#x2F;code&gt; for prefix (modes) opcodes. For example, an additional modes OVERFLOW can be envisioned that changes the behavior of arithmetic opcodes from wrapping to overflow OOG, which can help to reduce, for example, the extra cycles needed for &lt;code&gt;SafeMath&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;optimization-assumptions&quot;&gt;Optimization assumptions&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP assumes that the majority of EVM implementations target native little-endian 64-bit architectures (like &lt;code&gt;x86_64&lt;&#x2F;code&gt;, &lt;code&gt;arm64&lt;&#x2F;code&gt; and &lt;code&gt;riscv64&lt;&#x2F;code&gt;). A 256-bit stack item is stored efficiently internally as 4 items of 64-bit unsigned integer &lt;code&gt;[u64; 4]&lt;&#x2F;code&gt;. This EIP works best, in terms of optimizations, for those implementations. The opcodes simply operates on the last &lt;code&gt;u64&lt;&#x2F;code&gt;, instead of the whole &lt;code&gt;[u64; 4]&lt;&#x2F;code&gt;. There are basically no other changes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;endianness&quot;&gt;Endianness&lt;&#x2F;h4&gt;
&lt;p&gt;In 64-bit mode, the principle of the specification is that the endianness should be kept strictly as an implementation detail. There should not be any opcodes that depends on endian. This is important, because on the one hand, we must enable easy and fast interop for 64-bit and non-64-bit opcodes. On the other hand, the interpreter should be able to do optimizations internally whether it uses little or big endian.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the issue of endianness, this EIP currently does not contain 64-bit mode &lt;code&gt;BYTE64&lt;&#x2F;code&gt;, memory opcodes &lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt;, and stack push opcodes &lt;code&gt;PUSH*64&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt; to &lt;code&gt;PUSH8&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to extend EVM64 where &quot;64-bit mode&quot; is instead defined as &quot;little-endian 64-bit mode&quot;, which can be separately discussed and specified:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BYTE64&lt;&#x2F;code&gt; will be little-endian, so instead of &lt;code&gt;(x &amp;gt;&amp;gt; (248 - i * 8)) &amp;amp; 0xFF&lt;&#x2F;code&gt;, it will be &lt;code&gt;(x &amp;gt;&amp;gt; i * 8) &amp;amp; 0xFF&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MLOAD64&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE64&lt;&#x2F;code&gt; loads and store little-endian 64-bit values in memory.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PUSH*64&lt;&#x2F;code&gt; (&lt;code&gt;PUSH1&lt;&#x2F;code&gt; to &lt;code&gt;PUSH8&lt;&#x2F;code&gt;) accepts literal little-endian bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In specification there is no issue with the design, but this can bring significant confusions to developers. So the author advise caution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pop-dup-swap&quot;&gt;&lt;code&gt;POP&lt;&#x2F;code&gt;, &lt;code&gt;DUP*&lt;&#x2F;code&gt;, &lt;code&gt;SWAP*&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;There is no explicit 64-bit mode for stack operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;POP&lt;&#x2F;code&gt; is &quot;automatically 64-bit&quot; because it only removes values from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUP*&lt;&#x2F;code&gt; and &lt;code&gt;SWAP*&lt;&#x2F;code&gt; will copy or swap stack items optimized for 64-bit as is. They are kept optimized, so there&#x27;s no need for separate 64-bit mode for those opcodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;drawbacks&quot;&gt;Drawbacks&lt;&#x2F;h4&gt;
&lt;p&gt;Known drawbacks and tradeoffs of 64-bit mode includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The binary size will become larger. This is apparent as previously the opcode is single byte, but now it is two bytes. Each byte costs an additional 200 gas to deposit. However, 64-bit mode opcodes are (generally) cheaper, which gives developers sufficient incentives to utilize it (at most 200 calls and the cumulative gas costs will be cheaper).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new (prefix) opcode &lt;code&gt;C0&lt;&#x2F;code&gt;. &lt;code&gt;C0&lt;&#x2F;code&gt; was previously an invalid opcode that has little usage, and thus the backward compatibility issues are minimal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are organized as &lt;code&gt;[stack_item_1, stack_item_2] C0 opcode =&amp;gt; [result_stack_item_1, result_stack_item_2]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;[ff00000000000000 000000000000000 0000000000000ff 000000000000001, ff0000000000000 000000000000000 0000000000000ff f0000000000000f] C0 SHR =&amp;gt; [&amp;lt;0&amp;gt; 780000000000007]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>RLP Execution Block Size Limit</title>
        <published>2025-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Storm Slivkoff</name><uri>https://github.com/sslivkoff</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7934/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7934-add-bytesize-limit-to-blocks/23589" />
        

        <id>https://wg-eips.ritovision.com/7934/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7934"
            label="EIP-7934" />
        

        
        

        
        <summary type="html">Introduce a protocol-level cap on the maximum RLP-encoded block size to 10 MiB, including a 2 MiB margin for beacon block size.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7934/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a protocol-level cap on the maximum RLP-encoded execution block size to 10 megabytes (MiB), which includes a margin of 2 MiB to account for beacon block sizes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Ethereum does not enforce a strict upper limit on the encoded size of blocks. This lack of constraint can result in:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Network Instability&lt;&#x2F;strong&gt;: Extremely large blocks slow down propagation and increase the risk of temporary forks and reorgs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DoS Risks&lt;&#x2F;strong&gt;: Malicious actors could generate exceptionally large blocks to disrupt network performance.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Additionally, blocks exceeding 10 MiB are not propagated by the consensus layer&#x27;s (CL) gossip protocol, potentially causing network fragmentation or denial-of-service (DoS) conditions.&lt;&#x2F;p&gt;
&lt;p&gt;By imposing a protocol-level limit on the RLP-encoded block size, Ethereum can ensure enhanced resilience against targeted attacks on block validation times. Adding an additional margin of 2MiB explicitly accommodates beacon block sizes, ensuring compatibility across network components.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-size-cap&quot;&gt;Block Size Cap&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Introduce constants:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAX_BLOCK_SIZE&lt;&#x2F;code&gt; set to &lt;strong&gt;10 MiB (10,485,760 bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SAFETY_MARGIN&lt;&#x2F;code&gt; set to &lt;strong&gt;2MiB (2,097,152  bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt; calculated as &lt;code&gt;MAX_BLOCK_SIZE - MARGIN&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Any RLP-encoded block exceeding &lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt; must be considered invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Thus add the following check to the Ethereum protocol:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10_485_760&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 10 MiB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SAFETY_MARGIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2_097_152&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2 MiB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SAFETY_MARGIN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; if true, the block is invalid and should be rejected&#x2F;not get built&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; exceed_max_rlp_block_size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_RLP_BLOCK_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;changes-to-protocol-behavior&quot;&gt;Changes to Protocol Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Block Creation&lt;&#x2F;strong&gt;: Validators must ensure the total RLP-encoded size of any produced block does not exceed &lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Validation&lt;&#x2F;strong&gt;: Nodes must reject blocks whose RLP-encoded size exceeds &lt;code&gt;MAX_RLP_BLOCK_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;protocol-adjustment&quot;&gt;Protocol Adjustment&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;All Ethereum client implementations must integrate this size check as part of block validation and propagation.&lt;&#x2F;li&gt;
&lt;li&gt;This limit applies independently of gas-related metrics.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-10-mib&quot;&gt;Why 10 MiB?&lt;&#x2F;h3&gt;
&lt;p&gt;A cap of 10 MiB aligns with the gossip protocol constraint in Ethereum&#x27;s consensus layer (CL). An additional 2MiB margin explicitly accounts for beacon block sizes, ensuring compatibility and consistent block propagation across the network. Blocks significantly larger than 10 MiB will not be broadcast by the CL, potentially leading to network fragmentation or denial-of-service scenarios.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is &lt;strong&gt;not backward-compatible&lt;&#x2F;strong&gt; with any blocks larger than the newly specified size limit. Validators and miners will need to ensure their block construction logic strictly respects this limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Restricting maximum block size provides inherent protection against deliberate oversized-block attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Secondary Signature Algorithms</title>
        <published>2025-04-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Kempton</name><uri>https://github.com/SirSpudlington</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7932/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7932-secondary-signature-algorithms/23514" />
        

        <id>https://wg-eips.ritovision.com/7932/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7932"
            label="EIP-7932" />
        

        
        

        
        <summary type="html">Introduces a precompile and registry for handling alternative signature algorithms</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7932/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Creates a unified registry &amp;amp; standardized interface for introducing additional signature algorithms for the use of deriving account addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Introduces a precompile at address &lt;code&gt;SIGRECOVER_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; for decoding these newly introduced algorithms.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As quantum computers become more advanced, several new post-quantum (PQ) algorithms have been designed. These algorithms all have certain drawbacks, such as large key sizes (&amp;gt;1KiB), large signature sizes, or long verification times. These issues make them more expensive to compute and store than the currently used secp256k1 curve.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP allows the use of many algorithms by introducing an algorithm registry that can be used via a single interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Unless explicitly noted, integer encoding MUST be in big-endian format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SIGRECOVER_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20(0x12)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SIGRECOVER_PRECOMPILE_BASE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;algorithm-specification&quot;&gt;Algorithm specification&lt;&#x2F;h3&gt;
&lt;p&gt;New algorithms beyond the &lt;code&gt;secp256k1&lt;&#x2F;code&gt; algorithm specified in this EIP MUST be specified via a distinct EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Each type of algorithm MUST specify the following fields:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;trait&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Algorithm&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The algorithm type byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ALG_TYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The size of signatures. Signatures MUST be padded&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to this size to be valid. Note that this does include&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the ALG_TYPE byte prefix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; uint32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the gas cost of signing this data. This&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SHOULD include a reasonable minimum and MUST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; be relative to secp256k1, i.e. 0 gas is secp256k1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check whether the signature is valid. For some&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; algorithms, this may be a no-op. This function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; will always be called before `verify`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Take the signature and signing_data and return the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; public key of the signer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Specifications MUST include some form of security analysis on the provided algorithm and basic benchmarks justifying gas costs. Additionally, specifications MUST address malleability issues that may arise from specified algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;An example of this specification can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;assets&#x2F;template-eip&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deriving-address-from-public-keys&quot;&gt;Deriving address from public keys&lt;&#x2F;h3&gt;
&lt;p&gt;The function below MUST be used when deriving an address from a public key:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; pubkey_to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; algorithm_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; algorithm_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FF&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compatibility shim to ensure backwards compatibility&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; with `||` being binary concatenation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;algorithm_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;algorithm-registry&quot;&gt;Algorithm Registry&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AlgorithmEntry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ALG_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SIZE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Callable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Callable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    verify&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Callable&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; AlgorithmEntry&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This EIP uses the &lt;code&gt;algorithm_registry&lt;&#x2F;code&gt; object to signify algorithms that have been included within a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;A living EIP MAY be created on finalization of this EIP to track currently active algorithms across forks.&lt;&#x2F;p&gt;
&lt;p&gt;The algorithm type is reserved &lt;code&gt;0xFE&lt;&#x2F;code&gt; as invalid &#x2F; missing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;p&gt;The following helper functions are defined for convenience:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_penalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;algorithm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;algorithm&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This function cannot be called without prior calling `validate_signature(signature)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; algorithm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;secp256k1-algorithm&quot;&gt;&lt;code&gt;secp256k1&lt;&#x2F;code&gt; algorithm&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ALG_TYPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SECP256K1_SIGNATURE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secp256k1_unpack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SECP256K1_SIGNATURE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_parity&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; secp256k1_validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteVector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SECP256K1_SIGNATURE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SECP256K1N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; secp256k1_unpack&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SECP256K1N&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SECP256K1N&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is an adaptation from the KECCAK256 opcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        minimum_word_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; Uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; minimum_word_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    secp256k1_validate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Another compatibility shim to ensure passing a 32 byte hash still works.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ecdsa&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ECDSA&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recover_sig&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ecdsa&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ecdsa_recoverable_deserialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;65&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;65&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PublicKey&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ecdsa&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ecdsa_recover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; recover_sig&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; raw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uncompressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; public_key&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;compressed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; uncompressed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sigrecover-precompile&quot;&gt;&lt;code&gt;sigrecover&lt;&#x2F;code&gt; precompile&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP also introduces a new precompile located at &lt;code&gt;SIGRECOVER_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This precompile MUST charge &lt;code&gt;SIGRECOVER_PRECOMPILE_BASE_GAS&lt;&#x2F;code&gt; static gas before executing.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile MUST output the 20-byte address of the signer provided left padded to 32 bytes. Callers MUST assume all zero bytes as a failure. On failure, the precompile MUST return 32 &lt;code&gt;0x00&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sigrecover_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; algorithm_registry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calculate_penalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Run validate&#x2F;verify function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; verify_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return address left-padded to 32 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; pubkey_to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;erc-4337-interoperability&quot;&gt;ERC-4337 interoperability&lt;&#x2F;h3&gt;
&lt;p&gt;While initial drafts of this EIP were competing with ERC-4337, current versions of this EIP support it via the sigrecover precompile. This allows any ERC-4337 implementation to have the same signature verification logic and address derivation logic for any given private key. This also works agnostic of whatever algorithm derives the address.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompile-over-native-evm-code&quot;&gt;Precompile over native EVM code&lt;&#x2F;h3&gt;
&lt;p&gt;Having a precompile allows non-EVM processes, i.e. transaction level signature verification, to access the registry &lt;em&gt;without&lt;&#x2F;em&gt; having to call into the EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opaque-signature-type&quot;&gt;Opaque &lt;code&gt;signature&lt;&#x2F;code&gt; type&lt;&#x2F;h3&gt;
&lt;p&gt;As each algorithm has unique properties, e.g. supporting signature recovery and key sizes, the object needs to hold every permutation of every possible signature and potentially additional recovery information. A bytearray of an algorithm-defined size would be able to achieve this goal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-7932 does not modify any existing logic and does not pose any backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for the &lt;code&gt;sigrecover&lt;&#x2F;code&gt; precompile may be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;.&#x2F;assets&#x2F;precompile_test_cases.py&quot;&gt;precompile_test_cases.py&lt;&#x2F;a&gt; file.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Allowing more ways to derive addresses for a single account may decrease overall security for that specific account. However, this is partially mitigated by the increase in processing power required to trial all algorithms. Even still, adding additional algorithms may need further discussion to ensure that the security of the network would not be compromised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-Level Access Lists</title>
        <published>2025-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Francesco D`Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7928/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7928-block-level-access-lists/23337" />
        

        <id>https://wg-eips.ritovision.com/7928/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7928"
            label="EIP-7928" />
        

        
        

        
        <summary type="html">Enforced block access lists with state locations and post-transaction state diffs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7928/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces Block-Level Access Lists (BALs) that record all accounts and storage locations accessed during block execution, along with their post-execution values. BALs enable parallel disk reads, parallel transaction validation, parallel state root computation and executionless state updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Transaction execution cannot be parallelized without knowing in advance which addresses and storage slots will be accessed. While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; introduced optional transaction access lists, they are not enforced.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal enforces access lists at the block level, enabling:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Parallel disk reads and transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;Parallel post-state root calculation&lt;&#x2F;li&gt;
&lt;li&gt;State reconstruction without executing transactions&lt;&#x2F;li&gt;
&lt;li&gt;Reduced execution time to &lt;code&gt;parallel IO + parallel EVM&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-structure-modification&quot;&gt;Block Structure Modification&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new field to the block header, &lt;code&gt;block_access_list_hash&lt;&#x2F;code&gt;, which contains the Keccak-256 hash of the RLP-encoded block access list. When no state changes are present, this field is the hash of an empty RLP list &lt;code&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;code&gt;, i.e. &lt;code&gt;keccak256(rlp.encode([]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_access_list_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;BlockAccessList&lt;&#x2F;code&gt; is not included in the block body. The EL stores BALs separately and transmits them as a field in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; via the engine API. The BAL is RLP-encoded as a list of &lt;code&gt;AccountChanges&lt;&#x2F;code&gt;. When no state changes are present, this field is the empty RLP list &lt;code&gt;0xc0&lt;&#x2F;code&gt;, i.e. &lt;code&gt;rlp.encode([])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rlp-data-structures&quot;&gt;RLP Data Structures&lt;&#x2F;h3&gt;
&lt;p&gt;BALs use RLP encoding following the pattern: &lt;code&gt;address -&amp;gt; field -&amp;gt; block_access_index -&amp;gt; change&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Type aliases for RLP encoding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; bytes20&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 20-byte Ethereum address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageKey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage slot key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Storage value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Bytecode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Variable-length contract bytecode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Block access index (0 for pre-execution, 1..n for transactions, n+1 for post-execution)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Post-transaction balance in wei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Core change structures (RLP encoded as lists)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; StorageChange: [block_access_index, new_value]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;StorageChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; StorageValue&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BalanceChange: [block_access_index, post_balance]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BalanceChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Balance&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; NonceChange: [block_access_index, new_nonce]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;NonceChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Nonce&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; CodeChange: [block_access_index, new_code]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CodeChange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;BlockAccessIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytecode&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; SlotChanges: [slot, [changes]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All changes to a single storage slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SlotChanges&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;StorageKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;StorageChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges: [address, storage_changes, storage_reads, balance_changes, nonce_changes, code_changes]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; All changes for a single account, grouped by field type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AccountChanges&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SlotChanges&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes (slot -&amp;gt; [block_access_index -&amp;gt; new_value])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;StorageKey&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;           #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads (read-only storage keys)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BalanceChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes ([block_access_index -&amp;gt; post_balance])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;NonceChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes ([block_access_index -&amp;gt; new_nonce])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;CodeChange&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes ([block_access_index -&amp;gt; new_code])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; BlockAccessList: List of AccountChanges&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BlockAccessList&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccountChanges&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;scope-and-inclusion&quot;&gt;Scope and Inclusion&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;BlockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is the set of all addresses accessed during block execution.&lt;&#x2F;p&gt;
&lt;p&gt;It &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Addresses with state changes (storage, balance, nonce, or code).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Addresses accessed without state changes, including:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Targets of &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; opcodes&lt;&#x2F;li&gt;
&lt;li&gt;Targets of &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (even if they revert; see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;#gas-validation-before-state-access&quot;&gt;Gas Validation Before State Access&lt;&#x2F;a&gt; for inclusion conditions)&lt;&#x2F;li&gt;
&lt;li&gt;Target addresses of &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; if the target account is accessed&lt;&#x2F;li&gt;
&lt;li&gt;Deployed contract addresses from calls with initcode to empty addresses (e.g., calling &lt;code&gt;0x0&lt;&#x2F;code&gt; with initcode)&lt;&#x2F;li&gt;
&lt;li&gt;Transaction sender and recipient addresses (even for zero-value transfers)&lt;&#x2F;li&gt;
&lt;li&gt;COINBASE address if the block contains transactions or withdrawals to the COINBASE address&lt;&#x2F;li&gt;
&lt;li&gt;Beneficiary addresses for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;System contract addresses accessed during pre&#x2F;post-execution; the system caller address, &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;), MUST NOT be included unless it experiences state access itself&lt;&#x2F;li&gt;
&lt;li&gt;Withdrawal recipient addresses, regardless of whether the withdrawal amount is non-zero&lt;&#x2F;li&gt;
&lt;li&gt;Precompiled contracts when called or accessed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Addresses with no state changes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; still be present with empty change lists.&lt;&#x2F;p&gt;
&lt;p&gt;Entries from an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access list &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included automatically. Only addresses and storage slots that are actually touched or changed during execution are recorded.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-validation-before-state-access&quot;&gt;Gas Validation Before State Access&lt;&#x2F;h3&gt;
&lt;p&gt;State-accessing opcodes perform gas validation in two phases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Pre-state validation&lt;&#x2F;strong&gt;: Gas costs determinable without state access (memory expansion, base opcode cost, warm&#x2F;cold access cost)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Post-state validation&lt;&#x2F;strong&gt;: Gas costs requiring state access (account existence, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation resolution)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Pre-state validation MUST pass before any state access occurs. If pre-state validation fails, the target resource (address or storage slot) is never accessed and MUST NOT be included in the BAL.&lt;&#x2F;p&gt;
&lt;p&gt;Once pre-state validation passes, the target is accessed and included in the BAL. Post-state costs are then calculated; their order is implementation-defined since the target has already been accessed.&lt;&#x2F;p&gt;
&lt;p&gt;The following table specifies pre-state validation costs in addition to the base opcode cost (gas constants as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Instruction&lt;&#x2F;th&gt;&lt;th&gt;Pre-state Validation&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None (accesses current contract, always warm)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; (if value &amp;gt; 0)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt; (if value &amp;gt; 0)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt; + &lt;code&gt;memory_expansion&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;memory_expansion&lt;&#x2F;code&gt; + &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; + &lt;code&gt;GAS_KECCAK256_WORD&lt;&#x2F;code&gt; + &lt;code&gt;GAS_CREATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;More than &lt;code&gt;GAS_CALL_STIPEND&lt;&#x2F;code&gt; available&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;GAS_SELF_DESTRUCT&lt;&#x2F;code&gt; + &lt;code&gt;access_cost&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;access_cost&lt;&#x2F;code&gt;: For account-accessing opcodes: &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; if cold, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; if warm. For storage-accessing opcodes (&lt;code&gt;SLOAD&lt;&#x2F;code&gt;): &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; if cold, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; if warm.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory_expansion&lt;&#x2F;code&gt;: Gas cost to expand memory for input&#x2F;output regions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Post-state costs (e.g., &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; for calls to empty accounts, &lt;code&gt;GAS_SELF_DESTRUCT_NEW_ACCOUNT&lt;&#x2F;code&gt; if beneficiary does not exist) do not affect BAL inclusion since the target has already been accessed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eip-7702-delegation&quot;&gt;EIP-7702 Delegation&lt;&#x2F;h4&gt;
&lt;p&gt;When a call target has an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation, the target is accessed to resolve the delegation. If a delegation exists, the delegated address requires its own &lt;code&gt;access_cost&lt;&#x2F;code&gt; check before being accessed. If this check fails, the delegated address MUST NOT appear in the BAL, though the original call target is included (having been accessed to resolve the delegation).&lt;&#x2F;p&gt;
&lt;p&gt;Note: Delegated accounts cannot be empty, so &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; never applies when resolving delegations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sstore&quot;&gt;SSTORE&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; performs an implicit read of the current storage value for gas calculation. The &lt;code&gt;GAS_CALL_STIPEND&lt;&#x2F;code&gt; check prevents this state access when operating within the call stipend. If &lt;code&gt;SSTORE&lt;&#x2F;code&gt; fails this check, the storage slot MUST NOT appear in &lt;code&gt;storage_reads&lt;&#x2F;code&gt; or &lt;code&gt;storage_changes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ordering-and-determinism&quot;&gt;Ordering and Determinism&lt;&#x2F;h3&gt;
&lt;p&gt;The following ordering rules &lt;strong&gt;MUST&lt;&#x2F;strong&gt; apply:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Accounts&lt;&#x2F;strong&gt;: Lexicographic by address&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;storage_changes&lt;&#x2F;strong&gt;: Slots lexicographic by storage key; within each slot, changes by block access index (ascending)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;storage_reads&lt;&#x2F;strong&gt;: Lexicographic by storage key&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;balance_changes, nonce_changes, code_changes&lt;&#x2F;strong&gt;: By block access index (ascending)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;blockaccessindex-assignment&quot;&gt;BlockAccessIndex Assignment&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;BlockAccessIndex&lt;&#x2F;code&gt; values &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be assigned as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;&#x2F;code&gt; for &lt;strong&gt;pre‑execution&lt;&#x2F;strong&gt; system contract calls.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;1 … n&lt;&#x2F;code&gt; for transactions (in block order).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;n + 1&lt;&#x2F;code&gt; for &lt;strong&gt;post‑execution&lt;&#x2F;strong&gt; system contract calls.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;recording-semantics-by-change-type&quot;&gt;Recording Semantics by Change Type&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Writes include:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any value change (post‑value ≠ pre‑value).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Zeroing&lt;&#x2F;strong&gt; a slot (pre‑value exists, post‑value is zero).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reads include:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Slots accessed via &lt;code&gt;SLOAD&lt;&#x2F;code&gt; that are not written.&lt;&#x2F;li&gt;
&lt;li&gt;Slots written with unchanged values (i.e., &lt;code&gt;SSTORE&lt;&#x2F;code&gt; where post-value equals pre-value, also known as &quot;no-op writes&quot;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: Implementations MUST check the pre-transaction value to correctly distinguish between actual writes and no-op writes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;balance-balance-changes&quot;&gt;Balance (&lt;code&gt;balance_changes&lt;&#x2F;code&gt;)&lt;&#x2F;h4&gt;
&lt;p&gt;Record &lt;strong&gt;post‑transaction&lt;&#x2F;strong&gt; balances (&lt;code&gt;uint256&lt;&#x2F;code&gt;) for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transaction &lt;strong&gt;senders&lt;&#x2F;strong&gt; (gas + value).&lt;&#x2F;li&gt;
&lt;li&gt;Transaction &lt;strong&gt;recipients&lt;&#x2F;strong&gt; (only if &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;CALL&#x2F;CALLCODE &lt;strong&gt;senders&lt;&#x2F;strong&gt; (value).&lt;&#x2F;li&gt;
&lt;li&gt;CALL&#x2F;CALLCODE &lt;strong&gt;recipients&lt;&#x2F;strong&gt; (only if &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;CREATE&#x2F;CREATE2 recipients (only if &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;COINBASE&lt;&#x2F;strong&gt; (rewards + fees).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SELFDESTRUCT&#x2F;SENDALL&lt;&#x2F;strong&gt; beneficiaries.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Withdrawal recipients&lt;&#x2F;strong&gt; (system withdrawals, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For unaltered account balances:&lt;&#x2F;p&gt;
&lt;p&gt;If an account’s balance changes during a transaction, but its post-transaction balance is equal to its pre-transaction balance, then the change &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be recorded in &lt;code&gt;balance_changes&lt;&#x2F;code&gt;. The sender and recipient address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included in &lt;code&gt;AccountChanges&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following special cases require addresses to be included with empty changes if no other state changes occur:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zero-value transfer recipients&lt;&#x2F;li&gt;
&lt;li&gt;Calling a same-transaction SELFDESTRUCT on an address that had a zero pre-transaction balance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Zero-value block reward recipients &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; trigger a balance change in the block access list and &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; cause the recipient address to be included as a read (e.g. without changes). Zero-value block reward recipients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; only be included with a balance change in blocks where the reward is greater than zero.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;code&quot;&gt;Code&lt;&#x2F;h4&gt;
&lt;p&gt;Track &lt;strong&gt;post‑transaction runtime bytecode&lt;&#x2F;strong&gt; for deployed or modified contracts, and &lt;strong&gt;delegation indicators&lt;&#x2F;strong&gt; for successful delegations as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nonce&quot;&gt;Nonce&lt;&#x2F;h4&gt;
&lt;p&gt;Record &lt;strong&gt;post‑transaction nonces&lt;&#x2F;strong&gt; for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EOA senders.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts that performed a successful &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Deployed contracts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorities.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;edge-cases-normative&quot;&gt;Edge Cases (Normative)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;COINBASE &#x2F; Fee Recipient:&lt;&#x2F;strong&gt; The COINBASE address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included if it experiences any state change. It &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included for blocks with no transactions, provided there are no other state changes (e.g., from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawals). If the COINBASE reward is zero, the COINBASE address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included as a &lt;em&gt;read&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Precompiled contracts:&lt;&#x2F;strong&gt; Precompiles &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included when accessed. If a precompile receives value, it is recorded with a balance change. Otherwise, it is included with empty change lists.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SENDALL:&lt;&#x2F;strong&gt; For positive-value selfdestructs, the sender and beneficiary are recorded with a balance change.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;SELFDESTRUCT (in-transaction):&lt;&#x2F;strong&gt; Accounts destroyed within a transaction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included in &lt;code&gt;AccountChanges&lt;&#x2F;code&gt; without nonce or code changes. However, if the account had a positive balance pre-transaction, the balance change to zero &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be recorded. Storage keys within the self-destructed contracts that were modified or read &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included as a &lt;code&gt;storage_reads&lt;&#x2F;code&gt; entry.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Accessed but unchanged:&lt;&#x2F;strong&gt; Include the address with empty changes (e.g., targets of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, etc.).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Zero‑value transfers &#x2F; Unchanged balance in transaction:&lt;&#x2F;strong&gt; Include the address; omit from &lt;code&gt;balance_changes&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas refunds:&lt;&#x2F;strong&gt; Record the &lt;strong&gt;final&lt;&#x2F;strong&gt; balance of the sender after each transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block rewards:&lt;&#x2F;strong&gt; Record the &lt;strong&gt;final&lt;&#x2F;strong&gt; balance of the fee recipient after each transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Exceptional halts:&lt;&#x2F;strong&gt; Record the &lt;strong&gt;final&lt;&#x2F;strong&gt; nonce and balance of the sender, and the &lt;strong&gt;final&lt;&#x2F;strong&gt; balance of the fee recipient after each transaction. State changes from the reverted call are discarded, but all accessed addresses &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included. If no changes remain, addresses are included with empty lists; if storage was read, the corresponding keys &lt;strong&gt;MUST&lt;&#x2F;strong&gt; appear in &lt;code&gt;storage_reads&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Pre‑execution system contract calls:&lt;&#x2F;strong&gt; All state changes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use &lt;code&gt;block_access_index = 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Post‑execution system contract calls:&lt;&#x2F;strong&gt; All state changes &lt;strong&gt;MUST&lt;&#x2F;strong&gt; use &lt;code&gt;block_access_index = len(transactions) + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP-7702 Delegations:&lt;&#x2F;strong&gt; The authority address &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included with nonce and code changes after any successful delegation set, update, or clear. If authorization fails after the authority address has been loaded and added to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;), it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; still be included with an empty change set; if authorization fails before the authority is loaded, it &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included. The delegation target &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be included during delegation creation or modification and MUST only be included once it is actually loaded as an execution target (e.g., via &lt;code&gt;CALL&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; under authority execution).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑4895 (Consensus layer withdrawals):&lt;&#x2F;strong&gt; Recipients are recorded with their final balance after the withdrawal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑2935 (block hash):&lt;&#x2F;strong&gt; Record system contract storage diffs of the &lt;strong&gt;single&lt;&#x2F;strong&gt; updated storage slot in the ring buffer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑4788 (beacon root):&lt;&#x2F;strong&gt; Record system contract storage diffs of the &lt;strong&gt;two&lt;&#x2F;strong&gt; updated storage slots in the ring buffer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑7002 (withdrawals):&lt;&#x2F;strong&gt; Record system contract storage diffs of storage slots &lt;strong&gt;0–3&lt;&#x2F;strong&gt; (4 slots) after the dequeuing call.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP‑7251 (consolidations):&lt;&#x2F;strong&gt; Record system contract storage diffs of storage slots &lt;strong&gt;0–3&lt;&#x2F;strong&gt; (4 slots) after the dequeuing call.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;The Engine API is extended with new structures and methods to support block-level access lists:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;ExecutionPayloadV4&lt;&#x2F;strong&gt; extends ExecutionPayloadV3 with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blockAccessList&lt;&#x2F;code&gt;: RLP-encoded block access list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;engine_newPayloadV5&lt;&#x2F;strong&gt; validates execution payloads:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Accepts &lt;code&gt;ExecutionPayloadV4&lt;&#x2F;code&gt; structure&lt;&#x2F;li&gt;
&lt;li&gt;Validates that computed access list matches provided &lt;code&gt;blockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Returns &lt;code&gt;INVALID&lt;&#x2F;code&gt; if access list is malformed or doesn&#x27;t match&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;engine_getPayloadV6&lt;&#x2F;strong&gt; builds execution payloads:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns &lt;code&gt;ExecutionPayloadV4&lt;&#x2F;code&gt; structure&lt;&#x2F;li&gt;
&lt;li&gt;Collects all account accesses and state changes during transaction execution&lt;&#x2F;li&gt;
&lt;li&gt;Populates &lt;code&gt;blockAccessList&lt;&#x2F;code&gt; field with RLP-encoded access list&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Block processing flow:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When processing a block:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The EL receives the BAL in the ExecutionPayload&lt;&#x2F;li&gt;
&lt;li&gt;The EL computes &lt;code&gt;block_access_list_hash = keccak256(blockAccessList)&lt;&#x2F;code&gt; and includes it in the block header&lt;&#x2F;li&gt;
&lt;li&gt;The EL executes the block and generates the actual BAL&lt;&#x2F;li&gt;
&lt;li&gt;If the generated BAL doesn&#x27;t match the provided BAL, the block is invalid (the hash in the header would be wrong)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The execution layer provides the RLP-encoded &lt;code&gt;blockAccessList&lt;&#x2F;code&gt; to the consensus layer via the Engine API. The consensus layer then computes the SSZ &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; for storage in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Retrieval methods&lt;&#x2F;strong&gt; for historical BALs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;engine_getPayloadBodiesByHashV2&lt;&#x2F;code&gt;: Returns &lt;code&gt;ExecutionPayloadBodyV2&lt;&#x2F;code&gt; objects containing transactions, withdrawals, and &lt;code&gt;blockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;engine_getPayloadBodiesByRangeV2&lt;&#x2F;code&gt;: Returns &lt;code&gt;ExecutionPayloadBodyV2&lt;&#x2F;code&gt; objects containing transactions, withdrawals, and &lt;code&gt;blockAccessList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;blockAccessList&lt;&#x2F;code&gt; field contains the RLP-encoded BAL or &lt;code&gt;null&lt;&#x2F;code&gt; for pre-Amsterdam blocks or when data has been pruned.&lt;&#x2F;p&gt;
&lt;p&gt;The EL MUST retain BALs for at least the duration of the weak subjectivity period (&lt;code&gt;=3533 epochs&lt;&#x2F;code&gt;) to support synchronization with re-execution after being offline for less than the WSP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-transition-function&quot;&gt;State Transition Function&lt;&#x2F;h3&gt;
&lt;p&gt;The state transition function must validate that the provided BAL matches the actual state accesses:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1. Compute hash from received BAL and set in header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_access_list_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2. Execute block and collect actual accesses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    actual_bal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execute_and_collect_accesses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3. Verify actual execution matches provided BAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If this fails, the block is invalid (the hash in the header would be wrong)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;actual_bal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blockAccessList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute_and_collect_accesses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Execute block and collect all state accesses into BAL format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accesses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-execution system contracts (block_access_index = 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    track_system_contracts_pre&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block_access_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute transactions (block_access_index = 1..n)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        track_state_changes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; block_access_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Withdrawals and post-execution (block_access_index = len(txs) + 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    post_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; withdrawal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        apply_withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        track_balance_change&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; post_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    track_system_contracts_post&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; post_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Convert to BAL format and sort&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; build_bal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accesses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; track_state_changes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_access_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Track all state changes from a transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_touched_addresses&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot -&amp;gt; [(index, value)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_reads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;                &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track storage changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_storage_writes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track reads (slots accessed but not written)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; get_storage_reads&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_reads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track balance, nonce, code changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; balance_changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; nonce_changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; code_changed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_access_index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; build_bal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;accesses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Convert collected accesses to BAL format&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;accesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;keys&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sort addresses lexicographically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; accesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Format storage changes: [slot, [[index, value], ...]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        storage_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;changes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                          for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_writes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account entry: [address, storage_changes, reads, balance_changes, nonce_changes, code_changes]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            storage_changes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;storage_reads&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;balance_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;nonce_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sorted&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code_changes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The BAL MUST be complete and accurate. Missing or spurious entries invalidate the block. Spurious entries MAY be detected by validating BAL indices, which MUST never be higher than &lt;code&gt;len(transactions) + 1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MAY invalidate immediately if any transaction exceeds declared state.&lt;&#x2F;p&gt;
&lt;p&gt;Clients MUST store BALs separately from blocks and make them available via the engine API.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;concrete-example&quot;&gt;Concrete Example&lt;&#x2F;h3&gt;
&lt;p&gt;Example block:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Pre-execution:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-2935: Store parent hash at block hash contract (&lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7002: Omitted for simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Transactions:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Alice (0xaaaa...) sends 1 ETH to Bob (0xbbbb...), checks balance of 0x2222...&lt;&#x2F;li&gt;
&lt;li&gt;Charlie (0xcccc...) calls factory (0xffff...) deploying contract at 0xdddd...&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;Post-execution:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Withdrawal of 100 ETH to Eve (0xabcd...)&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7002 and EIP-7251 omitted for simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: Pre-execution system contract uses block_access_index = 0. Post-execution withdrawal uses block_access_index = 3 (len(transactions) + 1)&lt;&#x2F;p&gt;
&lt;p&gt;Resulting BAL (RLP structure):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Addresses are sorted lexicographically&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0x0000F90827F1C53a10cb7A02335B175320002935 (Block hash contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            [&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x0f&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xa0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot, [[block_access_index, parent_hash]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0x2222... (Address checked by Alice)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2222&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes (no change, just checked)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xaaaa... (Alice - sender tx 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;aaaa&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;29a241a&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: [[block_access_index, post_balance]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes: [[block_access_index, new_nonce]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xabcd... (Eve - withdrawal recipient)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;abcd&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;5f5e100&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: 100 ETH withdrawal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xbbbb... (Bob - recipient tx 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;bbbb&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;b9aca00&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: +1 ETH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xcccc... (Charlie - sender tx 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;cccc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;bc16d67&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: after gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xdddd... (Deployed contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;dddd&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes: new contract nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x80&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x60&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x40&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes: deployed bytecode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xeeee... (COINBASE)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;eeee&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;05f5e1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt;0bebc2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes: after tx fees&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; AccountChanges for 0xffff... (Factory contract)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ffff&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            [&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xdd&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\xdd&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; slot 1, deployed address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; storage_reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; balance_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce_changes: after CREATE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; code_changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;RLP-encoded and compressed: ~400-500 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;bal-design-choice&quot;&gt;BAL Design Choice&lt;&#x2F;h3&gt;
&lt;p&gt;This design variant was chosen for several key reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Size vs parallelization&lt;&#x2F;strong&gt;: BALs include all accessed addresses (even unchanged) for complete parallel IO and execution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Storage values for writes&lt;&#x2F;strong&gt;: Post-execution values enable state reconstruction during sync without individual proofs against state root.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Overhead analysis&lt;&#x2F;strong&gt;: Historical data shows ~70 KiB average BAL size.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transaction independence&lt;&#x2F;strong&gt;: 60-80% of transactions access disjoint storage slots, enabling effective parallelization. The remaining 20-40% can be parallelized by having post-transaction state diffs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;RLP encoding&lt;&#x2F;strong&gt;: Native Ethereum encoding format, maintains compatibility with existing infrastructure.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;bal-size-considerations-60m-block-gas-limit&quot;&gt;BAL Size Considerations (60m block gas limit)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Average BAL size&lt;&#x2F;strong&gt;: ~72.4 KiB (compressed)&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage writes: ~29.2 KiB (40.3%)&lt;&#x2F;li&gt;
&lt;li&gt;Storage reads: ~18.7 KiB (25.8%)&lt;&#x2F;li&gt;
&lt;li&gt;Balance diffs: ~6.7 KiB (9.2%)&lt;&#x2F;li&gt;
&lt;li&gt;Nonce diffs: ~1.1 KiB (1.5%)&lt;&#x2F;li&gt;
&lt;li&gt;Code diffs: ~1.2 KiB (1.6%)&lt;&#x2F;li&gt;
&lt;li&gt;Account addresses (with diffs): ~7.7 KiB (10.7%)&lt;&#x2F;li&gt;
&lt;li&gt;Touched-only addresses: ~3.5 KiB (4.8%)&lt;&#x2F;li&gt;
&lt;li&gt;RLP encoding overhead: ~4.4 KiB (6.1%)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Smaller than current worst-case calldata blocks.&lt;&#x2F;p&gt;
&lt;p&gt;An empirical analysis has been done &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;assets&#x2F;bal_size_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;. An updated analysis for a 60 million block gas limit can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;assets&#x2F;bal_size_analysis_60m&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;asynchronous-validation&quot;&gt;Asynchronous Validation&lt;&#x2F;h3&gt;
&lt;p&gt;BAL verification occurs alongside parallel IO and EVM operations without delaying block processing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal requires changes to the block structure and engine API that are not backwards compatible and require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation-overhead&quot;&gt;Validation Overhead&lt;&#x2F;h3&gt;
&lt;p&gt;Validating access lists and balance diffs adds validation overhead but is essential to prevent acceptance of invalid blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-size&quot;&gt;Block Size&lt;&#x2F;h3&gt;
&lt;p&gt;Increased block size impacts propagation but overhead (~70 KiB average) is reasonable for performance gains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Linear, Page-Based Memory Costing</title>
        <published>2025-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7923/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-linearize-memory-costing/23290" />
        

        <id>https://wg-eips.ritovision.com/7923/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7923"
            label="EIP-7923" />
        

        
        

        
        <summary type="html">Linearize Memory Costing and replace the current quadratic formula with a page-based cost model.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7923/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP replaces the quadratic memory model in the EVM with a linear, page-based costing model. Memory is virtually addressable. Page allocation is included in the cost model. After applying this EIP, memory limits are invariant to the state of the message call stack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM currently uses a quadratic pricing model for its memory. This was originally put in place to defend against DoS attacks. However, the memory model has several drawbacks.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is anachronistic. Even at a gas limit of 30 million gas, users can only use 3MB of memory in a message call (and that burns all gas). Since the quadratic term for memory expansion starts kicking in at 724 bytes, users use much less memory in practice. To use even 64KB of memory -- the amount of memory available to a PC from the early 80&#x27;s -- costs 14336 gas!&lt;&#x2F;li&gt;
&lt;li&gt;The quadratic model makes it difficult to reason about how much memory a transaction can allocate. It requires solving an optimization problem which involves computing how many message calls are available to recurse into based on the call stack limit (and, post &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, the 63&#x2F;64ths rule), and then maximizing the memory used per message call.&lt;&#x2F;li&gt;
&lt;li&gt;The quadratic model makes it impossible for high-level smart contracts languages to get the benefits of virtual memory. Most modern programming languages maintain what is known as the &quot;heap&quot; and the &quot;call stack&quot;. The heap is used to allocate objects which live past the lifetime of their current function frame, whereas the call stack is used to allocate objects which live in the current function frames. Importantly, the call stack starts at the top of memory and grows down, while the heap starts at the bottom of memory and grows up, thus the language implementation does not need to worry about the two regions of memory interfering with each other. This is a feature which is enabled by virtual, paged memory, which has been present in operating systems since the early 90&#x27;s. However, smart contract languages like Vyper and Solidity are not able to implement this, leading to inefficiencies in their memory models.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP proposes a linear costing model which more closely reflects the hardware of today, which is hierarchical (&quot;hot&quot; memory is much faster to access than &quot;cold&quot; memory), and virtually addressed (memory does not need to be allocated contiguously, but is rather served &quot;on-demand&quot; by the operating system).&lt;&#x2F;p&gt;
&lt;p&gt;First, some preliminaries. A page is 4096 bytes on most architectures. Given a memory address, its page is simple to compute by masking out the rightmost 12 bits.&lt;&#x2F;p&gt;
&lt;p&gt;There are two factors which contribute to &quot;cold&quot; memory (i.e. not-recently-used) being slower: CPU cache and TLB (Translation Lookaside Buffer) cache. The CPU cache is a least-recently-used memory cache, which is significantly faster than fetching all the way from RAM. The TLB is usually some hash table which maps virtual pages (used by the user) to physical pages in RAM. &quot;Thrashing&quot;, or accessing a lot of different memory addresses, does two things: it pushes memory out of the hot cache and into cold memory, and it pushes pages out of the TLB cache. For this reason, it is worth limiting the amount of memory that is available to a transaction to memory which can be held in the hot set.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP uses a virtual addressing scheme so that memory pages are not allocated until they are actually accessed.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, the data structures used for costing memory do not need to be part of the memory implementation itself, which suggests an elegant implementation using the POSIX &lt;code&gt;mmap&lt;&#x2F;code&gt; syscall (or, its counterpart on Windows, &lt;code&gt;VirtualAlloc&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The implementation can be approached in two ways. The first way is to implement the virtual addressing &quot;manually&quot;. This is intended for systems without &lt;code&gt;mmap&lt;&#x2F;code&gt; or a virtual addressing capability. The implementation needs to maintain a map from &lt;code&gt;map[page_id -&amp;gt; char[4096]]&lt;&#x2F;code&gt;, where &lt;code&gt;page_id&lt;&#x2F;code&gt; is an integer, computed as &lt;code&gt;memory_address &amp;gt;&amp;gt; 12&lt;&#x2F;code&gt;. (On reads or writes which cross page boundaries, the implementation needs to load both pages and combine the result of the read or write across both pages).&lt;&#x2F;p&gt;
&lt;p&gt;The other implementation is easier, for systems with &lt;code&gt;mmap&lt;&#x2F;code&gt; or a similar facility. To hold the actual data of the memory, the implementation &lt;code&gt;mmap&lt;&#x2F;code&gt;s a &lt;code&gt;2**32&lt;&#x2F;code&gt; byte region of memory. Then, memory operations can be implemented simply as reads or writes against this buffer. (With an anonymous &lt;code&gt;mmap&lt;&#x2F;code&gt;, the operating system will not allocate the entire buffer up-front, rather, it will allocate pages &quot;on demand&quot;, as they are touched). The &lt;code&gt;pages&lt;&#x2F;code&gt; map is still necessary, but it doesn&#x27;t hold any data, it is just to track which pages have been allocated, for pricing purposes. In this implementation, there are two data structures: &lt;code&gt;memory char[2**32]&lt;&#x2F;code&gt; and &lt;code&gt;allocated_pages set[page_id]&lt;&#x2F;code&gt;. The &lt;code&gt;memory&lt;&#x2F;code&gt; data structure is only used for memory reads and writes. The &lt;code&gt;allocated_pages&lt;&#x2F;code&gt; is only used for gas costing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Consider the following constants:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ALLOCATE_PAGE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAXIMUM_MEMORY_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The memory costing algorithm is changed as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;For each page touched by an instruction, charge &lt;code&gt;ALLOCATE_PAGE_COST&lt;&#x2F;code&gt; gas if it has not been touched before in this message call, except for page 0 which is free.&lt;&#x2F;li&gt;
&lt;li&gt;The base gas cost for all memory instructions, e.g. &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE&lt;&#x2F;code&gt;, remains the same, at 3.&lt;&#x2F;li&gt;
&lt;li&gt;The linear and quadratic terms in the memory expansion cost are removed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The behavior of &lt;code&gt;msize&lt;&#x2F;code&gt; remains the same. It returns the maximum byte touched by any memory instruction, rounded up by 32.&lt;&#x2F;p&gt;
&lt;p&gt;Memory addresses are restricted to 32-bits. If an address is larger than &lt;code&gt;2**32 - 1&lt;&#x2F;code&gt;, an exceptional halt should be raised.&lt;&#x2F;p&gt;
&lt;p&gt;A transaction-global memory limit is imposed. If the number of pages allocated in a transaction exceeds &lt;code&gt;MAXIMUM_MEMORY_SIZE &#x2F;&#x2F; PAGE_SIZE&lt;&#x2F;code&gt; (i.e., 16384), an exceptional halt should be raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benchmarks were performed on a 2019-era CPU, with the ability to &lt;code&gt;keccak256&lt;&#x2F;code&gt; around 256MB&#x2F;s, giving it a gas-to-ns ratio of 20 ns per 1 gas (given that &lt;code&gt;keccak256&lt;&#x2F;code&gt; costs 6 gas per 32 bytes). The following benchmarks were performed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Time to allocate a fresh page: 1-2us&lt;&#x2F;li&gt;
&lt;li&gt;Time to randomly read a byte from a 2MB range: 1.8ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to randomly read a byte from a 32MB range: 7ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to randomly read a byte from a 4GB range: 40ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to update a hashmap with 512 items: 8ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to update a hashmap with 8192 items: 9ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to update a hashmap with 5mm items: 108ns&lt;&#x2F;li&gt;
&lt;li&gt;Time to execute the &lt;code&gt;mmap&lt;&#x2F;code&gt; syscall: 230ns&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These suggest the following prices:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;100 gas to allocate a page&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the cost to execute &lt;code&gt;mmap&lt;&#x2F;code&gt; (~11 gas) is already well-paid for by the base cost of the CALL series of instructions (100 gas). For the same reason, page 0 is free, since the CALL overhead already pays for the initial page allocation. This also improves backwards compatibility, since it keeps the cost for any access within the first page either the same as or lower than current pricing.&lt;&#x2F;p&gt;
&lt;p&gt;There is a desire among client implementations to be able to enforce global limits separately from the gas limit due to DoS reasons. For example, RPC providers may be designed to allow many concurrent &lt;code&gt;eth_call&lt;&#x2F;code&gt; computations with a much higher gas limit than on mainnet. Not implicitly tying the memory limit to the gas limit results in one less vector for misconfiguration. That is not to say that in the future, a clean formula cannot be created which allows the memory limit to scale with future hardware improvements (e.g., proportional to the sqrt of the gas limit), but to limit the scope of things that need to be reasoned about for this EIP, the hard limit is introduced.&lt;&#x2F;p&gt;
&lt;p&gt;The hard limit is specified as a transaction-global limit rather than a message-call limit. That is, a reasonable alternative could be to limit the number of pages that can be allocated in a given message call, e.g., to 2MB, but it doesn&#x27;t significantly improve implementation complexity.&lt;&#x2F;p&gt;
&lt;p&gt;On keeping the semantics of &lt;code&gt;MSIZE&lt;&#x2F;code&gt; the same:
With users expected to use the full address space instead of growing it linearly, the rationale for keeping &lt;code&gt;MSIZE&lt;&#x2F;code&gt; semantics the same is to avoid breaking backwards compatibility with existing contracts which expect it to grow linearly. New contracts taking advantage of the new virtual addressing scheme should not rely on &lt;code&gt;MSIZE&lt;&#x2F;code&gt; for memory allocation.&lt;&#x2F;p&gt;
&lt;p&gt;A hard limit of &lt;code&gt;2**32&lt;&#x2F;code&gt; bytes was imposed on the addressing. This makes it simpler for modern 64-bit computers to allocate that much virtual address space, given that clients run on a diverse set of operating systems and architectures which have different virtual memory limits per process. This could be revisited in the future, for instance if gas limits or client memory sizes substantially increase.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Addressed in Security Considerations section. No backwards compatibility is broken, although some contracts that previously ran out of gas may now successfully complete.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A ~60-line reference implementation is provided below. It is implemented as a patch against the &lt;code&gt;py-evm&lt;&#x2F;code&gt; codebase at commit ethereum&#x2F;py-evm@fec63b8c4b9dad9fcb1022c48c863bdd584820c6. (This is a reference implementation, it does not, for example, contain fork choice rules).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;computation.py b&#x2F;eth&#x2F;vm&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index bf34fbee..db85aee7 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -454,34 +454,40&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class BaseComputation(ComputationAPI, Configurable):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_uint256(start_position, title=&amp;quot;Memory start position&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_uint256(size, title=&amp;quot;Memory size&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        before_size = ceil32(len(self._memory))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        after_size = ceil32(start_position + size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        before_cost = memory_gas_cost(before_size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        after_cost = memory_gas_cost(after_size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if self.logger.show_debug2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self.logger.debug2(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                f&amp;quot;MEMORY: size ({before_size} -&amp;gt; {after_size}) | &amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                f&amp;quot;cost ({before_cost} -&amp;gt; {after_cost})&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if size:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            if before_cost &amp;lt; after_cost:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                gas_fee = after_cost - before_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                self._gas_meter.consume_gas(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                    gas_fee,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                    reason=&amp;quot; &amp;quot;.join(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                        (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            &amp;quot;Expanding memory&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            str(before_size),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            &amp;quot;-&amp;gt;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                            str(after_size),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                    ),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._memory.extend(start_position, size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if size == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        ALLOCATE_PAGE_COST = 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        LOWER_BITS = 12  # bits ignored for page calculations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        PAGE_SIZE = 4096&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        assert 2**LOWER_BITS == PAGE_SIZE   # sanity check&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        MAXIMUM_MEMORY_SIZE = 64 * 1024 * 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        TRANSACTION_MAX_PAGES = MAXIMUM_MEMORY_SIZE &#x2F;&#x2F; PAGE_SIZE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        end_position = start_position + size - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        start_page = start_position &amp;gt;&amp;gt; LOWER_BITS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        end_page = end_position &amp;gt;&amp;gt; LOWER_BITS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        for page in range(start_page, end_page + 1):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            if page not in self._memory.pages:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                if self.transaction_context.num_pages &amp;gt;= TRANSACTION_MAX_PAGES:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                    raise VMError(&amp;quot;Out Of Memory&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                self.transaction_context.num_pages += 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                reason = f&amp;quot;Allocating page {hex(page &amp;lt;&amp;lt; LOWER_BITS)}&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                self._gas_meter.consume_gas(ALLOCATE_PAGE_COST, reason)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                self._memory.pages[page] = True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def memory_write(self, start_position: int, size: int, value: bytes) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return self._memory.write(start_position, size, value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py b&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 51666ae0..443f82b5 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;forks&#x2F;frontier&#x2F;computation.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -29,6 +29,7&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; from eth.exceptions import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     InsufficientFunds,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     OutOfGas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     StackDepthLimit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    VMError,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; from eth.vm.computation import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     BaseComputation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -87,12 +88,21&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class FrontierComputation(BaseComputation):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         state.touch_account(message.storage_address)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        computation = cls.apply_computation(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            state,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            message,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            transaction_context,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            parent_computation=parent_computation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        # implement transaction-global memory limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        num_pages_anchor = transaction_context.num_pages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        try:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            computation = cls.apply_computation(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                state,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                message,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                transaction_context,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;                parent_computation=parent_computation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        finally:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            # &amp;quot;deallocate&amp;quot; all the pages allocated in the child computation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            # sanity check an invariant:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            allocated_pages = len(computation._memory.pages)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            assert transaction_context.num_pages == num_pages_anchor + allocated pages&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            transaction_context.num_pages = num_pages_anchor&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if computation.is_error:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             state.revert(snapshot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py b&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 806dbd8b..247b3c74 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;logic&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -43,7 +43,7&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; def mload(computation: ComputationAPI) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; def msize(computation: ComputationAPI) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    computation.stack_push_int(len(computation._memory))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    computation.stack_push_int(computation._memory.msize)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; def mcopy(computation: ComputationAPI) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;memory.py b&#x2F;eth&#x2F;vm&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 2ccfd090..9002b559 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;memory.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -1,8 +1,11&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; import logging&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;import mmap&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; from eth._utils.numeric import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     ceil32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;from eth.exceptions import VMError&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; from eth.abc import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     MemoryAPI,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -13,52 +16,48&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; from eth.validation import (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     validate_uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; class Memory(MemoryAPI):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    __slots__ = [&amp;quot;_bytes&amp;quot;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    __slots__ = (&amp;quot;pages&amp;quot;, &amp;quot;msize&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     logger = logging.getLogger(&amp;quot;eth.vm.memory.Memory&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def __init__(self) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        self._bytes = bytearray()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.memview = mmap.mmap(-1, 2**32, flags=mmap.MAP_PRIVATE | mmap.MAP_ANONYMOUS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.pages = {0: True}  # page 0 is free (per spec)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.msize = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def extend(self, start_position: int, size: int) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if size == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        new_size = ceil32(start_position + size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if new_size &amp;lt;= len(self):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if start_position + size &amp;gt; self.msize:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            self.msize = ceil32(start_position + size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    def write(self, start_position: int, size: int, value: bytes) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if size == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        size_to_extend = new_size - len(self)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        try:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._bytes.extend(bytearray(size_to_extend))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        except BufferError:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # we can&amp;#39;t extend the buffer (which might involve relocating it) if a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # memoryview (which stores a pointer into the buffer) has been created by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # read() and not released. Callers of read() will never try to write to the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # buffer so we&amp;#39;re not missing anything by making a new buffer and forgetting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # about the old one. We&amp;#39;re keeping too much memory around but this is still&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            # a net savings over having read() return a new bytes() object every time.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._bytes = self._bytes + bytearray(size_to_extend)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    def __len__(self) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        return len(self._bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        if start_position + size &amp;gt;= 2**32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;            raise VMError(&amp;quot;Non 32-bit address&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;    def write(self, start_position: int, size: int, value: bytes) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        if size:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_uint256(start_position)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_uint256(size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_is_bytes(value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_length(value, length=size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            validate_lte(start_position + size, maximum=len(self))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_uint256(start_position)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_uint256(size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_is_bytes(value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        validate_length(value, length=size)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        end_position = start_position + size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;            self._bytes[start_position : start_position + len(value)] = value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.memview[start_position : end_position] = value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;    # unused&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def read(self, start_position: int, size: int) -&amp;gt; memoryview:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        return memoryview(self._bytes)[start_position : start_position + size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        return memoryview(self.memview)[start_position : start_position + size]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def read_bytes(self, start_position: int, size: int) -&amp;gt; bytes:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        return bytes(self._bytes[start_position : start_position + size])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        return bytes(self.memview[start_position : start_position + size])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def copy(self, destination: int, source: int, length: int) -&amp;gt; None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if length == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -69,5 +68,5&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class Memory(MemoryAPI):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_uint256(length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         validate_lte(max(destination, source) + length, maximum=len(self))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt;        buf = memoryview(self._bytes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        buf = memoryview(self.memview)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         buf[destination : destination + length] = buf[source : source + length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header&quot;&gt;diff --git a&#x2F;eth&#x2F;vm&#x2F;transaction_context.py b&#x2F;eth&#x2F;vm&#x2F;transaction_context.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;index 79b570e9..5943f897 100644&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt;---&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-from-file&quot;&gt; a&#x2F;eth&#x2F;vm&#x2F;transaction_context.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt;+++&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-header z-to-file&quot;&gt; b&#x2F;eth&#x2F;vm&#x2F;transaction_context.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt;@@&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; -36,6 +36,9&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-diff z-range&quot;&gt; @@&lt;&#x2F;span&gt;&lt;span&gt; class BaseTransactionContext(TransactionContextAPI):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         # post-cancun&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         self._blob_versioned_hashes = blob_versioned_hashes or []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        # eip-7923&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt;        self.num_pages = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     def get_next_log_counter(self) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return next(self._log_counter)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are two primary security considerations regarding this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;One, does it break existing contracts? That is, do existing contracts depend on memory being restricted?&lt;&#x2F;p&gt;
&lt;p&gt;Outside of gas costing, existing contracts may simply execute to completion rather than running out of gas.&lt;&#x2F;p&gt;
&lt;p&gt;Two, does this enable memory-based DoS attacks against clients?&lt;&#x2F;p&gt;
&lt;p&gt;This requires a maximum-memory usage analysis. Based on a gas limit today of 30mm gas, recursively calling a contract that allocates 256KB of memory in each call stack can allocate 54MB of total memory, which is not substantially different than the 64MB limit proposed in this EIP. Note that the transaction-global memory limit proposed in this EIP provides a useful invariant, which is that future changes to call stack limits will not affect the total amount of memory that can be allocated in a given transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Skip `JUMPDEST` immediate argument check</title>
        <published>2025-03-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7921/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7921-skip-jumpdest-immediate-argument-check/23279" />
        

        <id>https://wg-eips.ritovision.com/7921/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7921"
            label="EIP-7921" />
        

        
        

        
        <summary type="html">All `JUMPDEST` bytes become valid `JUMPDEST`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7921/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Allow &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; to arrive at any byte matching &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (&lt;code&gt;0x5b&lt;&#x2F;code&gt;), even if that byte is an immediate argument.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Immediate arguments are opcode parameters supplied within the code rather than the stack.
Currently determining the validity of a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; requires determining which bytes are immediate arguments to other opcodes, such as &lt;code&gt;PUSH1&lt;&#x2F;code&gt;.
This presents several problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Codesize is a linear DoS vector because code must be preprocessed to determine &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; validity.&lt;&#x2F;li&gt;
&lt;li&gt;New opcodes with immediate arguments cannot be safely adopted.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODECOPY&lt;&#x2F;code&gt; data spans can invalidate subsequent &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The rationale for this &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; validity check is to prevent unintended code execution.
However, almost all &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; target constant destinations.
Removing this check allows larger programs and better opcodes.
Therefore, the cost of this safety check outweighs the benefit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;When activated, all &lt;code&gt;0x5b&lt;&#x2F;code&gt; bytes are valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; for &lt;code&gt;JUMPI&lt;&#x2F;code&gt; and &lt;code&gt;JUMP&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Removing the check solves several problems while reducing EVM complexity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Code previously only had one interpretation for disassembly.
With this change, a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; located inside an immediate argument can cause multiple disassembly interpretations.
Usually the interpretations will converge after a few bytes but the length of such a dispute can be unbounded.
&lt;code&gt;CODECOPY&lt;&#x2F;code&gt; data has always been difficult to identify.
It is recommended that disassemblers provide all possible interpretations in their output in order to reveal possible underhanded functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Current contracts performing dynamic jumps may gain new unintended functionality if it is possible to jump to an immediate argument containing &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;.
It is expected that very few contracts will become vulnerable in this way.
Most smart contract programming languages do not even allow dynamic jumps, and of those that do, few will have &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; in an accessible immediate argument.
Therefore it is expected that few contracts will become vulnerable, and for many of them the newly possible codepaths will contain invalid opcodes.
A static analysis tool should be developed and made publicly available to test if a contract might become vulnerable, and the program should be run for all current contracts in order to notify projects about potential security issues.
Affected programs will have ample time to migrate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Pragmatic stack manipulation tools</title>
        <published>2025-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7912/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7912-pragmatic-expansion-of-stack-manipulation-tools/23826" />
        

        <id>https://wg-eips.ritovision.com/7912/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7912"
            label="EIP-7912" />
        

        
        

        
        <summary type="html">Add additional SWAP and DUP operations for deeper stack access</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7912/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add &lt;code&gt;SWAP17&lt;&#x2F;code&gt;-&lt;code&gt;SWAP24&lt;&#x2F;code&gt;, &lt;code&gt;DUP17&lt;&#x2F;code&gt; - &lt;code&gt;DUP24&lt;&#x2F;code&gt;, &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt;, and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;
instructions. The arbitrary depth operations must be preceded by &lt;code&gt;PUSH1&lt;&#x2F;code&gt;
instructions defining operands.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the nature of some compilers, deeper stack access is a desirable VM
feature. Previous attempts either required code versioning, like the EVM Object
Format (EOF), or caused the behavior of some deployed contracts to change, due
to the interpretation of new immediates.&lt;&#x2F;p&gt;
&lt;p&gt;This is a pragmatic approach to introducing the desired functionality. It reuses
instruction semantics that have been historically agreed on, instead of new,
complex encodings and containers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Let &lt;code&gt;top - N&lt;&#x2F;code&gt; be the &lt;code&gt;N&lt;&#x2F;code&gt;th most recently pushed value on the stack, and &lt;code&gt;top - 0&lt;&#x2F;code&gt; be the most recent.&lt;&#x2F;p&gt;
&lt;p&gt;If any of the following instructions reference a stack element beyond the
current length of the stack, causing a stack underflow, abort with an
exceptional halt.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constant-swapxx-and-dupxx&quot;&gt;Constant &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; and &lt;code&gt;DUPXX&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SWAP17&lt;&#x2F;code&gt;, &lt;code&gt;SWAP18&lt;&#x2F;code&gt;, ..., &lt;code&gt;SWAP24&lt;&#x2F;code&gt;: &lt;code&gt;0xb0&lt;&#x2F;code&gt;, &lt;code&gt;0xb1&lt;&#x2F;code&gt;, ..., &lt;code&gt;0xb7&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUP17&lt;&#x2F;code&gt;, &lt;code&gt;DUP18&lt;&#x2F;code&gt;, ..., &lt;code&gt;DUP24&lt;&#x2F;code&gt;: &lt;code&gt;0xb8&lt;&#x2F;code&gt;, &lt;code&gt;0xba&lt;&#x2F;code&gt;, ..., &lt;code&gt;0xbf&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Let &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; and &lt;code&gt;DUPXX&lt;&#x2F;code&gt; refer to the static instructions defined above. &lt;code&gt;XX&lt;&#x2F;code&gt; is
defined as the stack element they are referencing.&lt;&#x2F;p&gt;
&lt;p&gt;The operation &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; swaps the top element with the &lt;code&gt;top-XX&lt;&#x2F;code&gt; element. The
operation &lt;code&gt;DUPXX&lt;&#x2F;code&gt; duplicates the &lt;code&gt;top-XX&lt;&#x2F;code&gt; element and pushes the copy to the top
of the stack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;swapn-and-dupn&quot;&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt; and &lt;code&gt;DUPN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;: &lt;code&gt;0xc0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;: &lt;code&gt;0xc1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both operations take a single argument from the stack, &lt;code&gt;N&lt;&#x2F;code&gt;. This argument must
be provided by a &lt;code&gt;PUSH1&lt;&#x2F;code&gt; operation immediately preceding the &lt;code&gt;SWAPN&lt;&#x2F;code&gt; and &lt;code&gt;DUPN&lt;&#x2F;code&gt;
instructions. Failure to follow this calling convention will result in an
out-of-gas error. If &lt;code&gt;N&lt;&#x2F;code&gt; is zero, fail with out-of-gas error.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt; pops &lt;code&gt;N&lt;&#x2F;code&gt; from the stack and swaps the new top stack element with the
&lt;code&gt;top-N&lt;&#x2F;code&gt; stack element.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt; pops &lt;code&gt;N&lt;&#x2F;code&gt; from the stack and push on a copy of the &lt;code&gt;top-N-1&lt;&#x2F;code&gt; stack element.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following new instruction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;: &lt;code&gt;0xc2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; instruction takes a single argument from the stack &lt;code&gt;X&lt;&#x2F;code&gt; and
deconstructs it into two operands, &lt;code&gt;N&lt;&#x2F;code&gt; and &lt;code&gt;M&lt;&#x2F;code&gt;. &lt;code&gt;N&lt;&#x2F;code&gt; is &lt;code&gt;X &amp;gt;&amp;gt; 4&lt;&#x2F;code&gt; and &lt;code&gt;M&lt;&#x2F;code&gt; is &lt;code&gt;X &amp;amp; 0x0F&lt;&#x2F;code&gt;. The argument &lt;code&gt;X&lt;&#x2F;code&gt; must be provided by a &lt;code&gt;PUSH2&lt;&#x2F;code&gt; operation immediately
preceding the &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; instruction. Failure to follow this calling convention
will result in an out-of-gas error. If either &lt;code&gt;N&lt;&#x2F;code&gt; or &lt;code&gt;M&lt;&#x2F;code&gt; are zero, fail with
out-of-gas error.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; pops &lt;code&gt;X&lt;&#x2F;code&gt; from the stack and will swap the stack element at index
&lt;code&gt;N-1&lt;&#x2F;code&gt; with the stack element at &lt;code&gt;M-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;All operations cost &lt;code&gt;3&lt;&#x2F;code&gt; gas. Preceding push operations are charged separately
according to the gas schedule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constant-and-dynamic-swaps-and-dups&quot;&gt;Constant and Dynamic &lt;code&gt;SWAP&lt;&#x2F;code&gt;s and &lt;code&gt;DUP&lt;&#x2F;code&gt;s&lt;&#x2F;h3&gt;
&lt;p&gt;The main trade off between using the constant &lt;code&gt;SWAPXX&lt;&#x2F;code&gt; or &lt;code&gt;DUPXX&lt;&#x2F;code&gt; instructions
versus the dynamic &lt;code&gt;SWAPN&lt;&#x2F;code&gt; or &lt;code&gt;DUPN&lt;&#x2F;code&gt; instructions is that the dynamic
instructions require an additional two bytes in the form of a preceding &lt;code&gt;PUSH1&lt;&#x2F;code&gt;
operation, whereas the constant versions require no additional bytes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;one-indexed-exchange&quot;&gt;One indexed &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since &lt;code&gt;SWAP1&lt;&#x2F;code&gt; and &lt;code&gt;DUP1&lt;&#x2F;code&gt; operate on the top of the stack, it seems fitting that
&lt;code&gt;EXCHANGE(1, 2)&lt;&#x2F;code&gt; operate on the &lt;code&gt;top&lt;&#x2F;code&gt; and &lt;code&gt;top-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When verifying the preceding &lt;code&gt;PUSH&lt;&#x2F;code&gt; operations, client implementers must ensure
that the preceding bytes are not part of a longer segment of push data (e.g.
&lt;code&gt;0x6301026001b0&lt;&#x2F;code&gt; should error). This can be done efficiently by checking if
&lt;code&gt;pc-2&lt;&#x2F;code&gt; is a valid jump destination. If it is, then the &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction will
have been executed as expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blob base fee bounded by execution cost</title>
        <published>2025-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7918/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-blob-base-fee-bounded-by-price-of-blob-carrying-transaction/23271" />
        

        <id>https://wg-eips.ritovision.com/7918/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7918"
            label="EIP-7918" />
        

        
        

        
        <summary type="html">Imposes that the price of GAS_PER_BLOB blob gas is greater than the price of BLOB_BASE_COST execution gas.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7918/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP assigns a reserve price &lt;code&gt;BLOB_BASE_COST * base_fee_per_gas&lt;&#x2F;code&gt; to blobs by introducing an &lt;code&gt;if&lt;&#x2F;code&gt;-clause in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt;. Specifically, when the reserve price is higher than &lt;code&gt;GAS_PER_BLOB * base_fee_per_blob_gas&lt;&#x2F;code&gt;, the function will not subtract &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; from &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt;, causing &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; to increase according to &lt;code&gt;blob_gas_used&lt;&#x2F;code&gt;, while keeping the per-block maximum increase unchanged. The proposal ensures that the blob fee market can function properly and that blob consumers pay at least a relevant fraction of the market rate for the compute they request from nodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum uses a dynamic pricing auction to set the blob base fee, lowering the fee if less gas is consumed than &lt;code&gt;target_blob_gas = GAS_PER_BLOB * blobSchedule.target&lt;&#x2F;code&gt; and raising the fee if more gas is consumed. Such an auction can function well when the blob base fee represents the price signal, allowing the mechanism to control the real price for blob consumers. However, when execution costs dominate, the price signal is lost. The blob base fee then no longer represents a significant component of the total cost facing the consumer, and the protocol can no longer rely on the blob base fee to control the equilibrium quantity of blobs consumed.&lt;&#x2F;p&gt;
&lt;p&gt;The current mechanism can therefore end up repeatedly lowering the blob base fee until it eventually settles at 1 wei. A change in the blob base fee of 10% may under such circumstances shift the total cost of utilizing blobspace by just 0.0000001%. Whenever demand picks up, over an hour of near-full blocks is required to restore a market-clearing equilibrium fee, with the mechanism intermittently resorting to a first-price auction, considered a worse UX by blob consumers. The resulting spikiness in resource consumption is suboptimal for scaling blobspace. To alleviate this, the proposal imposes a reserve price that reflects execution costs, through a simple &lt;code&gt;if&lt;&#x2F;code&gt;-clause in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reserve price also fulfills a second function. Nodes must cryptographically verify KZG &lt;code&gt;proofs&lt;&#x2F;code&gt; to ensure that associated &lt;code&gt;commitments&lt;&#x2F;code&gt; correspond to provided blobs. This process is computationally expensive. It seems desirable to ensure that blob consumers pay at least some fraction of the market rate for the compute they impose on nodes. In this context, the execution base fee reflects how in-demand nodes&#x27; compute services are at the time that blob consumers request them.&lt;&#x2F;p&gt;
&lt;p&gt;By applying the reserve price to the blob base fee, the proposal jointly ensures that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The blob base fee update mechanism can function properly, by establishing a reserve price which is significant relative to L1 execution costs of blob consumers.&lt;&#x2F;li&gt;
&lt;li&gt;Blob consumers pay at least a relevant fraction of the market rate for the compute they request from nodes, with any additional fees for data determined independently in the blob fee market.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**13&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;if&lt;&#x2F;code&gt;-clause is added to &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. The function no longer subtracts &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; when updating &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; if the price of a &lt;code&gt;blob&lt;&#x2F;code&gt; is below the price of &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; execution gas. The &lt;code&gt;blobSchedule&lt;&#x2F;code&gt; for referencing target and max blobs was introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7840&#x2F;&quot;&gt;EIP-7840&lt;&#x2F;a&gt;. The current block&#x27;s &lt;code&gt;blobSchedule&lt;&#x2F;code&gt; is used during processing. Thus, in the first block after a fork—when calculating &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; via &lt;code&gt;get_base_fee_per_blob_gas(parent)&lt;&#x2F;code&gt;—&lt;code&gt;fake_exponential()&lt;&#x2F;code&gt; must use the &lt;em&gt;new&lt;&#x2F;em&gt; &lt;code&gt;blobSchedule.baseFeeUpdateFraction&lt;&#x2F;code&gt;. Likewise, the &lt;em&gt;new&lt;&#x2F;em&gt; &lt;code&gt;blobSchedule.max&lt;&#x2F;code&gt; and &lt;code&gt;blobSchedule.target&lt;&#x2F;code&gt; must be used in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; blobSchedule&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fee-inelasticity-and-reserve-price&quot;&gt;Fee-inelasticity and reserve price&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal alleviates idiosyncrasies in the blob base fee auction. When a rollup&#x27;s costs are dominated by execution costs for the blob-carrying transactions, ZK proof verification, or priority fees, the protocol can no longer rely on the blob base fee to control the equilibrium quantity of blobs consumed. The fee update mechanism is unaware of the full price of the goods that it regulates the price for and therefore fails to converge on equilibrium in a timely manner.&lt;&#x2F;p&gt;
&lt;p&gt;We can express a simple real demand function for blobspace as&lt;&#x2F;p&gt;
&lt;p&gt;$Q(b + c).$&lt;&#x2F;p&gt;
&lt;p&gt;It maps the quantity of blobs demanded $Q$ to the blob base fee $b$ and the user&#x27;s execution costs, expressed &quot;per blob gas&quot;, $c$:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; execution_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;According to the &lt;em&gt;law of demand&lt;&#x2F;em&gt;, the lower the price $b+c$, the higher the demand. From the perspective of the blob base fee update mechanism, $c$ is fixed. If $c&amp;gt;0$, the demand curve will therefore have an &quot;inelasticity horizon&quot;, beyond which further reductions in $b$ no longer increase $Q$:&lt;&#x2F;p&gt;
&lt;p&gt;$\lim_{b \to 0} Q(b + c) = Q(c).$&lt;&#x2F;p&gt;
&lt;p&gt;In essence, the demand curve becomes a vertical line, where changes to the blob base fee $b$ no longer affect demand. Figure 1 illustrates this, with real demand curves (black to red) computed under four different execution base fees when purchasing two blobs. The hypothetical organic demand is illustrated in black. Any demand curve where execution costs are positive ($c&amp;gt;0$) eventually becomes vertical as the blob base fee falls. The protocol also uses a long-run perfectly inelastic supply curve (vertical blue line). Therefore, relatively small shifts in organic demand or the execution base fee (arrows) can lead to dramatic shifts in the equilibrium blob base fee. Importantly, the blob base fee will simply fall to the boundary of 1 wei whenever the execution cost is too high for consumers to achieve equilibrium formation at &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; Hypothetical real demand for blobspace under different execution base fees (black to red lines). When execution cost dominates, the real demand curve becomes inelastic and parallel to the supply curve, leading the equilibrium fee to change dramatically even with small shifts in the demand curve (arrows). The proposal imposes that the equilibrium (square) forms on the edges of the upper-left quadrant, at the intersection between the target supply curve and demand or along the dashed line representing possible reserve price equilibria accounting for execution costs.&lt;&#x2F;p&gt;
&lt;p&gt;To improve the fee update mechanism, a reserve price is specified below which $b$ cannot be reduced. Specifically, we define a constant &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; and in &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; do not subtract &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; if:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOB_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This means that the reserve blob base fee becomes &lt;code&gt;BLOB_BASE_COST * base_fee_per_gas &#x2F; GAS_PER_BLOB&lt;&#x2F;code&gt; and that the ratio between the reserve price for the blob base fee and the execution base fee is fixed to: &lt;code&gt;BLOB_BASE_COST &#x2F; GAS_PER_BLOB&lt;&#x2F;code&gt;. This ratio is &lt;code&gt;1&#x2F;16&lt;&#x2F;code&gt; with the proposed constant.&lt;&#x2F;p&gt;
&lt;p&gt;The blob fee&#x27;s share of the total price will with the reserve price always be at least &lt;code&gt;BLOB_BASE_COST &#x2F; (BLOB_BASE_COST + execution_cost)&lt;&#x2F;code&gt;. This is why the equilibrium under the reserve price (dashed line in Figure 1) is situated a constant fraction below the black organic demand curve formed under a zero execution base fee. The equilibrium (squares) must then form somewhere along the edge of the upper-left quadrant, bounded by the blue supply curve and the dashed curve representing possible reserve price equilibria under real demand.&lt;&#x2F;p&gt;
&lt;p&gt;The demand curve could potentially be somewhat inelastic even under zero execution costs. This would however just be another reason to move forward with this proposal. Regardless of the exact shape of the demand curve—which of course will remain unknown and can vary going forward—the proposal is based on something tangible affecting blob consumers. This makes it a justified neutral bound on the blob base fee.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blob-kzg-proof-verification-cost&quot;&gt;Blob KZG proof verification cost&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-4844 introduced the first phase of Ethereum&#x27;s data availability sampling (DAS) roadmap. Validators on the consensus layer (CL) verify that the KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; in the payload correspond to the provided &lt;code&gt;blobs&lt;&#x2F;code&gt; by cryptographically verifying the accompanying KZG &lt;code&gt;proofs&lt;&#x2F;code&gt;. Execution layer (EL) nodes must also validate the &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; and verify the wrapped data (blobs, commitments, and proofs) for every blob entering a node&#x27;s tx pool. The computational requirements for verifying a KZG proof for an entire blob are slightly higher than those for verifying a KZG proof for a single point on that blob; the latter is the specific operation covered by the &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt; (50000) charged to smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7594&#x2F;&quot;&gt;EIP-7594&lt;&#x2F;a&gt; introduces PeerDAS. It changes the compute requirements due to the reliance on blob cells and their individual proofs. The exact specification is not yet fully settled, but this is a rough guideline:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EL nodes batch-verify &lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; (128) cell proofs for each blob before including a tx carrying that blob in their tx pool. This verification (e.g., using &lt;code&gt;verify_cell_kzg_proof_batch&lt;&#x2F;code&gt;) is roughly 15 times more expensive than the compute associated with a single &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Full nodes verify 4 custodied columns, each column containing one cell from all blobs referenced in the payload. Each column&#x27;s cell proofs can be batch-verified (also applicable below).&lt;&#x2F;li&gt;
&lt;li&gt;Supernodes verify 128 custodied columns, each column containing one cell from all blobs referenced in the payload.&lt;&#x2F;li&gt;
&lt;li&gt;Validators between full nodes and supernodes will custody between 4-128 columns.&lt;&#x2F;li&gt;
&lt;li&gt;Nodes peer-sample &lt;code&gt;SAMPLES_PER_SLOT&lt;&#x2F;code&gt; (8) columns each slot (in addition to custodied columns).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ability on the CL to jointly process cell proofs of a column (from all blobs) through batching reduces the compute time spent per blob as the number of blobs increases. It is further possible to batch all columns jointly or to parallelize the processing across columns. When accounting for the prospect of parallelization for the CL, it is however worth remembering that the point evaluation proof verification performed by rollups using the precompile also lends itself to parallelization. This means that a comparison between the point evaluation and the sequential processing of blobs (batched per column) is still relevant (because &lt;em&gt;both&lt;&#x2F;em&gt; could be parallelized).&lt;&#x2F;p&gt;
&lt;p&gt;Figure 2 shows verification time per blob divided by the measured execution time of a single point evaluation operation (performed by the &lt;code&gt;VerifyKZGProof&lt;&#x2F;code&gt; precompile) for various configurations. The figure indicates that blobs under the current Fusaka PeerDAS specification will subject nodes to rather heavy compute requirements—when compared to the single point evaluation proof verification that a smart contract is charged &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt; for. A full node would for example do the EL mempool verification for all blobs propagated p2p (15x), sample 8 columns (2x at 32 blobs when batching columns sequentially), and custody 4 designated columns (1x). How to price the KZG proof verification is however a complex question given the varying contexts in which it is performed. The proposed constant &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; is indicated by a green line in Figure 2. It is relatively moderate in comparison with the compute costs imposed on nodes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;Figure 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2.&lt;&#x2F;strong&gt; Verification time per blob relative to one point evaluation on an Apple M2 Max with 12 cores. The EL mempool verification (red) takes 15 times longer in the worst case, regardless of the blob target. The per-blob verification time of columns depends on the number of custodied&#x2F;sampled columns and falls with an increase in the blob target due to speed-ups from processing all cells of a column jointly. The constant &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; is relatively moderate in comparison with the compute costs that blobs impose on nodes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;designing-for-the-future&quot;&gt;Designing for the future&lt;&#x2F;h3&gt;
&lt;p&gt;The price of storing a fixed amount of data has fallen over the last 80 years. Technological progress generally brings down the unit cost of data services, following Nielsen’s law and Moore’s law. The ETH-denominated price per blob should likewise fall as Ethereum increases blob throughput. This effect is reinforced because a higher aggregate ETH-denominated blob revenue (which is distributed to ETH token holders via the burn) increases the fiat-denominated value of the ETH token, ceteris paribus. There is thus an upper bound on the blob base fee—a bound that falls as Ethereum scales. The same reflexivity applies to the execution base fee.&lt;&#x2F;p&gt;
&lt;p&gt;In this light, the proposal can be understood as a design for the future. Fixed thresholds not relating to blob quantity or the execution fee may not be sustainable. In a scenario where Ethereum sells more blobs per block, the equilibrium blob base fee should ideally have a relatively lower floor. Any fixed threshold (not relating to the execution base fee or blob quantity) would need to be gradually readjusted to retain the same relative impact.&lt;&#x2F;p&gt;
&lt;p&gt;If Ethereum increases blob throughput by several orders of magnitude but does &lt;em&gt;not&lt;&#x2F;em&gt; scale blockspace, such that the execution base fee remains high, the reserve price of &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; execution gas would however still become too high. At 1000 blobs and 30M execution gas per block, Ethereum would derive just over 1&#x2F;5th (21.5%) of its income from blob gas even when blobs are strictly sold at the reserve price. This implies a too high &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt;, but 1000 blobs and 30M execution gas is not the trajectory that Ethereum currently is on. If Ethereum scales blockspace and blobspace roughly in synchrony, it is reasonable to expect that the reserve price remains at the desired level.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delayed-response-during-a-quick-rise-in-execution-fees&quot;&gt;Delayed response during a quick rise in execution fees&lt;&#x2F;h3&gt;
&lt;p&gt;When the &lt;code&gt;if&lt;&#x2F;code&gt; statement concludes that Ethereum operates in the execution-fee-led pricing regime, the blob base fee rises in accordance with &lt;code&gt;blob_gas_used * (max - target) &#x2F;&#x2F; max&lt;&#x2F;code&gt;, without subtracting &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt;. This is an intuitive way to return to the blob-fee-led pricing regime, retaining the same maximum fee increase while not allowing for a decrease. If the execution base fee rises quickly, there may be a few blocks before the blob base fee catches up (during which &lt;code&gt;target_blob_gas&lt;&#x2F;code&gt; will never be subtracted). This is arguably not an issue, and the smooth response in the blob base fee under these circumstances may even be seen as a benefit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empirical-analysis&quot;&gt;Empirical analysis&lt;&#x2F;h3&gt;
&lt;p&gt;Figures 3-4 show price evolution over three weeks in November 2024, when the average execution base fee was around 16 gwei, as well as in March 2025, when the average was around 1.3 gwei. The proposed reserve fee is applied directly to the original data, without accounting for its potential effect on the equilibrium fee. The equilibrium blob base fee would in reality rise from the threshold level once demand at this fee is above target supply. EIP-7918 imposes the maximum of the two curves, indicated in darker colors.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;3.png&quot; alt=&quot;Figure 3&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3.&lt;&#x2F;strong&gt; Blob base fee evolution with the current fee market (black) and the proposed reserve fee (blue), during three weeks of November 2024 when the average execution base fee was around 16 gwei. EIP-7918 imposes the maximum of the two curves, as indicated in darker colors. Thresholding is applied directly to the original data, without accounting for its effect on the equilibrium fee.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;4.png&quot; alt=&quot;Figure 4&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 4.&lt;&#x2F;strong&gt; Blob base fee evolution with the current fee market (black) and the proposed reserve fee (blue), during three weeks of March 2025 when the average execution base fee was around 1.3 gwei. EIP-7918 imposes the maximum of the two curves, as indicated in darker colors. Thresholding is applied directly to the original data, without accounting for its effect on the equilibrium fee.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 5 shows histograms for observed fees and the maximum of the two curves for the four-month period from November 2024 (start of Figure 3&#x27;s data period) through March 2025 (end of Figure 4&#x27;s data period), corresponding to approximately 900k blocks beginning at block number 22075724. The histograms employ 100 log-spaced bins per decade (factor-of-ten increase), which are smoothed using a Hanning window of width 21 with mirror-reflected edges.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;.&#x2F;assets&#x2F;5.png&quot; alt=&quot;Figure 5&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 5.&lt;&#x2F;strong&gt; Histogram of the blob base fee when there is no threshold or when applying EIP-7918 (dashed combination of the darker black and blue curves from previous figures), with light smoothing applied. A four-month period from November 2024 through March 2025 was analyzed. Thresholding is applied directly to the original data, without accounting for its effect on the equilibrium fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The blob base fee will settle at a level where a blob costs at least &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; execution gas. To the best of the authors&#x27; knowledge, there are no security risks associated with this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ ProgressiveList</title>
        <published>2025-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zsolt Felföldi</name><uri>https://github.com/zsfelfoldi</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7916/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7916-ssz-progressivebytelist/23254" />
        

        <id>https://wg-eips.ritovision.com/7916/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7916"
            label="EIP-7916" />
        

        
        

        
        <summary type="html">SSZ types for efficiently hashing short lists</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7916/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new Merkle tree shape for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; types that results in fewer hashes when only a small number of leaves is used. The new tree shape grows progressively with increased leaf count and no longer has a bounded capacity. It also offers forward compatibility: a given chunk index is always assigned the same stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; regardless of leaf count.&lt;&#x2F;p&gt;
&lt;p&gt;New types are defined to use the progressive Merkle tree shape: &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; and &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;. These new types represent lists of arbitrary length with stable merkleization, reducing hashing overhead for small lists and avoiding arbitrary capacity limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current SSZ &lt;code&gt;List[type, N]&lt;&#x2F;code&gt; types require a predefined capacity &lt;code&gt;N&lt;&#x2F;code&gt;, which leads to several issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Inefficient hashing: Lists often contain far fewer elements than their maximum capacity (e.g., &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;), resulting in unnecessary zero-padding and dozens of extra hash computations. This is exacerbated when nesting &lt;code&gt;List[type, N]&lt;&#x2F;code&gt;, e.g., in a design where each of up to &lt;code&gt;X&lt;&#x2F;code&gt; transactions has up to &lt;code&gt;Y&lt;&#x2F;code&gt; access lists, each with up to &lt;code&gt;Z&lt;&#x2F;code&gt; storage slots.&lt;&#x2F;li&gt;
&lt;li&gt;Arbitrary Limits: The capacity &lt;code&gt;N&lt;&#x2F;code&gt; is often chosen arbitrarily (e.g., &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#execution&quot;&gt;&lt;code&gt;MAX_BYTES_PER_TRANSACTION&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#execution&quot;&gt;&lt;code&gt;MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) and set to artificially large values to anticipate future design space, which are not always correct.&lt;&#x2F;li&gt;
&lt;li&gt;Unstable proofs: Modifying &lt;code&gt;N&lt;&#x2F;code&gt; across forks (e.g., &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#max-operations-per-block&quot;&gt;&lt;code&gt;MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#max-operations-per-block&quot;&gt;&lt;code&gt;MAX_ATTESTATIONS_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;) alters gindices, breaking downstream verifiers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The progressive Merkle tree shape addresses these by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using a recursive tree structure that progressively grows to the actual leaf count with minimal overhead&lt;&#x2F;li&gt;
&lt;li&gt;Dropping the notion of a maximum capacity, relying instead on practical limits, e.g., SSZ&#x27;s 4 GB variable offset cap, network payload limits, gas limits, bounds on the number of signatures.&lt;&#x2F;li&gt;
&lt;li&gt;Maintaining stable gindices for each element, ensuring provers remain valid as the leaf count changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;progressive-merkle-tree&quot;&gt;Progressive Merkle tree&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;SSZ Merkleization specification&lt;&#x2F;a&gt; is extended with a helper function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;merkleize_progressive(chunks, num_leaves=1)&lt;&#x2F;code&gt;: Given ordered &lt;code&gt;BYTES_PER_CHUNK&lt;&#x2F;code&gt;-byte chunks:
&lt;ul&gt;
&lt;li&gt;The merkleization depends on the number of input chunks and is defined recursively:
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;len(chunks) == 0&lt;&#x2F;code&gt;: the root is a zero value, &lt;code&gt;Bytes32()&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise: compute the root using &lt;code&gt;hash(a, b)&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;a&lt;&#x2F;code&gt;: Merkleize the first up to &lt;code&gt;num_leaves&lt;&#x2F;code&gt; chunks as a binary tree using &lt;code&gt;merkleize(chunks[:num_leaves], num_leaves)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;b&lt;&#x2F;code&gt;: Recursively merkleize chunks beyond &lt;code&gt;num_leaves&lt;&#x2F;code&gt; using &lt;code&gt;merkleize_progressive(chunks[num_leaves:], num_leaves * 4)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This results in a 0-terminated sequence of binary subtrees with increasing leaf count. The deepest subtree is padded with zeroed chunks (virtually for memory efficiency).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 1: chunks[0 ..&amp;lt; 1]   &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                     &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   4: chunks[1 ..&amp;lt; 5]   &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   16: chunks[5 ..&amp;lt; 21]   &#x2F;\&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                         &#x2F;  \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    64: chunks[21 ..&amp;lt; 85]    0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Depth&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Added chunks&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Total chunks&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Total capacity (bytes)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;160&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;3&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;672&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;64&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;85&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&#x27;720&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;256&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;341&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10&#x27;912&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;365&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;43&#x27;680&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;7&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x27;096&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&#x27;461&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;174&#x27;752&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&#x27;384&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21&#x27;845&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;699&#x27;040&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;9&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65&#x27;536&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;87&#x27;381&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&#x27;796&#x27;192&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;10&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;262&#x27;144&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;349&#x27;525&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11&#x27;184&#x27;800&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;11&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;048&#x27;576&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1&#x27;398&#x27;101&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;44&#x27;739&#x27;232&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x27;194&#x27;304&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5&#x27;592&#x27;405&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;178&#x27;956&#x27;960&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;13&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&#x27;777&#x27;216&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;22&#x27;369&#x27;621&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;715&#x27;827&#x27;872&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;14&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;67&#x27;108&#x27;864&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;89&#x27;478&#x27;485&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2&#x27;863&#x27;311&#x27;520&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;15&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;268&#x27;435&#x27;456&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;357&#x27;913&#x27;941&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11&#x27;453&#x27;246&#x27;112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;progressivelist-type-and-progressivebitlist&quot;&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; and &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Two new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;SSZ composite types&lt;&#x2F;a&gt; are defined:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;progressive list&lt;&#x2F;strong&gt;: ordered variable-length homogeneous collection, without limit
&lt;ul&gt;
&lt;li&gt;notation &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;, e.g. &lt;code&gt;ProgressiveList[uint64]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;progressive bitlist&lt;&#x2F;strong&gt;: ordered variable-length collection of &lt;code&gt;boolean&lt;&#x2F;code&gt; values, without limit
&lt;ul&gt;
&lt;li&gt;notation &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new types are considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#variable-size-and-fixed-size&quot;&gt;&quot;variable-size&quot;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For convenience we &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#aliases&quot;&gt;alias&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ProgressiveByteList&lt;&#x2F;code&gt; to &lt;code&gt;ProgressiveList[byte]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#default-values&quot;&gt;default value&lt;&#x2F;a&gt; is defined as:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Default Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h4&gt;
&lt;p&gt;Serialization, deserialization, and JSON mapping of &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt; are identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#bitlistn&quot;&gt;&lt;code&gt;Bitlist[N]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Serialization, deserialization, and JSON mapping of &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; are identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#vectors-containers-lists&quot;&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;Merkleization&lt;&#x2F;a&gt; definitions are extended.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_length(merkleize_progressive(pack(value)), len(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive list of basic objects.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mix_in_length(merkleize_progressive(pack_bits(value)), len(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive bitlist.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mix_in_length(merkleize_progressive([hash_tree_root(element) for element in value]), len(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive list of composite objects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-a-recursive-structure&quot;&gt;Why a recursive structure?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Efficiency: Small lists use fewer hashes (e.g., a 3-item list in a 16-element subtree wastes fewer hashes than a 1024-element &lt;code&gt;List[type, N]&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Stability: Fixed subtree sizes ensure stable gindices, avoiding the need for dynamic depth adjustments or multiple queries.&lt;&#x2F;li&gt;
&lt;li&gt;Scalability: Recursive subtrees allow arbitrary growth without a hardcoded limit, constrained only by practical limits (e.g., network payload limit, validation rules).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;why-not-dynamic-depth&quot;&gt;Why not dynamic depth?&lt;&#x2F;h3&gt;
&lt;p&gt;Dynamic-depth Merkleization destabilizes gindices:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Requires two-step queries (length then gindex), increasing latency and reorg risks.&lt;&#x2F;li&gt;
&lt;li&gt;Complicates proofs with semantic lookups.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Mixing in successor subtrees ensures predictable gindices and proof sizes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-fixed-capacity-lists&quot;&gt;Why not fixed-capacity lists?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Imposes arbitrary limits, hindering scalability.&lt;&#x2F;li&gt;
&lt;li&gt;Breaks stability when redefined.&lt;&#x2F;li&gt;
&lt;li&gt;Wastes hashes with padding (e.g., 1024-element capacity for a 1-item list). (only log(N) wasted hashes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; offers a scalable, efficient alternative.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-are-initial-leaf-count-and-scaling-factors-not-exposed-parameters&quot;&gt;Why are initial leaf count and scaling factors not exposed parameters?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Simplicity: Fixed values (initial leaf count 1, scaling factor 4) provide a sensible default that balances efficiency and usability, aligning with SSZ’s goal of simplicity.&lt;&#x2F;li&gt;
&lt;li&gt;Future Extensibility: If specific use cases demand different values, a future EIP could introduce parameterization. For now, fixed values reduce adoption barriers and align with the principle of &quot;good enough&quot; defaults.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new SSZ types coexist with existing types without conflict and share their serialization logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt; contains static tests in &lt;code&gt;test_impl.py&lt;&#x2F;code&gt; and &lt;code&gt;test_typing.py&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; releases contain random tests in &lt;code&gt;tests&#x2F;general&#x2F;phase0&#x2F;ssz_generic&lt;&#x2F;code&gt;, generated according to a format defined in &lt;code&gt;tests&#x2F;format&#x2F;ssz_generic&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Resource limits: The &lt;code&gt;uint32&lt;&#x2F;code&gt; limit for variable-length offsets essentially introduces a ~4GB cap when including a &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt; or &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt; within another complex type, but practical limits (e.g., 10MB libp2p messages) apply. Implementations SHOULD enforce context-specific bounds.&lt;&#x2F;li&gt;
&lt;li&gt;Variable proof size: Recursive traversal may increase proof sizes for large indices, though logarithmic in list size due to the scaling factor.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deterministic proposer lookahead</title>
        <published>2025-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Lin Oshitani</name><uri>https://github.com/linoscope</uri><email>lin@nethermind.io</email>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri><email>justin@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7917/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7917-deterministic-proposer-lookahead/23259" />
        

        <id>https://wg-eips.ritovision.com/7917/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7917"
            label="EIP-7917" />
        

        
        

        
        <summary type="html">Pre-calculate and store a deterministic proposer lookahead in the beacon state at the start of every epoch</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7917/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;At the start of each epoch, pre-calculate and store in the &lt;code&gt;beacon_state&lt;&#x2F;code&gt; a deterministic &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; for the next &lt;code&gt;MIN_SEED_LOOKAHEAD + 1&lt;&#x2F;code&gt; epochs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Unlike RANDAO seeds, which have a deterministic lookahead of at least &lt;code&gt;MIN_SEED_LOOKAHEAD == 1&lt;&#x2F;code&gt; epochs, the beacon proposer schedule of epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt; is not fully predictable from the beacon state during epoch &lt;code&gt;N&lt;&#x2F;code&gt;. The reason is that, under certain edge cases, the effective balances (EBs) of active validators—themselves used as input for proposer election in epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt;—can change within epoch &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Based preconfirmation protocols rely on a deterministic proposer schedule for smooth operations. Since the beacon genesis, slashings and penalties that accumulate to at least 1 ETH can change EBs of active validators and lead to an unpredictable proposer schedule despite the RANDAO seed being known ahead of time. The increase of MaxEB with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;&quot;&gt;EIP-7251&lt;&#x2F;a&gt; increases effective balance unpredictability because rewards that accumulate to at least 1 ETH, validator consolidations, and deposits can grow EBs of active validators beyond 32 ETH.&lt;&#x2F;p&gt;
&lt;p&gt;Besides fixing next-epoch proposer schedule non-determinism, this EIP makes it possible for the proposer schedule of the next epoch to be accessible to the application layer via the beacon root and a simple Merkle proof. This highly simplifies the implementation of on-chain components for based preconfirmation protocols.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing a fully deterministic lookahead fixes a long-standing beacon chain design oversight, as highlighted by Danny Ryan&#x27;s comment below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7917&#x2F;.&#x2F;assets&#x2F;lookahead-comment.png&quot; alt=&quot;Danny Ryan&amp;#39;s comment on proposer lookahead&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With this change, it will no longer be possible for validators to grind effective balances to manipulate the proposer schedule of the next epoch, and the analysis of effective balance grinding will collapse from what is currently a subtle analysis of EB edge cases to a trivial security analysis. Finally, the proposer lookahead gives CL clients ahead-of-time visibility over the next proposer which may simplify implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container is extended with a &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; field, which is a vector of validator indices covering the full visible lookahead period, starting from the beginning of the current epoch to the next &lt;code&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt; epochs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, &lt;code&gt;proposer_lookahead[0]&lt;&#x2F;code&gt; is the validator index for the first proposer in the current epoch, &lt;code&gt;proposer_lookahead[SLOTS_PER_EPOCH + 4]&lt;&#x2F;code&gt; is the validator index for the fifth proposer in the next epoch, and so forth.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;get_beacon_proposer_index&lt;&#x2F;code&gt; is modified to use the pre-calculated &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; instead of calculating proposer indices on-demand.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_beacon_proposer_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the beacon proposer index at the current slot.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the epoch boundary, the &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; is updated by shifting out the current epoch’s lookahead and appending the new one.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_epoch_start&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Shift out proposers in the first epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;last_epoch_start&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fill in the last epoch with new proposer indices&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_epoch_proposers&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_beacon_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_SEED_LOOKAHEAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;last_epoch_start&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; last_epoch_proposers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_beacon_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the proposer indices for the given ``epoch``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    indices&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_active_validator_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_seed&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DOMAIN_BEACON_PROPOSER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; compute_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_proposer_indices&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Return the proposer indices for the given ``epoch``.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    start_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_start_slot_at_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    seeds&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; uint_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;start_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;compute_proposer_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; seeds&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Furthermore, the first block after the fork will calculate all lookaheads for epochs up to &lt;code&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt; ahead and fill the &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; field in the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;cbaa0063979168a94a9c7821f366c6a221319c8e&#x2F;specs&#x2F;fulu&#x2F;beacon-chain.md&quot;&gt;updated beacon chain specs&lt;&#x2F;a&gt; in consensus-specs for more details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;considered-alternatives&quot;&gt;Considered Alternatives&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative approach would be to cache the effective balances at the start of epoch &lt;code&gt;N&lt;&#x2F;code&gt; so it can be used to calculate the proposer lookahead at the start of epoch &lt;code&gt;N+MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt;. However, this approach would require additional footprint in the beacon state, and would not be able to provide the proposer lookahead to the EVM via the beacon root.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-secret-leader-election-compatibility&quot;&gt;Single Secret Leader Election Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;In the future, we may introduce a Single Secret Leader Election (SSLE) mechanism in which only the selected validator knows their role until they propose a block. However, current SSLE designs still rely on a lookahead, albeit an encrypted one. In such designs, we could reuse the &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; field by changing its type to something like &lt;code&gt;List[EncryptedValidatorIndex]&lt;&#x2F;code&gt;. And if a construction were to remove lookahead entirely, we could simply set &lt;code&gt;proposer_lookahead&lt;&#x2F;code&gt; to an empty list, meaning this wouldn’t be a blocker.&lt;&#x2F;p&gt;
&lt;p&gt;That said, any such changes would introduce additional complexity around preconfirmation protocols, but that complexity arises regardless of this EIP. Furthermore, APS (Attester Proposer Separation) envisions more sophisticated (i.e., more DDoS‑resistant) execution proposers, reducing the need for SSLE.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-computation-at-the-epoch-boundary&quot;&gt;Added Computation at the Epoch Boundary&lt;&#x2F;h3&gt;
&lt;p&gt;Before this EIP, consensus clients only needed to compute the current proposer’s index at each slot. With the changes introduced by this EIP, they must calculate the entire epoch’s proposer schedule at the start of each epoch. However, computing the proposer index is light, involving sampling validators until we reach a validator with sufficient effective balance to be selected as a proposer. Still, testing is needed to confirm that these additional calculations do not create performance bottlenecks in practice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;cbaa0063979168a94a9c7821f366c6a221319c8e&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;fulu&quot;&gt;the spec tests&lt;&#x2F;a&gt; in consensus-specs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;malicious-lookahead-alteration&quot;&gt;Malicious Lookahead Alteration&lt;&#x2F;h3&gt;
&lt;p&gt;A critical consideration for any proposer election mechanism is preventing validators from manipulating lookahead to gain an unfair advantage. This proposal does not increase the chances of such attacks, as we do not alter the “RANDAO delay” used in the lookahead—the lookahead of epoch &lt;code&gt;N&lt;&#x2F;code&gt; is still determined by the RANDAO of epoch &lt;code&gt;N - MIN_SEED_LOOKAHEAD - 1&lt;&#x2F;code&gt; (which becomes available at the start of epoch &lt;code&gt;N - MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt;). The only difference is that it changes the “effective balances delay”: rather than using the effective balances (EB) at the start of epoch &lt;code&gt;N&lt;&#x2F;code&gt;, it now uses the EB at the start of epoch &lt;code&gt;N - MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, by aligning the RANDAO and effective balances in this way, the proposal removes any chance of validators adjusting their EB after seeing the RANDAO outcome, which is an attack vector to consider. No such attack has been found so far, but this change removes the possibility, hence simplifying the security analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dynamic exit queue rate limit</title>
        <published>2025-03-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Mike Neuder</name><uri>https://github.com/michaelneuder</uri>
	</author>
	
	<author>
		<name>Mallesh Pai</name><uri>https://github.com/Mmp610</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7922/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/dynamic-exit-churn-limit-using-historical-unused-capacity/23280" />
        

        <id>https://wg-eips.ritovision.com/7922/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7922"
            label="EIP-7922" />
        

        
        

        
        <summary type="html">Update the validator exit process by dynamically adjusting the churn limit based on historical validator exits.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7922/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes updating Ethereum&#x27;s validator exit churn calculation by dynamically adjusting the churn limit at the start of each 256-epoch period (&quot;generation&quot;) based on historical validator exits. Specifically, the maximum churn allowed in each generation will adjust according to the unused churn from the past 16 generations. This approach reduces validator wait times during periods of high exit demand &lt;em&gt;without sacrificing network safety&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently implements a fixed, rate-limited queue for validator exits to ensure the security and stability of the network. The exit queue ensures the economic security of transactions finalized by the validator set. Suppose a malicious validator could immediately exit the set without any delay. In that case, they may attempt to execute a double spend attack by publishing a block while withholding a conflicting block, which they release after their stake has exited the protocol. The slashing mechanism can no longer hold the malicious validator accountable, and two conflicting finalized transactions may exist (if the attacker has 1&#x2F;3 of the total stake and successfully splits the 2&#x2F;3 honest majority in half).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CHURN_LIMIT_QUOTIENT=2^16&lt;&#x2F;code&gt; was selected according to the rough heuristic that it should take approximately one month for 10% of the stake to exit. With 1,053,742 validators, we have a churn limit of 16 exits per epoch. 225 epochs per day $\implies$ 3600 exits per day $\implies$ 108,000 exits per 30 days. Then 108,000&#x2F;1,053,742 $\approx$ 0.10. We can interpret this as &quot;&lt;em&gt;the economic security of a finalized transaction decreases by no more than 10% within one month&lt;&#x2F;em&gt;.&quot;&lt;&#x2F;p&gt;
&lt;p&gt;Another way of understanding the 16 exits per epoch security model is that it encodes the following constraints around validator exits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;at most 16 validators exit in the next one epoch, and&lt;&#x2F;li&gt;
&lt;li&gt;at most 32 validators exit in the next two epochs, and&lt;&#x2F;li&gt;
&lt;li&gt;at most 48 validators exit in the next three epochs, and
...&lt;&#x2F;li&gt;
&lt;li&gt;at most 16 $\cdot$ n validators exit in the next n epochs.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;While these constraints are simple to understand, the fixed per-epoch churn limit can result in unnecessarily long validator withdrawal delays during periods of higher-than-average exit demand, such as during institutional liquidations or market events. We argue that we should choose a &lt;em&gt;single&lt;&#x2F;em&gt; constraint from the above set and implement that flexibly.&lt;&#x2F;p&gt;
&lt;p&gt;We illustrate this with an example. With one million validators, the current protocol specifies that 16 validators may exit per epoch. Over two weeks, this corresponds to 50,400 exits. This translates directly to &quot;no more than 5.04% of the validators (equiv. stake) can exit within two weeks.&quot; Now imagine that in the past 13 days, no validators have exited the protocol, and thus, none of the two-week churn limit has been used. If a large staking operator with 3% of the validator set (30,000 validators) seeks to withdraw immediately, they should be able to -- this doesn&#x27;t violate the two-week limit of 5.04%. However, since only 16 exits can be processed per epoch moving forward, they are forced to wait 1875 epochs (equiv. 8.33 days).&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key observation:&lt;&#x2F;strong&gt; If we enable the protocol to &lt;em&gt;look backward&lt;&#x2F;em&gt; at the exit history, we no longer need the per-epoch limit &lt;em&gt;looking forward&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;For example, say we chose the following constraint explicitly:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Proposed weak subjectivity constraint:&lt;&#x2F;strong&gt; &lt;em&gt;No more than 50,400 exits in two weeks.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Then, we only need to ensure that the constraint is honored over every rolling two-week window without setting a hard cap on exits during every epoch. A dynamically adjusted churn limit based on historical validator exit data allows Ethereum to flexibly accommodate spikes in exit demand while &lt;em&gt;preserving the same security over every two-week window&lt;&#x2F;em&gt;. By tracking the unused churn capacity of recent generations (periods), we can safely increase the churn limit when the network consistently operates below capacity, significantly improving the validator exit experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Since the validator exit process is complex, we start with the stack trace and a verbal description of the end-to-end process in Electra.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;initiate_validator_exit&lt;&#x2F;code&gt; – a validator signals their intent to exit, which is actuated by setting &lt;code&gt;validator.exit_epoch&lt;&#x2F;code&gt; and &lt;code&gt;validator.withdrawable_epoch&lt;&#x2F;code&gt; based on the output of &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; – is used to determine the exit epoch of a validator. This function implements the exit queue in the following way:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_balance_churn_limit&lt;&#x2F;code&gt; - returns the amount of withdrawable ETH per epoch by dividing the total active balance by 2**16.&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;exit_balance_to_consume&lt;&#x2F;code&gt; to the churn available in the current furthest epoch where some exits will be processed.&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;exit_balance &amp;gt; exit_balance_to_consume&lt;&#x2F;code&gt;, then we calculate the number of extra epochs the exit consumes to set the final &lt;code&gt;exit_epoch&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP changes how the churn limit and exit epochs are calculated by examining the number of exits in the previous 14 generations.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt; – implements the new churn limit calculation by summing over historical generations.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;per_epoch_exit_churn&lt;&#x2F;code&gt; is set using &lt;code&gt;get_activation_exit_churn_limit&lt;&#x2F;code&gt; as today by dividing the total stake by 2**16 and capping the result at 256 ETH. With today&#x27;s numbers, this returns 256 ETH that can churn per epoch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;per_generation_exit_churn&lt;&#x2F;code&gt; is set by multiplying the per epoch exit churn by 256 (the number of epochs in a generation). With today&#x27;s numbers, this is 256 $\cdot$ 256 = 65536 ETH that can churn per generation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;total_unused_exit_churn&lt;&#x2F;code&gt; is calculated by looping through the past generations and summing the amount of unused capacity, &lt;code&gt;per_generation_exit_churn - churn_usage&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The final returned value is capped at &lt;code&gt;per_epoch_exit_churn * 8&lt;&#x2F;code&gt;. With today&#x27;s numbers, this max is 256 $\cdot$ 8 = 2048 ETH per epoch.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; – is modified to use &lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt; and account for any churn consumed in the generation where the exit will be processed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generation&lt;&#x2F;strong&gt;: A period consisting of 256 epochs.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Historical Churn Vector&lt;&#x2F;strong&gt;: A fixed-size array (&lt;code&gt;exit_churn_vector&lt;&#x2F;code&gt;) that records the total amount of churned ETH in the previous 16 generations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unused Churn&lt;&#x2F;strong&gt;: The difference between the maximum possible churn and the actual churn that occurred within a generation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;preset&quot;&gt;Preset&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**8)&lt;&#x2F;code&gt; (= 256)&lt;&#x2F;td&gt;&lt;td&gt;~27 hours&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**4)&lt;&#x2F;code&gt; (= 16)&lt;&#x2F;td&gt;&lt;td&gt;~18 days&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint(2**1)&lt;&#x2F;code&gt; (= 2)&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXIT_CHURN_SLACK_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint(2**3)&lt;&#x2F;code&gt; (= 8)&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-state-variables&quot;&gt;New State Variables&lt;&#x2F;h3&gt;
&lt;p&gt;Add the following to the state:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; total exited balance per generation for GENERATIONS_PER_EXIT_CHURN_VECTOR generations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;initialization&quot;&gt;Initialization&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, initialize new variables:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Mark the churn of each generation as fully consumed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;UINT64_MAX&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update lookahead generations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_epoch_generation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Design note:&lt;&#x2F;em&gt; Max out churn usage for the past generations as it is unknown; update the current and lookahead generations according to the &lt;code&gt;state.earliest_exit_epoch&lt;&#x2F;code&gt; generation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-functions&quot;&gt;New Functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;epoch-processing&quot;&gt;Epoch Processing&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_historical_exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update the vector if switching over to the next generation.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; next_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; next_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        lookahead_generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_HISTORICAL_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If earliest_exit_epoch is earlier than the lookahead generation,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; reset its churn usage to 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lookahead_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise, mark the lookahead generation churn as fully consumed.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;historical_exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;lookahead_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; UINT64_MAX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Design note&lt;&#x2F;em&gt;: This function resets the lookahead generation churn upon switching to the next generation. If &lt;code&gt;state.earliest_exit_epoch&lt;&#x2F;code&gt; falls into the generation earlier than the lookahead, the lookahead generation churn usage is reset. Otherwise, it is marked as fully used.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;get-exit-churn-limit&quot;&gt;&lt;code&gt;get_exit_churn_limit&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_activation_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the earliest_exit_epoch generation is beyond the lookahead,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; don&amp;#39;t use the slack.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute churn leftover from past generations.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    past_generations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; past_generations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        oldest_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; past_generations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        oldest_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_generation_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_unused_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;oldest_generation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_generation&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        churn_usage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; churn_usage&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; per_generation_exit_churn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            total_unused_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; per_generation_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; churn_usage&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Limit churn slack per epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;total_unused_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        per_epoch_exit_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXIT_CHURN_SLACK_MULTIPLIER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Design note:&lt;&#x2F;em&gt; Given churn usage for past generations and current epoch churn size estimates the churn leftover from past generations. Caps the returned churn at &lt;code&gt;per_epoch_exit_churn * EXIT_CHURN_SLACK_MULTIPLIER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modified-functions&quot;&gt;Modified Functions&lt;&#x2F;h3&gt;
&lt;p&gt;Replace the existing &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; function with this simplified MINSLACK-inspired version:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_exit_epoch_and_update_churn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; exit_balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_activation_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modified in [EIP-XXXX]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_exit_churn_limit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New epoch for exits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Exit doesn&amp;#39;t fit in the current earliest epoch.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;balance_to_process&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; additional_epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; per_epoch_churn&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the balance and update state variables.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New in [EIP-XXXX]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_CHURN_GENERATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_HISTORICAL_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Record churn usage only if exit falls into the lookahead period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and the exit epoch generation churn isn&amp;#39;t fully used.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    lookahead_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_LOOKAHEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit_epoch_generation_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENERATIONS_PER_EXIT_CHURN_VECTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch_generation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; lookahead_generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;historical_exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; UINT64_MAX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;exit_churn_vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;exit_epoch_generation_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; exit_balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;earliest_exit_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As we described earlier, by computing unused churn from the previous 14 generations, the churn limit dynamically responds to actual validator behavior. This mechanism:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduces validator waiting times during periods of congestion.&lt;&#x2F;li&gt;
&lt;li&gt;Ensures security by restricting maximum churn limit increases.&lt;&#x2F;li&gt;
&lt;li&gt;Simplifies implementation compared to more complex dynamic mechanisms.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A generation length of 256 epochs (~27 hours) and a history of 14 generations (~16 days) balances responsiveness and stability, enabling Ethereum to adapt smoothly to sustained changes in validator exit behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Validator exit constraints remain crucial for Ethereum&#x27;s accountable safety. This proposal maintains the core safety guarantee by strictly limiting the increase of the churn limit.&lt;&#x2F;li&gt;
&lt;li&gt;The maximum churn limit is capped at eight times the current fixed churn, ensuring safety assumptions hold even in worst-case scenarios.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Adaptive mean reversion blob pricing</title>
        <published>2025-03-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7915/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/adaptive-mean-reversion-blob-pricing/23243" />
        

        <id>https://wg-eips.ritovision.com/7915/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7915"
            label="EIP-7915" />
        

        
        

        
        <summary type="html">Fee schedule accounting for the long-run average to quickly restore equilibrium under inelastic demand</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7915/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reworks the excess blob gas update in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; so that the blob base fee rises relatively more during high gas usage than it falls during low usage whenever the current fee is below the long-run average. This establishes a smoothly adapting, neutral lower bound for the base fee. The exponential moving average (EMA) is computed in the linear domain and stored as a header variable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Demand for blobspace is fee-inelastic, leading to a blob base fee that may fluctuate excessively with minor shifts in aggregate demand. The lower end of the fee range of 1 wei is under current circumstances economically inconsequential, but can be reached after a period of blocks consuming fewer blobs than the target. During increases in demand, the existing fee mechanism requires sustained periods of near-full blocks to re-establish equilibrium. This exacerbates spikiness in resource consumption, which can hamper efficient scaling of throughput. Furthermore, users may intermittently need to compete in a first-price auction for inclusion, degrading UX. The appropriate fee range will inadvertently vary going forward due to changes in the ETH token price and circulating supply, as well as the protocol&#x27;s ability to scale throughput. To remain neutral and future-proof, the operational range should be established relative to the long-run average fee, smoothly affecting the equilibrium quantity of blobs consumed. Thus, this EIP introduces a new fee update mechanism that accounts for the long-run average fee when responding to shifts in demand. This allows the protocol to quickly converge to desirable equilibria while also remaining neutral and future-proof.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7915&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 1.&lt;&#x2F;strong&gt; Response to various blob quantities for the proposed fee mechanism (green), the current mechanism (black), and the threshold mechanism of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7762&#x2F;&quot;&gt;EIP-7762&lt;&#x2F;a&gt; (red). The proposed mechanism smoothly converges to appropriate equilibria when demand shifts, establishing the fee relative to the long-run average base fee $\bar{f}_g$ (at 4 gwei in this example). The fee adapts faster when converging toward $\bar{f}_g$ from below than when diverging from it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Short description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EMA_DECAY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Reciprocal of the EMA decay rate (per slot)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MEAN_REVERSION_DEADBAND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fee ratio at which mean reversion effect accelerates&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MEAN_REVERSION_FULLBAND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10**6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fee ratio at which mean reversion effect stops increasing&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;functions&quot;&gt;Functions&lt;&#x2F;h3&gt;
&lt;p&gt;The function &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; is updated. A mean reversion weight &lt;code&gt;w&lt;&#x2F;code&gt; is computed based on the ratio between the long-run base fee and the current base fee. The weight influences the excess gas update by smoothly increasing the gas used and decreasing the gas target as the current base fee falls below the long-run base fee (see Figure 2 below). The variable &lt;code&gt;Up&lt;&#x2F;code&gt; upsamples &lt;code&gt;w&lt;&#x2F;code&gt; to retain precision. Note that the function applies &lt;code&gt;integer_squareroot()&lt;&#x2F;code&gt;, which must be implemented at the execution layer; it is currently implemented at the consensus layer. Thresholding at &lt;code&gt;MEAN_REVERSION_FULLBAND&lt;&#x2F;code&gt; and strategic deployment of &lt;code&gt;Up&lt;&#x2F;code&gt; allows the mechanism to rely on the &lt;code&gt;uint64&lt;&#x2F;code&gt; type internally.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute upsampled mean reversion weight w based on the EMA fee ratio&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MEAN_REVERSION_FULLBAND&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ratio&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MEAN_REVERSION_FULLBAND&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            ratio&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ratio&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MEAN_REVERSION_DEADBAND&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MEAN_REVERSION_DEADBAND&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; integer_squareroot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return excess blob gas based on adjusted gas usage and target under mean reversion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Up&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The exponential moving average (EMA) of the base fee is updated based on the previous block&#x27;s &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; and &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt; in a new function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMA_DECAY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMA_DECAY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with the &lt;code&gt;uint&lt;&#x2F;code&gt; field &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt;. For the first post-fork block, &lt;code&gt;parent.base_fee_per_blob_gas_ema&lt;&#x2F;code&gt; is evaluated as &lt;code&gt;4*10**9&lt;&#x2F;code&gt; (4 gwei).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-layer-validation&quot;&gt;Execution layer validation&lt;&#x2F;h3&gt;
&lt;p&gt;The block validity conditions on the execution layer are extended to assert that &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt; was correctly updated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that the base fee per blob gas EMA was updated correctly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_base_fee_per_blob_gas_ema&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;supply-and-demand&quot;&gt;Supply and demand&lt;&#x2F;h3&gt;
&lt;p&gt;Since the introduction of blobs, the reservation fee of the marginal consumer of blobs has periodically been very low. Whenever demand picks up, a sustained succession of near-full blocks is required to restore equilibrium, with the mechanism intermittently resorting to a first-price auction, considered a worse UX by blob consumers. The resulting spikiness in resource consumption is suboptimal for scaling blobspace. At a fundamental level, the issue is that Ethereum faces a fee-inelastic demand curve while operating a perfectly inelastic supply curve—with supply fixed at &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;. When an equilibrium forms between fee-inelastic supply and demand curves, even a small shift in aggregate demand can lead to huge shifts in the equilibrium fee. This proposal smoothly increases the elasticity of the supply curve as it diverges from the long-run average, restricting the equilibrium fee from forming much below the average. Combined with the faster fee adjustments in the direction of the average, a desirable equilibrium can then quickly be established during temporary shifts in demand.&lt;&#x2F;p&gt;
&lt;p&gt;Supply and demand are not fixed, and the appropriate equilibrium will inadvertently shift in the future due to changes in the ETH token price and circulating supply, as well as the protocol&#x27;s ability to scale throughput. To remain neutral and future-proof, the pricing mechanism should therefore operate on a relative basis, ideally then anchored to the computed long-run average.&lt;&#x2F;p&gt;
&lt;p&gt;When demand fails to meet supply, a producer can reduce the unit price or decrease the quantity supplied to re-establish equilibrium. If it sells unique goods but seeks to avoid inefficiencies from either idle capacity or excessive resource use, it can gradually reduce both, smoothly moving along its expansion path to attain the optimal equilibrium under the given demand curve. Ethereum can respond to &lt;em&gt;temporary downturns&lt;&#x2F;em&gt; in demand by gradually reducing both price &lt;em&gt;and&lt;&#x2F;em&gt; equilibrium throughput, smoothly reducing the number of consumed blobs at which the price remains fixed. This is achieved by adjusting the fee update to smoothly become less responsive to low gas usage, implicitly controlling output. Ethereum cannot respond to &lt;em&gt;sustained downturns&lt;&#x2F;em&gt; in demand by reducing throughput, because such a downturn could imply that circumstances have changed, and that the price is now &lt;em&gt;too high&lt;&#x2F;em&gt; (assuming the protocol remains neutral). To be clear, Ethereum reduces throughput already today during downturns in demand by thresholding at 1 wei. Any fixed threshold that prevents the price from falling further once reached reduces throughput by not allowing blocks with below-threshold gas usage to influence the future fee. However, an instant shift from a fixed response schedule to complete unresponsiveness under a below-target demand presumably does not reflect the protocol&#x27;s blobspace production expansion path (see also Figure 1).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-base-fee-update-schedule&quot;&gt;Proposed base fee update schedule&lt;&#x2F;h3&gt;
&lt;p&gt;The update schedule adheres to the following design principles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remain neutral and future-proof concerning changes in supply and demand.&lt;&#x2F;li&gt;
&lt;li&gt;Rely on the normal fee update schedule when the base fee is above or just slightly below the long-run average.&lt;&#x2F;li&gt;
&lt;li&gt;Smoothly adjust the fee update to become less responsive to low gas usage and more responsive to high gas usage as the ratio $\bar{f}_g&#x2F;f_g$ grows.&lt;&#x2F;li&gt;
&lt;li&gt;When the price is relatively low ($f_g&amp;lt;\bar{f}_g$), raise the fee quickly during a rise in demand and reduce it slowly during a fall in demand. In other words, add a mean reversion effect (this is closely related to the previous point).&lt;&#x2F;li&gt;
&lt;li&gt;The fee update must vary smoothly with blob quantity at all applicable $\bar{f}_g&#x2F;f_g$ ratios so that users or validators will not strategically include specific quantities of blobs in each block.&lt;&#x2F;li&gt;
&lt;li&gt;Avoid extreme responses even if the ratio $\bar{f}_g&#x2F;f_g$ diverges substantially.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A mean reversion weight is first computed&lt;&#x2F;p&gt;
&lt;p&gt;$$
w = \sqrt[8]{\frac{\bar{f}_g&#x2F;f_g + D}{D+1}},
$$&lt;&#x2F;p&gt;
&lt;p&gt;where $D$ is the constant &lt;code&gt;MEAN_REVERSION_DEADBAND&lt;&#x2F;code&gt;, set to 64. The eighth root can be computed by applying the existing (at the consensus layer) function &lt;code&gt;integer_squareroot()&lt;&#x2F;code&gt; three times. The update to the excess gas field $e_g$ for slot $n$ is then changed from&lt;&#x2F;p&gt;
&lt;p&gt;$$
e_{g(n)} = e_{g(n-1)} + c_g - t_g
$$&lt;&#x2F;p&gt;
&lt;p&gt;to&lt;&#x2F;p&gt;
&lt;p&gt;$$
e_{g(n)} = e_{g(n-1)} + c_gw - t_g&#x2F;w.
$$&lt;&#x2F;p&gt;
&lt;p&gt;Figure 2 illustrates the resulting fee update schedule when applying the blob targets from Pectra. The further the fee falls below the average, the fewer blobs must be consumed for the fee to remain fixed. This eventually leads to equilibrium being established, even under low demand. The transition is gradual, allowing for a smooth response to shifts in demand. Note that the vertical blob spacing is kept smooth at all ratios, discouraging users or validators to strategically adapt intra-block consumption of blobs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7915&#x2F;.&#x2F;assets&#x2F;2.png&quot; alt=&quot;Figure 2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 2.&lt;&#x2F;strong&gt; Proposed blob fee update schedule across the $f_g&#x2F;\bar{f}_g$ ratio under Pectra blob constants. When the ratio is around or above 1, the baseline fee update schedule is applied. When the fee falls below the average, fewer blobs must be consumed for the fee to remain fixed.&lt;&#x2F;p&gt;
&lt;p&gt;The fee schedule is computed across the range &lt;code&gt;MEAN_REVERSION_FULLBAND = 10**6&lt;&#x2F;code&gt;. Thus, if the ratio in Figure 2 falls below $10^{-6}$, the schedule at $10^{-6}$ applies. This approach protects against exploding fee schedules, allows the fee to gradually fall further if no blobs at all are consumed, and protects against overflow due to high ratios (thus allowing for the smaller &lt;code&gt;uint64&lt;&#x2F;code&gt; in the &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; function). Optionally, the operational region can also be bounded by adding a constant $c$ (set in the region of 1-2 blobs worth of gas) to the fee update schedule:&lt;&#x2F;p&gt;
&lt;p&gt;$$
e_{g(n)} = e_{g(n-1)} + c_gw - t_g&#x2F;w + c(w-1).
$$&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism only applies mean reversion when $f_g &amp;lt; \bar{f}_ g.$ While there can be benefits from mean reversion in both directions, the case when $f_g&amp;lt;\bar{f}_ g$ is far more important to address. Furthermore, the update schedule from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7691&#x2F;&quot;&gt;EIP-7691&lt;&#x2F;a&gt;, applied when $f_g \geq \bar{f}_g$, already decreases more with 0 blobs than it increases with the maximum.&lt;&#x2F;p&gt;
&lt;p&gt;A symmetrical update schedule at ratios around 1 was initially considered since the target from Pectra is not centered at &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&#x2F;2&lt;&#x2F;code&gt;. However, a well-formed symmetrical fee update schedule will likely not achieve a &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; throughput, even though it responds to a target gas consumption by keeping the fee fixed. The reason is that the fee update for blocks $x$ blobs above the target and $x$ blobs below the target will not be reciprocal. Equilibrium would therefore settle at slightly lower throughput than &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, at a slightly higher price than when relying on the assymetrical update schedule with an identical target. The proposed fee update schedule instead intermediately transitions to a symmetrical schedule as the fee ratio falls (see Figure 2).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;computing-the-long-run-average-base-fee&quot;&gt;Computing the long-run average base fee&lt;&#x2F;h3&gt;
&lt;p&gt;An average of the base fee $\bar{f}_g$ is maintained in the header variable &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt;, computed as an exponential moving average. Each slot, $\bar{f}_g$ is updated by taking&lt;&#x2F;p&gt;
&lt;p&gt;$$
\bar{f}_ {g(n)} = \bar{f}_ {g(n-1)} + \frac{f_{g(n-1)} - \bar{f}_{g(n-1)}}{m},
$$&lt;&#x2F;p&gt;
&lt;p&gt;where $m$ is a constant &lt;code&gt;EMA_DECAY=2**18&lt;&#x2F;code&gt;. This setting gives a half-life of around one month. If the &lt;code&gt;EMA_DECAY&lt;&#x2F;code&gt; is set slightly higher, the mechanism is guaranteed to influence blob pricing over the next few years. For example, initializing $\bar{f}_ g=4\times10^9$ (as proposed) and setting a half-life of four months (&lt;code&gt;EMA_DECAY=2**20&lt;&#x2F;code&gt;) ensures that $\bar{f}_ g&amp;gt;5\times10^8$ one year after activation. If the proposed mechanism is included in a hard fork that also boosts throughput, this could be seen as a bonus, given the smooth floor operating a few orders of magnitude below $\bar{f}_ g$.&lt;&#x2F;p&gt;
&lt;p&gt;Figure 3 shows how $\bar{f}_{g}$ would have evolved between November 2024 and March 2025, using $4\times10^9$ as a starting value. Note that the EMA fee could be allowed to fall below &lt;code&gt;EMA_DECAY&lt;&#x2F;code&gt; by subtracting at least 1 in each update step (this is however not part of the functionality in the specification).&lt;&#x2F;p&gt;
&lt;p&gt;The EMA is computed in the linear domain to preserve additivity and maintain interpretability. Averaging in the log-domain across excess gas (akin to a geometric mean in the linear domain) would give undue influence to fine-grained fluctuations at lower fees. This would make changes at lower gas thresholds very influential, creating feedback loops that are hard to explain and reason about; especially since the threshold at 1 wei always will be fixed and gradually could come into play over the long run due to shifts in supply or demand. However, note that while it is strictly preferred to compute the EMA in the linear domain, it would be possible to convert back to the log-domain to store and apply an excess blob gas EMA. This option is described in the next subsection.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7915&#x2F;.&#x2F;assets&#x2F;3.png&quot; alt=&quot;Figure 3&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Figure 3.&lt;&#x2F;strong&gt; Exponential moving average with the proposed settings applied to a few months of historical blob base fee data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-approach&quot;&gt;Alternative approach&lt;&#x2F;h3&gt;
&lt;p&gt;One alternative way to structure the adaptive mean reversion was referenced in the previous subsection and will be described here. It differs in that that the protocol would rely on and store a log-domain representation of &lt;code&gt;base_fee_per_blob_gas_ema&lt;&#x2F;code&gt;: &lt;code&gt;excess_blob_gas_ema&lt;&#x2F;code&gt;. The EMA computation would still be performed in the linear domain, but &lt;code&gt;get_base_fee_per_blob_gas()&lt;&#x2F;code&gt; and its inverse—relying on a new &lt;code&gt;fake_log()&lt;&#x2F;code&gt; function—would be applied during computations to first go to the linear domain and then return to the log-domain&lt;&#x2F;p&gt;
&lt;p&gt;$$
\bar{e}_ {g(n)} = \log\Biggl[\exp\bigl(\bar{e}_ {g(n-1)}\bigr) + \frac{\exp\bigl(e_ {g(n-1)}\bigr) - \exp\bigl(\bar{e}_ {g(n-1)}\bigr)}{m}\Biggr].
$$&lt;&#x2F;p&gt;
&lt;p&gt;The weight calculation in &lt;code&gt;calc_excess_blob_gas()&lt;&#x2F;code&gt; could then be performed in the log-domain, in principle:&lt;&#x2F;p&gt;
&lt;p&gt;$$
w = \frac{\bar{e}_g-e_g + D}{D+1},
$$&lt;&#x2F;p&gt;
&lt;p&gt;but where, e.g., $D$ would be adjusted according to relevant excess gas scaling for the applicable hard fork. The fee update schedule would become very similar with both approaches, and the choice thus mostly comes down to architectural preferences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The blob base fee doubles during full blocks if the current fee is several orders of magnitude below the average. As a result, a single-block delay in inclusion results in users paying twice as much, potentially influencing inclusion and fee-market strategies. However, practical implications should be limited, given that this aggressive fee schedule only operates at fees well below the average.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scaling Ethereum with a Perceptron Tree ZKP</title>
        <published>2025-03-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ryo Ha</name><uri>https://github.com/sopia19910</uri><email>sopia19910@gmail.com</email>
	</author>
	
	<author>
		<name>Khajiev Nizomjon</name><uri>https://github.com/khajievN</uri><email>nizom7812@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7911/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/improving-blockchain-scalability-using-a-perceptron-tree-based-zero-knowledge-proof-model/23196" />
        

        <id>https://wg-eips.ritovision.com/7911/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7911"
            label="EIP-7911" />
        

        
        

        
        <summary type="html">Improving Ethereum scalability and privacy using Perceptron Trees to compress transaction data via ZKP.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7911/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This project proposes a method to enhance scalability and privacy protection in the Ethereum network using a Perceptron Tree-based Zero-Knowledge Proof (ZKP) model. The Perceptron Tree, a hybrid model combining the strengths of decision trees and perceptron neural networks, provides a compressed representation for transaction relationships, facilitating efficient verification. It addresses specific drawbacks of existing zk-SNARK and zk-STARK methods, consolidating multiple transactions into a single proof to reduce gas fees and decrease on-chain verification load.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The significant increase in blockchain transactions has resulted in scalability limitations and privacy issues. Existing ZKP methods effectively validate individual transactions but fall short in analyzing inter-transaction relationships while maintaining privacy.&lt;&#x2F;p&gt;
&lt;p&gt;ZK-Rollups bundle multiple transactions off-chain into a single proof submitted to the Ethereum mainnet, improving throughput and reducing costs. However, current batching approaches verify transactions individually without leveraging inter-transaction patterns or relationships.&lt;&#x2F;p&gt;
&lt;p&gt;Existing privacy solutions generate separate ZK proofs for each transaction, limiting ZKP&#x27;s full potential. The proposed Perceptron Tree model overcomes these limitations by measuring the similarity among multiple transactions and compressing them into a unified proof, thus broadening ZKP applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;1-tree-construction&quot;&gt;1. Tree Construction&lt;&#x2F;h3&gt;
&lt;p&gt;The system inputs a transaction dataset T = {x₁, x₂, ..., xₙ} to construct a recursive tree.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Each node classifies transaction data using a perceptron with a linear function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;f(x) = step(Wₐ·a + Wᵦ·b + θ)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where the step function is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;step(z) = {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    1, if z ≥ 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, if z &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203521.png&quot; alt=&quot;Perceptron Tree ZKP Process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Tree construction recursively partitions nodes based on conditions like homogeneity (isPure) or maximum depth (maxDepth).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203546.png&quot; alt=&quot;Perceptron Tree ZKP Process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;2-relationship-similarity-calculation&quot;&gt;2. Relationship Similarity Calculation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;path-similarity&quot;&gt;Path Similarity&lt;&#x2F;h4&gt;
&lt;p&gt;Measures similarity by the ratio of shared paths between two transactions within the tree:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sim_path(xᵢ, xⱼ) = d&#x2F;D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;d = length of shared path&lt;&#x2F;li&gt;
&lt;li&gt;D = maximum depth of the tree&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203429.png&quot; alt=&quot;Path Similarity Example&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Example: If transactions x₁ and x₂ share only the root node (d=1) in a tree of depth 3, their similarity would be 1&#x2F;3 ≈ 0.33.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;vector-space-similarity&quot;&gt;Vector Space Similarity&lt;&#x2F;h4&gt;
&lt;p&gt;Uses cosine similarity calculated from the feature vectors of each transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sim_cos(xᵢ, xⱼ) = (xᵢ·xⱼ)&#x2F;(‖xᵢ‖‖xⱼ‖)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203500.png&quot; alt=&quot;Vector Similarity Example&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Example: For vectors x₁ = [0.7, 0.8] and x₂ = [0.9, 0.4], the similarity is 0.91.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-zkp-proof-generation&quot;&gt;3. ZKP Proof Generation&lt;&#x2F;h3&gt;
&lt;p&gt;The process follows five key steps:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Construct Perceptron Tree&lt;&#x2F;strong&gt;: Build a tree based on transaction set T and train perceptrons at each node.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Calculate Node Commitments&lt;&#x2F;strong&gt;: Compute a commitment value Cₙ for each node n using weights Wₙ, bias bₙ, and hashes of left&#x2F;right child nodes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Cₙ = H(Wₙ, bₙ, Cₗₑₜₜ, Cᵣᵢₑₕₜ)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Generate Path Proof&lt;&#x2F;strong&gt;: For a specific transaction xᵢ, demonstrate the classification path within the tree.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Prove Similarity Threshold&lt;&#x2F;strong&gt;: Prove that the similarity between two transactions xᵢ and xⱼ exceeds a predefined threshold θ.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Construct Final ZKP Proof&lt;&#x2F;strong&gt;: The final Zero-Knowledge Proof Π includes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Π = {Cᵣₒₒₜ, path(xᵢ), sim(xᵢ, xⱼ)}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where Cᵣₒₒₜ is the root commitment, path(xᵢ) is the path proof of xᵢ, and sim(xᵢ, xⱼ) is the similarity proof between transactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7911&#x2F;.&#x2F;assets&#x2F;20250319_203626.png&quot; alt=&quot;ZKP Generation Process&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;4-on-chain-verification&quot;&gt;4. On-chain Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contracts verify the submitted proof (Π) by checking:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The Cᵣₒₒₜ commitment matches the pre-registered tree root hash&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The transaction xᵢ is correctly classified along the provided path(xᵢ)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The similarity between two transactions meets the predefined threshold θ&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Perceptron Tree-based ZKP model extends the capabilities of existing zero-knowledge proof techniques by incorporating transaction relationships into the proof structure. Traditional zk-SNARK and zk-STARK methods validate individual transactions but do not leverage inter-transaction similarity, which can lead to inefficiencies.&lt;&#x2F;p&gt;
&lt;p&gt;By structuring transactions using a Perceptron Tree, this model enables compression of multiple transactions into a single proof,
reducing gas fees and improving on-chain verification efficiency. The use of a perceptron-based decision structure
ensures adaptability to various transaction patterns, making it a scalable solution for Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal operates at the smart contract level, requiring no modifications to the existing Ethereum protocol or consensus algorithm.
It can be implemented alongside existing transaction verification methods, allowing optional adoption without network upgrades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Privacy Protection&lt;&#x2F;strong&gt;: Verifies transaction validity without revealing specific transaction details.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Tamper Resistance&lt;&#x2F;strong&gt;: Uses commitment values based on tree structures and weights to detect data tampering.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Replay Attack Prevention&lt;&#x2F;strong&gt;: Includes unique transaction IDs in proofs to avoid replay attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Lightweight Verification&lt;&#x2F;strong&gt;: Ensures efficient, simple proof verification operations within smart contracts, minimizing gas fees.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Meter Contract Code Size And Increase Limit</title>
        <published>2025-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Matt</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Dragan Rakita</name><uri>https://github.com/rakita</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7907/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-remove-contract-size-limit/23156" />
        

        <id>https://wg-eips.ritovision.com/7907/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7907"
            label="EIP-7907" />
        

        
        

        
        <summary type="html">Increases the contract code size limit introduced in EIP-170 and adds gas metering to code loading</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7907/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP increases the contract code size limit from 24KB (24576 bytes) introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; to 64KB (65536 bytes), and adds gas metering for excess code loading. It introduces a gas cost of 2 gas per (32 byte) word for contract code exceeding 24KB, allowing deployment of contracts of any size while preventing DoS attacks through appropriate gas metering. Lastly, it also commensurately increases initcode size limit from 48KB, introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;, to 128KB (131072 bytes).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-170 introduced a 24KB contract code size limit to prevent potential DoS attacks, as large contract code requires O(n) resource cost in terms of disk reads, VM preprocessing, and Merkle proof sizes, all of which are not directly compensated by gas fees. However, this limit restricts legitimate use cases for large contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a gas-based solution that allows contracts of larger size while ensuring that users loading large contracts pay gas proportional to the additional resources they consume. This approach aligns with Ethereum&#x27;s gas model philosophy of paying for the resources consumed. A new limit has been set at 64KB, so that raising the gas limit does not break assumptions in the p2p layer.&lt;&#x2F;p&gt;
&lt;p&gt;Improving developer experience is the primary motivation for increasing the contract size limit. The current 24KB ceiling forces developers to split functionality across multiple contracts, introduce proxies or delegatecall-based indirection, and rely on architectural patterns like the Diamond Standard—even when those patterns aren&#x27;t otherwise necessary. These workarounds can increase code complexity, deployment costs, and audit surface. By raising the limit, developers can keep more logic in a single contract, improving readability and lowering gas usage by avoiding unnecessary cross-contract calls. This also makes smart contract development more accessible to newer developers, who can move from idea to deployment without first learning advanced contract composition patterns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged for cold loading storage as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged for loading warm storage as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged for loading a cold account as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PER_CODE_WORD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The cost charged per word of code loaded beyond the initial &lt;code&gt;24KB&lt;&#x2F;code&gt; amount.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;The block number of the hard fork that this EIP is activated.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following values are updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Old Value&lt;&#x2F;th&gt;&lt;th&gt;New Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;24KB (&lt;code&gt;0x6000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;64KB (&lt;code&gt;0x10000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;The maximum size for code as set in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;48KB (&lt;code&gt;0xc000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;128KB (&lt;code&gt;0x20000&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;td&gt;The maximum size for code as set in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;. Always set at &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ceil32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; excess_code_size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; introduced &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; constant of 24KB (&lt;code&gt;0x6000&lt;&#x2F;code&gt; bytes) to 64KB (&lt;code&gt;0x10000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;li&gt;Introduces a new cold&#x2F;warm state for contract code. Specifically, change the gas schedule of operations that load code, e.g. the opcodes &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; are modified so that dynamic &lt;code&gt;EXCESS_CODE_COST= ceil32(excess_code_size(len(code))) * GAS_PER_CODE_WORD &#x2F;&#x2F; 32&lt;&#x2F;code&gt; gas are added to the access cost if the code is cold. When the code is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation to another account, if target account code is cold add additional gas should be accounted. Warming of the contract code is subjected to the journaling and can be reverted similar to other state warming in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; introduced &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; limit of 48KB (&lt;code&gt;0xc000&lt;&#x2F;code&gt; bytes) to 128KB (&lt;code&gt;0x10000&lt;&#x2F;code&gt; bytes).&lt;&#x2F;li&gt;
&lt;li&gt;If a large contract is the entry point of a transaction, the cost calculated in (2) is charged before the execution and contract code is marked as warm. This fee is not calculated towards the initial gas fee. In case of out-of-gas halt, execution will stop and the balance will not be transferred.&lt;&#x2F;li&gt;
&lt;li&gt;Empty code ( with &lt;code&gt;keccak(&quot;&quot;) = &quot;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&quot;&lt;&#x2F;code&gt;) is always considered warm.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Contract&lt;&#x2F;th&gt;&lt;th&gt;Gas changes (only opcodes that load code)&lt;&#x2F;th&gt;&lt;th&gt;How?&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Cold account and code&lt;&#x2F;td&gt;&lt;td&gt;Add &lt;code&gt;COLD_SLOAD_COST=2100&lt;&#x2F;code&gt;, &lt;code&gt;EXCESS_CODE_COST&lt;&#x2F;code&gt;, and &lt;code&gt;COLD_ACCOUNT_ACCESS_COST=2600&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Contract not in access list nor accessed prior in the txn&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Warm account and cold code&lt;&#x2F;td&gt;&lt;td&gt;Add &lt;code&gt;COLD_SLOAD_COST=2100&lt;&#x2F;code&gt;, &lt;code&gt;EXCESS_CODE_COST&lt;&#x2F;code&gt;, and &lt;code&gt;WARM_STORAGE_READ_COST=100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already accessed balance, storage, or included in access list (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Warm account and code&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST=100&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Already accessed account code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;, &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;, and &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; are defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;#parameters&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;migration&quot;&gt;Migration&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP adds a new field to the account tuple, &lt;code&gt;codesize&lt;&#x2F;code&gt;. That is, the account tuple goes from having the following four fields, &lt;code&gt;(nonce, balance, storage_root, code_hash)&lt;&#x2F;code&gt; to &lt;code&gt;(nonce, balance, storage_root, code_hash, codesize)&lt;&#x2F;code&gt;. The reason for this is that most key-value databases in use by production clients do not allow peeking at the size of a value pointed to by a given key without actually loading the full contents of the value.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid forcing a full migration, the following rules are followed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any account created or updated on or after &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; should additionally have its codesize written into the account tuple.&lt;&#x2F;li&gt;
&lt;li&gt;Any account which does not have the &lt;code&gt;codesize&lt;&#x2F;code&gt; field is assumed to have codesize less than 24KB.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The gas cost of 2 per word was chosen to account for:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The additional disk I&#x2F;O for retrieving larger contract code&lt;&#x2F;li&gt;
&lt;li&gt;The increased computational resources for preprocessing larger code for execution (a.k.a. &quot;JUMPDEST analysis&quot;).&lt;&#x2F;li&gt;
&lt;li&gt;The growth in Merkle proof sizes for blocks containing larger contracts&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP introduces the gas cost as an additional cost for contracts exceeding 24KB. It could have been specified as a simpler &lt;code&gt;ceil32(contract_size) * GAS_PER_CODE_WORD &#x2F;&#x2F; 32&lt;&#x2F;code&gt;, without hardcoding the existing contract size limit. However, for the sake of being conservative and avoiding lowering the cost of loading existing contracts (which could be small, under the 24KB limit), the 24KB floor was added to the formula.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; opcode could theoretically be exempt from this, since clients could just load the parts of the bytecode which are actually requested. However, this might require a change at the protocol level, since the full code is required for the block witness. For this reason, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; is included in the pricing scheme, and a carveout could be considered at a later date.&lt;&#x2F;p&gt;
&lt;p&gt;The new limit has been set at 64KB. The limit has been put in place so that increasing the gas limit won&#x27;t have unexpected side effects at the db or p2p layer. For instance, in devp2p, the maximum packet size is 10MB (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;5713591d0366da78a913a811c7502d9ca91d29a8&#x2F;caps&#x2F;eth.md#basic-operation&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;5713591d0366da78a913a811c7502d9ca91d29a8&#x2F;caps&#x2F;eth.md#basic-operation&lt;&#x2F;a&gt;). As of time of this writing, the maximum packet size in snap sync is even lower, at 96KB.&lt;&#x2F;p&gt;
&lt;p&gt;The limit for initcode has also been increased to 128KB, following the pattern set in EIP-3860 that the initcode limit is double the runtime code limit. While initcode is different from deployed code in that it does not live in the state and therefore isn&#x27;t visible in devp2p or in the db, fully removing the limit could have unforeseen consequences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces additional gas costs for certain operations. Specifically, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; may now require extra gas when accessing cold contract code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove Initcode Size Limit</title>
        <published>2025-03-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7903/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/remove-initcode-size-limit/23066" />
        

        <id>https://wg-eips.ritovision.com/7903/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7903"
            label="EIP-7903" />
        

        
        

        
        <summary type="html">Removes the initcode size limit introduced in EIP-3860</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7903/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the removal of the &lt;code&gt;initcode&lt;&#x2F;code&gt; size limit of 49152 bytes introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;. The restriction complicates deploying multiple contracts addressing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; limit (24576 bytes) within a single transaction, while the existing gas metering for &lt;code&gt;initcode&lt;&#x2F;code&gt;, already ensures fair &lt;code&gt;initcode&lt;&#x2F;code&gt; costing, including for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP-3860 &lt;code&gt;initcode&lt;&#x2F;code&gt; size limit imposes an unnecessary constraint on deployment patterns, particularly for creation transactions creating large &lt;em&gt;logical&lt;&#x2F;em&gt; contracts composed of multiple &lt;em&gt;physical sub-contracts&lt;&#x2F;em&gt; in a single transaction.
A key argument for retaining EIP-170&#x27;s 24KB runtime code limit is that high-level languages (HLLs) should abstract it away.
However, the EIP-3860 limit prevents HLLs from cleanly abstracting this, as deploying large logical contracts exceeding 49152 bytes of &lt;code&gt;initcode&lt;&#x2F;code&gt; requires splitting into multiple transactions, undermining the abstraction.&lt;&#x2F;p&gt;
&lt;p&gt;Removing the cap simplifies smart contract deployment and enables HLLs to cleanly abstract large contracts, without compromising network security or cost attribution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Revert the &lt;code&gt;initcode&lt;&#x2F;code&gt; size limit introduced in EIP-3860. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the 49152-byte cap on &lt;code&gt;initcode&lt;&#x2F;code&gt; size during contract creation.&lt;&#x2F;li&gt;
&lt;li&gt;Retain existing gas costs for &lt;code&gt;initcode&lt;&#x2F;code&gt; execution, including the 2 gas per byte for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis, as defined in EIP-3860.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;No changes to deployed contract size limits (EIP-170) or gas schedules beyond removing the size restriction are proposed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is driven by the need to restore flexibility in contract deployment patterns, such as factory contracts creating multiple sub-contracts in one transaction. The design decision to remove the 49152-byte cap leverages the pre-existing gas metering system, which scales linearly with &lt;code&gt;initcode&lt;&#x2F;code&gt; size (i.e., 2 gas per byte), ensuring fair cost attribution without artificial limits.&lt;&#x2F;p&gt;
&lt;p&gt;A key justification for EIP-170&#x27;s 24576-byte limit is that high-level languages (HLLs) should abstract it away. However, EIP-3860&#x27;s &lt;code&gt;initcode&lt;&#x2F;code&gt; cap undermines this by forcing multi-transaction deployments for large contracts, breaking the abstraction HLLs aim to provide. Removing the cap aligns with this philosophy by enabling single-transaction deployments.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative designs, such as increasing the cap (e.g., to 98304 bytes), were considered but rejected as arbitrary; gas metering already mitigates resource concerns. The per-block gas limit already naturally restricts &lt;code&gt;initcode&lt;&#x2F;code&gt; (at the current gas limit of 35 million, &lt;code&gt;initcode&lt;&#x2F;code&gt; is restricted to ~16mb). Furthermore, initcode has additional implied costs - it must have already been paid for via calldata or memory expansion, limiting it even more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is fully backwards compatible. Existing contracts and transactions remain unaffected, as the proposal only lifts a restriction without altering execution semantics or gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No new security risks are introduced. The current gas schedule already mitigates denial-of-service concerns by charging per-byte for &lt;code&gt;initcode&lt;&#x2F;code&gt;. Benchmarks were performed, and ns&#x2F;byte remained consistent across a range of different bytecodes, ranging from 128 bytes to 15MB.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uncouple execution payload from beacon block</title>
        <published>2025-03-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7898/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/uncouple-execution-payload-from-beacon-block/23029" />
        

        <id>https://wg-eips.ritovision.com/7898/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7898"
            label="EIP-7898" />
        

        
        

        
        <summary type="html">Separates the execution payload from beacon block to independently transmit them</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7898/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the beacon block in Ethereum Consensus embeds transactions within the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; field of &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;. This EIP proposes to replace &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; with &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; in &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; and to independently transmit &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, this EIP makes no change to the block import mechanism, with the exception that block availability now includes waiting for the availability of &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;, making it different and simpler from proposals like ePBS&#x2F;APS.&lt;&#x2F;p&gt;
&lt;p&gt;But this availability requirement can in fact be restricted to &lt;code&gt;gossip&lt;&#x2F;code&gt; import while allowing optimistic syncing of the execution layer (EL) on checkpoint&#x2F;range sync as EL can pull full blocks from their peers in optimistic sync as they do now.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum protocol has an ambitious goal to grow the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; of the execution payloads (possibly by 10X). This leads to larger messages, negatively affecting the networking and block processing pipelines of the consensus layer (CL) clients leading to following issues:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Higher latencies for the arrival of beacon blocks increase, requiring larger bandwidth resources to be made available for the beacon node.&lt;&#x2F;li&gt;
&lt;li&gt;The greater number and size of transactions directly increase the merkelization compute time, increasing the import time of the block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We know from timing games that the block import latency greatly affects a client&#x27;s performance to make correct head attestations. With this EIP, block transmission and block import processes will be decongested, allowing for greater flexibility in receiving a larger &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;, while the beacon block can simultaneously undergo processing.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, EL clients can also independently participate in forwarding and receiving larger execution blocks. That mechanism however can be independently developed and is out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Additional benefits obtained from this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Consensus clients don&#x27;t need to store and serve blocks with transactions, providing greater efficiency and reduced resource requirements for running a beacon node.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer-builder separation (PBS) pipeline becomes more efficient by the proposer transmitting the signed block directly to the p2p network, while submitting to the builder&#x2F;relay for the independent reveal of the &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In the future with zero-knowledge (ZK) proof of the EL block execution, nodes could treat the transactions similarly to blobs which leverage data availability sampling (DAS) mechanisms for available data without requiring re-execution of transactions to establish validity. Hence the L1 execution could itself become a rollup by alleviating the need to import all transaction data by a node.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Furthermore CL clients apis and code path will become cleaner and more maintainable because of collapse of blinded and full versions (like &lt;code&gt;BlindedBeaconBlock&lt;&#x2F;code&gt;, &lt;code&gt;BlindedBeaconBlockBody&lt;&#x2F;code&gt;) into same types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; in the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; is replaced by &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; is computed by the block proposer&#x2F;builder and gossiped independently on a separate new topic. Also builder &lt;code&gt;submitBlindedBlock&lt;&#x2F;code&gt; api is modified to respond with &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; instead.&lt;&#x2F;li&gt;
&lt;li&gt;Data availability checks for block import into forkchoice now must wait for availability of the corresponding &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; but only for gossiped blocks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;newPayloadHeader&lt;&#x2F;code&gt; engine api is introduced to augment the previous usage of &lt;code&gt;newPayload&lt;&#x2F;code&gt; in block processing when &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; is not available for e.g. in processing range synced blocks signaling EL clients to optimistic sync those payloads from EL p2p network.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ELs can optionally introduce a &lt;code&gt;getExecutionPayload&lt;&#x2F;code&gt; method (similar to &lt;code&gt;getBlobs&lt;&#x2F;code&gt;) to assist with faster recovery of execution payload from the EL&#x27;s p2p network peers who could announce new payload hashes when they see new &lt;code&gt;VALID&lt;&#x2F;code&gt; payloads. However, as noted above, that mechanism could be independently specified and is out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;&amp;lt;-- TODO: add spec details --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There is another choice we could have made to go for &lt;code&gt;SignedExecutionPayload&lt;&#x2F;code&gt; instead of &lt;code&gt;ExecutionPayloadWithInclusionProof&lt;&#x2F;code&gt; and having a &lt;code&gt;SignedExecutionPayloadHeader&lt;&#x2F;code&gt; with builder signing these messages (validator is the builder in local block building). But without builder enshrinement tight gossip validation of &lt;code&gt;SignedExecutionPayload&lt;&#x2F;code&gt; would be an issue and could become a DOS vector.&lt;&#x2F;p&gt;
&lt;p&gt;The benefit of &lt;code&gt;SignedExecutionPayload&lt;&#x2F;code&gt; design is that it could be transmitted ahead of even the &lt;code&gt;SignedExecutionPayloadHeader&lt;&#x2F;code&gt; inclusion in beacon block and is especially useful in PBS pipeline where the proposal to builder&#x2F;relay latency can be reduced significantly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change isn&#x27;t backward compatible and a new hardfork is required to activate this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&amp;lt;-- TODO --&amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restricted Behavior Transaction Type</title>
        <published>2025-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7906/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-restricted-behavior-transaction-type/23130" />
        

        <id>https://wg-eips.ritovision.com/7906/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7906"
            label="EIP-7906" />
        

        
        

        
        <summary type="html">A transaction type that provides a way for senders to restrict the outcomes of their execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7906/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal allows the transaction payload to define write protections for balances and storage slots that are enforced at the protocol level. These protected transactions empower Ethereum users to restrict the behavior of the deployed on-chain smart contracts without needing to perform a deep analysis of their EVM bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The total value of crypto assets that have been stolen to date exceeds the yearly GDP of a medium-sized nation. This level of loss and waste is indefensible and has a long list of negative consequences for everyone involved.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, one of the major ways in which Ethereum users end up losing their funds is not exposing private keys, but instead being tricked into signing transactions that appear innocent in their Wallet applications but in practice perform a complete sweep of the senders&#x27; assets.&lt;&#x2F;p&gt;
&lt;p&gt;The ability of an average user or a Wallet application to find, collect, review, and analyze the EVM code the transaction will execute is very limited.&lt;&#x2F;p&gt;
&lt;p&gt;This leaves the users with no mechanism to enforce any restrictions on what the transaction actually does once it is signed. This leads users to perform blind signing in order to interact with Ethereum, exposing them to significant and avoidable risks.&lt;&#x2F;p&gt;
&lt;p&gt;By providing the Wallets and dApps with the ability to restrict the possible &lt;strong&gt;outcomes&lt;&#x2F;strong&gt; of a transaction, we create a tool that users and wallets will apply to reduce their risk levels.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;RESTRICTED_TX_COST&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;TRACE_CALL_GAS_COST&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GET_TRACE_CALL_ADDRESS&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction, &quot;restricted execution transaction&quot;, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, value, calldata, access_list, authorization_list, asserter_address, asserter_data, asserter_gas_limit, signature_y_parity, signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;asserter_address&lt;&#x2F;code&gt; - the address of an existing contract that will be called for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7906&#x2F;#assertion-frame&quot;&gt;Assertion Frame&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;asserter_data&lt;&#x2F;code&gt; - the data to be passed as a call data to the Assertion Frame. In case the &lt;code&gt;asserter_address&lt;&#x2F;code&gt; is not set, this field acts as a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7906&#x2F;#one-time-restrictions-code&quot;&gt;One-Time Restrictions Code&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;asserter_gas_limit&lt;&#x2F;code&gt; - the gas limit provided to the asserter call frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;one-time-restrictions-code&quot;&gt;One-Time Restrictions Code&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;asserter_address&lt;&#x2F;code&gt;, &lt;code&gt;asserter_data&lt;&#x2F;code&gt; and &lt;code&gt;asserter_gas_limit&lt;&#x2F;code&gt; fields behave similarly to the &lt;code&gt;destination&lt;&#x2F;code&gt;, &lt;code&gt;calldata&lt;&#x2F;code&gt; and &lt;code&gt;gas_limit&lt;&#x2F;code&gt; fields in existing transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;asserter_address&lt;&#x2F;code&gt; value is not set, the &lt;code&gt;asserter_data&lt;&#x2F;code&gt; is loaded and executed as &lt;code&gt;asserter_code&lt;&#x2F;code&gt;. This is similar to the &lt;code&gt;init_code&lt;&#x2F;code&gt; parameter logic of a legacy transaction type.&lt;&#x2F;p&gt;
&lt;p&gt;This code is executed in a static context and cannot modify the blockchain state, set contract code or deploy new contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;assertion-frame&quot;&gt;Assertion Frame&lt;&#x2F;h3&gt;
&lt;p&gt;After the transaction execution frame is finished without reverting, the &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; transactions MUST also successully execute a second execution frame. This frame runs in a static context and cannot modify storage or emit logs.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this frame is to execute the state change assertions as prescribed by the &lt;code&gt;asserter_address&lt;&#x2F;code&gt; and &lt;code&gt;asserter_data&lt;&#x2F;code&gt; parameters.&lt;&#x2F;p&gt;
&lt;p&gt;In case of a revert in the Assertion Frame, the entire transaction is reverted.&lt;&#x2F;p&gt;
&lt;p&gt;The gas costs in the Assertion Frame are charged same as in the regular execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-restrictions-assertion-frame&quot;&gt;Execution Restrictions Assertion Frame&lt;&#x2F;h3&gt;
&lt;p&gt;There are a number of parameters that constitute the core of the transaction&#x27;s execution restriction. These parameters are joined together and RLP encoded as part of the transaction payload. There are no additional costs associated with providing this parameter other than its gas cost equivalent to &lt;code&gt;calldata&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In case any of the specified restrictions is violated, the entire transaction MUST &lt;strong&gt;revert on-chain&lt;&#x2F;strong&gt; and its gas MUST be paid until the point of the restriction violation.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction is considered to be a valid transaction that can be included in a block and pays its own gas regardless of the contents of the &lt;code&gt;execution_restrictions&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-trace-precompile&quot;&gt;Transaction Trace Precompile&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a precompile at address &lt;code&gt;GET_TRACE_CALL_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When called in a regular execution frame, the call returns a full stack trace of the current frame up to this point.&lt;&#x2F;p&gt;
&lt;p&gt;When called in the Assertion Frame, the call returns a full stack trace of the entire transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The format of the returned transaction stack trace is described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7906&#x2F;#transaction-trace-data-structure&quot;&gt;Transaction Trace Data Structure&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-trace-data-structure&quot;&gt;Transaction Trace Data Structure&lt;&#x2F;h3&gt;
&lt;p&gt;The stack trace is represented as an ABI encoding of the following struct:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Trace&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Call&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; target&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Balance&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; balances&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  CodeHash&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; codeHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  OpCode&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; opCodes&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Call&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; calls&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Storage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; slotId&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; oldValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; newValue&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Balance&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; oldBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint256&lt;&#x2F;span&gt;&lt;span&gt; newBalance&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CodeHash&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  address&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt; newCodeHash&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; OpCode&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint8&lt;&#x2F;span&gt;&lt;span&gt; opCode&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt; params&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;opcodes-traced&quot;&gt;Opcodes Traced&lt;&#x2F;h4&gt;
&lt;p&gt;Including all opcodes called during a transaction execution in the stack trace is not practical. Instead, only the following opcodes with potentially dangerous non-local effects are reported as part of the &lt;code&gt;opCodes&lt;&#x2F;code&gt; field:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xFF&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF4&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xF2&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xFA&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xFA&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG&lt;&#x2F;code&gt; (&lt;code&gt;0xA0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG1&lt;&#x2F;code&gt; (&lt;code&gt;0xA1&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG2&lt;&#x2F;code&gt; (&lt;code&gt;0xA2&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG3&lt;&#x2F;code&gt; (&lt;code&gt;0xA3&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LOG4&lt;&#x2F;code&gt; (&lt;code&gt;0xA4&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REVERT&lt;&#x2F;code&gt; (&lt;code&gt;0xFD&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INVALID&lt;&#x2F;code&gt; (&lt;code&gt;0xFE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;KECCAK256&lt;&#x2F;code&gt; (&lt;code&gt;0x20&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-transaction-type-and-assertion-frame&quot;&gt;New Transaction Type and Assertion Frame&lt;&#x2F;h3&gt;
&lt;p&gt;One of the main advantages of a new Transaction Type for the Restricted Behaviour feature is the ability to protect all existing EOAs, and not just smart accounts. This makes it preferable to introduce a new Transaction Type instead of any other approach that would only work for smart contract accounts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-trace-precompile-behaviour&quot;&gt;Transaction Trace Precompile Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;It is important for us to provide the same protection level to both EOAs and Smart Accounts. The Smart Accounts are not able to initiate a &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; transaction themselves, and instead need to rely on checks performed during the regular execution frame of any transaction type.&lt;&#x2F;p&gt;
&lt;p&gt;By exposing the &lt;code&gt;GET_TRACE_CALL_ADDRESS&lt;&#x2F;code&gt; precompile at all times, we allow any smart contract to perform the state change assertions it may need to ensure safety and security.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deployable-and-one-time-restrictions-code&quot;&gt;Deployable and One-Time Restrictions Code&lt;&#x2F;h3&gt;
&lt;p&gt;In some scenarios, the wallets are likely to want to apply the exact same transaction behaviour to all transactions they initiate.&lt;&#x2F;p&gt;
&lt;p&gt;In this case, it is reasonalbe and more efficient to deploy the assertions on-chain as a smart contract module, and provide its address and the inputs it may need.&lt;&#x2F;p&gt;
&lt;p&gt;However, it is possible that the wallet may want to prepare the restrictions for the transaction dynamically. In that case, there is no benefit in having the assertion code permanently deployed, and it is more efficient to provide such code as part of the transaction payload. Luckily, the EVM already has a very similar behaviour defined for the &lt;code&gt;init_code&lt;&#x2F;code&gt; field, and it appears to fit the task perfectly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal describes a new transaction type that should not affect the functionality of existing systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;correct-wallet-ui-presentation&quot;&gt;Correct Wallet UI presentation&lt;&#x2F;h3&gt;
&lt;p&gt;Successfull use of the &lt;code&gt;RESTRICTED_EXECUTION_TX_TYPE&lt;&#x2F;code&gt; transaction type requires the wallets to be abile to correctly understand and present the restrictions imposed on the transaction to the users.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets will need to be able to understand the meaning of the state changes being permitted by the transaction. This requires wallets to be aware of all major ERC standards, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt;. In many cases, this also requires the wallets to be able to fetch and analyze the source code of the executed contracts.&lt;&#x2F;p&gt;
&lt;p&gt;However, the introduction of the Execution Restrictions feature significantly streamlines the process by removing the need for a deep understanding of the executed &lt;strong&gt;code&lt;&#x2F;strong&gt;. Instead, only high-level information about the stack traces&#x27; meaning is required for a clear and safe representation of possible transaction outcomes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;insufficiently-restrictive-transactions&quot;&gt;Insufficiently Restrictive Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;The worst outcome of introducing a security feature is creating a false sense of security for its user.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets are expected to provide the behaviour restriction logic that protects their users&#x27; valuable assets.&lt;&#x2F;p&gt;
&lt;p&gt;It is critical that dApps, wallets, and users become educated about the consequences of not limiting their transactions&#x27; execution with sufficient strictness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Emit log on revert</title>
        <published>2025-02-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Shoham Chakraborty</name><uri>https://github.com/shohamc1</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7889/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7889-emit-log-on-revert/22918" />
        

        <id>https://wg-eips.ritovision.com/7889/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7889"
            label="EIP-7889" />
        

        
        

        
        <summary type="html">Top level reverts emit a log with revert message</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7889/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;All calls to the REVERT opcode with non-zero size must emit a log with revert data, making it accessible via standard RPC without the need for tracing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Revert messages are currently inaccessible to users as they are not available via standard RPC. Instead, users have to request a node to trace the transaction and check the stack and memory at the moment when the REVERT opcode was executed.&lt;&#x2F;p&gt;
&lt;p&gt;This introduces overhead for users and nodes - users must make an additional request to find out why their transaction failed, and the node has to replay the full transaction (which may be slow and computationally expensive) to get back a relatively small piece of data.&lt;&#x2F;p&gt;
&lt;p&gt;Currently it is up to smart wallet developers to emit logs before a revert, however this is not a standard feature and thus cannot be relied upon by tools such as client libraries and block explorers. Making this log part of the protocol allows these tools to rely on logs for revert reasons.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;!-- TODO --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;REVERTTOPIC&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA_LIMIT&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;functionality&quot;&gt;Functionality&lt;&#x2F;h3&gt;
&lt;p&gt;Whenever &lt;code&gt;REVERT&lt;&#x2F;code&gt; is called with non-zero size, emit a log identical to a LOG1 with the topic &lt;code&gt;REVERTTOPIC&lt;&#x2F;code&gt;. The log data is the raw bytes of the revert message. The data is truncated to &lt;code&gt;DATA_LIMIT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is the simplest possible implementation that allows revert messages to be accessible via RPC methods. It does not require any changes to client libraries, or other RPC consumers as it is backward compatible. It does not introduce new RPC methods or new opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Reverted transactions may now contain up to one log.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Reverted transactions must cost at least intrinsic gas (21000 gas), which is much more expensive than the LOG1 opcode (750 gas). Hence, this EIP does not introduce any new avenues to inflate Ethereum storage requirements. However, it is expected to increase the average number of logs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delayed execution</title>
        <published>2025-02-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7886/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7886-delayed-execution/22890" />
        

        <id>https://wg-eips.ritovision.com/7886/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7886"
            label="EIP-7886" />
        

        
        

        
        <summary type="html">Separate block validation from execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7886/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a mechanism to make execution blocks statically verifiable through minimal checks that only require the previous state, without requiring execution of the block&#x27;s transactions. This enables validators to attest to a block&#x27;s validity without completing its execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The primary advantage of this proposal is &lt;strong&gt;asynchronous block validation&lt;&#x2F;strong&gt;. In the current Ethereum protocol, blocks must be fully executed before validators can attest to them. This requirement creates a bottleneck in the consensus process, as attestors must wait for execution results before committing their votes, limiting the network&#x27;s throughput potential.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing a mechanism where execution payloads can be reverted rather than invalidating the entire block, execution is no longer an immediate requirement for validation. Instead, a block&#x27;s validity can be determined based on its structural correctness and the upfront payment of transaction fees by senders. This allows attestation to happen earlier in the slot, independent of execution, potentially enabling higher block gas limits and significant throughput improvements across the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;header-changes&quot;&gt;Header Changes&lt;&#x2F;h3&gt;
&lt;p&gt;The block header structure is extended to support delayed execution:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommers_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-execution state root - this is the state root before executing transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pre_state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deferred execution outputs from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transaction root from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;         #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receipt root from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;               #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logs bloom from parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Hash of requests from the parent block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates if parent block&amp;#39;s execution was reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Other existing fields&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Declared gas used by txs, validated post-execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;               #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Total blob gas used by transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The key changes are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pre_state_root&lt;&#x2F;code&gt;: Represents the state root before execution (checked against the post-execution state of the parent block)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_receipt_root&lt;&#x2F;code&gt;: Receipt root from the parent block (deferred execution output)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_bloom&lt;&#x2F;code&gt;: Logs bloom from the parent block (deferred execution output)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_requests_hash&lt;&#x2F;code&gt;: Hash of requests from the parent block (deferred execution output)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;parent_execution_reverted&lt;&#x2F;code&gt;: Indicates whether the parent block&#x27;s execution was reverted&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A block header MUST include all these fields to be considered valid under this EIP. The &lt;code&gt;pre_state_root&lt;&#x2F;code&gt; MUST match the state root after applying the parent block&#x27;s execution. The parent execution outputs MUST accurately reflect the previous block&#x27;s execution results to maintain chain integrity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-state-tracking&quot;&gt;Chain State Tracking&lt;&#x2F;h3&gt;
&lt;p&gt;The blockchain object is extended to track execution outputs for verification in subsequent blocks:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Block&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Transaction root from the last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;         #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Receipt root from last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_block_logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Logs bloom from last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;       #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Requests hash from last executed block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Indicates if the last block&amp;#39;s execution was reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These additional fields are used to verify the deferred execution outputs claimed in subsequent blocks. The &lt;code&gt;last_transactions_root&lt;&#x2F;code&gt;, &lt;code&gt;last_receipt_root&lt;&#x2F;code&gt;, &lt;code&gt;last_block_logs_bloom&lt;&#x2F;code&gt;, &lt;code&gt;last_requests_hash&lt;&#x2F;code&gt;, and &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt; act as critical chain state references that MUST be updated after each block execution to ensure proper state progression. When a block&#x27;s execution is reverted due to a gas mismatch, the &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt; field is set to &lt;code&gt;True&lt;&#x2F;code&gt;, which affects the base fee calculation of subsequent blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validation&quot;&gt;Block Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Static validation is performed separately from execution. In this phase, all checks that can be done without executing transactions are performed:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate header against parent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate deferred execution outputs from the parent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_transactions_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_receipt_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_bloom&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_block_logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_requests_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pre_state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; state_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process all transactions trie and validate transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_inclusion_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track sender balances and nonces by address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_balances&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_nonces&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate blob gas price based on excess blob gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_blob_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate each transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate transaction parameters (signature, fees, etc.)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validate_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recover sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recover_sender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate gas costs (both EIP-7623 intrinsic cost and floor cost)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_intrinsic_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track total gas usage (using the maximum of intrinsic gas and floor cost)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        total_inclusion_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; calldata_floor_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        total_blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate maximum gas fee (including blob fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sender is an EOA or has delegation support&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; sender_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; sender_balances&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_sender_eoa&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytearray&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                or&lt;&#x2F;span&gt;&lt;span&gt; is_valid_delegation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_sender_eoa&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sender_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sender_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sender has sufficient balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; sender_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify correct nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; sender_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track balance and nonce changes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender_balances&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sender_nonces&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;sender_address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate gas constraints&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; total_inclusion_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; total_blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate withdrawals trie&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; wd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        trie_set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;wd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_trie&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This validation function enforces several requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Clients MUST validate that the block&#x27;s parent execution outputs match the chain&#x27;s tracked last execution outputs.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;pre_state_root&lt;&#x2F;code&gt; MUST match the current state root to ensure proper state transition.&lt;&#x2F;li&gt;
&lt;li&gt;All transactions MUST be statically validated for signature correctness and transaction type-specific requirements (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, etc.).&lt;&#x2F;li&gt;
&lt;li&gt;Sender accounts MUST be externally owned accounts (EOAs) or have valid delegation support (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Senders MUST have sufficient balance to cover maximum possible gas fees plus transaction value.&lt;&#x2F;li&gt;
&lt;li&gt;Transaction nonces MUST be correct and sequential per sender.&lt;&#x2F;li&gt;
&lt;li&gt;Total inclusion gas (using the maximum of intrinsic gas and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor cost) MUST not exceed the block&#x27;s declared gas_used.&lt;&#x2F;li&gt;
&lt;li&gt;Total blob gas MUST match the declared blob_gas_used.&lt;&#x2F;li&gt;
&lt;li&gt;Withdrawal trie root MUST match its respective header field.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When calculating inclusion gas, the implementation uses the maximum of the regular intrinsic gas cost and the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; calldata floor cost, which ensures proper accounting for calldata gas regardless of execution outcome.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-execution-with-state-snapshots&quot;&gt;Block Execution with State Snapshots&lt;&#x2F;h3&gt;
&lt;p&gt;After a block passes static validation, execution proceeds with the pre-charged transaction senders:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    block_env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockEnvironment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;LegacyTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockOutput&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockOutput&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process system transactions first (beacon roots, history storage)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_system_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        target_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_system_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        target_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_hashes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The parent hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process user transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process withdrawals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process requests (deposits, withdrawals, consolidations)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; not generated if execution_reverted in header is True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_general_purpose_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    block_env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockEnvironment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    block_output&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockOutput&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;LegacyTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Take a block-level snapshot of the state before transaction execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    begin_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Decode transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pre-charge senders for maximum possible gas fees upfront&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; decoded_transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deduct_max_tx_fee_from_sender_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Execute each transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decoded_transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Stop processing if execution is already reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate declared gas used against actual gas used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If execution is reverted, reset all outputs and rollback the state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rollback_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions_trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipt_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Commit the state if execution is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        commit_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;During block execution:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clients MUST create a block-level snapshot before any transaction execution occurs. This happens after handling the system contracts from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Maximum fees MUST be deducted from sender balances upfront by:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; deduct_max_tx_fee_from_sender_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_blob_gas_price&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recover_sender&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    set_account_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sender_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;max_gas_fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;
&lt;p&gt;Transactions are executed sequentially until executing a transaction would cause the block to exceed the gas limit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;After execution, clients MUST verify that the total gas used matches the declared &lt;code&gt;gas_used&lt;&#x2F;code&gt; in the block header.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If the actual gas used doesn&#x27;t match the declared value, clients MUST:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;execution_reverted&lt;&#x2F;code&gt; to &lt;code&gt;True&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Roll back to the snapshot taken before execution&lt;&#x2F;li&gt;
&lt;li&gt;Reset all execution outputs (receipts, logs, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Return zero gas used&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The block itself remains valid, but execution outputs are not applied to the state.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;General purpose requests as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; are skipped when execution is reverted.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The execution outputs (&lt;code&gt;last_transactions_root&lt;&#x2F;code&gt;, &lt;code&gt;last_receipt_root&lt;&#x2F;code&gt;, &lt;code&gt;last_block_logs_bloom&lt;&#x2F;code&gt;, &lt;code&gt;last_requests_hash&lt;&#x2F;code&gt;, &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt;) are updated in the chain state based on the execution results, and will be verified in subsequent blocks.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution SHALL be stopped and the payload reverted after exceeding the block gas limit:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execution_reverted&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deferred-execution-outputs&quot;&gt;Deferred Execution Outputs&lt;&#x2F;h3&gt;
&lt;p&gt;The core innovation of deferring execution outputs to the next block enables static and stateful validation without requiring immediate execution. The &lt;code&gt;pre_state_root&lt;&#x2F;code&gt; provides a cryptographically verifiable starting point for validation, while parent execution outputs create a chain of deferred execution results that maintains the integrity of the blockchain state.&lt;&#x2F;p&gt;
&lt;p&gt;This approach eliminates the execution bottleneck in the validation pipeline by allowing validators to attest to a block&#x27;s validity based on its structure and the pre-charged transaction fees, without waiting for execution results.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-charging-mechanism&quot;&gt;Pre-Charging Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;Pre-charging senders with the maximum possible fees before execution provides a crucial guarantee that transactions have sufficient balance to be included in the block. This mechanism is compatible with existing fee models, including &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; dynamic fee transactions and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob transactions.&lt;&#x2F;p&gt;
&lt;p&gt;By tracking sender balances and nonces during validation, the protocol can enforce transaction validity without execution, enabling earlier block attestation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-snapshot-architecture&quot;&gt;State Snapshot Architecture&lt;&#x2F;h3&gt;
&lt;p&gt;The block-level snapshot mechanism provides a way to revert execution when necessary. This approach allows clients to roll back the entire block&#x27;s execution if the actual gas used does not match the declared gas in the header, without invalidating the block structure itself.&lt;&#x2F;p&gt;
&lt;p&gt;This provides two key benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It allows validators to attest to blocks before execution is complete&lt;&#x2F;li&gt;
&lt;li&gt;It ensures execution is eventually performed correctly, with economic penalties for incorrect gas declarations&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;execution-reversion-handling&quot;&gt;Execution Reversion Handling&lt;&#x2F;h3&gt;
&lt;p&gt;When a block&#x27;s execution is reverted due to gas mismatch:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The block itself remains valid and part of the canonical chain&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;last_execution_reverted&lt;&#x2F;code&gt; flag is set to &lt;code&gt;True&lt;&#x2F;code&gt; in chain state&lt;&#x2F;li&gt;
&lt;li&gt;The next block must include this flag as &lt;code&gt;parent_execution_reverted&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Base fee calculations for subsequent blocks use 0 as parent gas used when parent execution was reverted&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, as it alters the block validation and execution process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-correctness-guarantees&quot;&gt;Execution Correctness Guarantees&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol ensures execution correctness through these primary mechanisms:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deferred execution outputs MUST match in subsequent blocks, creating a chain of verifiable execution results.&lt;&#x2F;li&gt;
&lt;li&gt;State rollback MUST occur if the actual gas used doesn&#x27;t match the declared value, providing an economic incentive for correct gas declaration.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;parent_execution_reverted&lt;&#x2F;code&gt; flag ensures that blocks acknowledge when parent execution has been reverted, maintaining chain integrity.&lt;&#x2F;li&gt;
&lt;li&gt;Static and stateful validation guarantees that all transactions are properly authorized and senders have sufficient funds for maximum fees.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;base-fee-dynamics-with-reverted-execution&quot;&gt;Base Fee Dynamics with Reverted Execution&lt;&#x2F;h3&gt;
&lt;p&gt;When a block&#x27;s execution is reverted, the next block&#x27;s base fee calculation treats the parent&#x27;s gas used as zero, regardless of what was declared in the header. This ensures that base fee adjustments remain responsive to actual chain usage, and prevents manipulation of the fee market through incorrect gas declarations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;data-availability-and-economic-incentives&quot;&gt;Data Availability and Economic Incentives&lt;&#x2F;h3&gt;
&lt;p&gt;Block proposers MUST declare correct gas usage or lose transaction fees when execution is reverted. This aligns incentives for correct gas declaration and ensures execution integrity.&lt;&#x2F;p&gt;
&lt;p&gt;Even when a block&#x27;s execution is reverted due to incorrect gas declaration, the transaction data (calldata, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access lists, and blob data) MUST still be stored by all nodes for syncing and block validation purposes. This requirement creates a potential attack vector where malicious actors could attempt to place large amounts of data on-chain at a reduced cost by intentionally invalidating blocks through incorrect gas declarations.&lt;&#x2F;p&gt;
&lt;p&gt;However, this attack is not economically sustainable for several reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Block proposers who invalidate blocks through incorrect gas declarations lose all execution layer rewards associated with the block.&lt;&#x2F;li&gt;
&lt;li&gt;The attack requires control of block production, which is a scarce resource in the consensus layer.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The economic costs of forgoing block rewards significantly outweigh any potential benefits, making such attacks financially impractical under normal network conditions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ModExp Gas Cost Increase</title>
        <published>2025-02-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marcin Sobczak</name><uri>https://github.com/marcindsobczak</uri>
	</author>
	
	<author>
		<name>Marek Moraczyński</name><uri>https://github.com/MarekM25</uri>
	</author>
	
	<author>
		<name>Marcos Maceo</name><uri>https://github.com/stdevMac</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7883/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7883-modexp-gas-cost-increase/22841" />
        

        <id>https://wg-eips.ritovision.com/7883/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7883"
            label="EIP-7883" />
        

        
        

        
        <summary type="html">Increases cost of ModExp precompile</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7883/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is modifying the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile pricing algorithm introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;EIP-2565&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile is underpriced in certain scenarios relative to its resource consumption. By adjusting the pricing formula, this EIP aims to address these discrepancies, making &lt;code&gt;ModExp&lt;&#x2F;code&gt; sufficiently efficient to enable potential increases in the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Upon activation of this EIP, the gas cost of calling the precompile at address &lt;code&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;code&gt; will be calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if max_length &amp;gt; 32: multiplication_complexity = 2 * words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return multiplication_complexity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_iteration_count(exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if exponent_length &amp;lt;= 32 and exponent == 0: iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;lt;= 32: iteration_count = exponent.bit_length() - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (16 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(iteration_count, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_gas_cost(base_length, modulus_length, exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = calculate_multiplication_complexity(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = calculate_iteration_count(exponent_length, exponent)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(500, math.floor(multiplication_complexity * iteration_count))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The specific changes from the algorithm defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;EIP-2565&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-increased-minimal-and-general-price&quot;&gt;1. Increased minimal and general price&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost calculation is modified from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(200, math.floor(multiplication_complexity * iteration_count &#x2F; 3))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(500, math.floor(multiplication_complexity * iteration_count))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This change increases the minimum gas cost from 200 to 500 and triples the general cost by removing the division by 3.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-increase-cost-for-exponents-larger-than-32-bytes&quot;&gt;2. Increase cost for exponents larger than 32 bytes&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost calculation is modified from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (8 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (16 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The multiplier for exponents larger than 32 bytes is increased from 8 to 16, doubling its impact.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-assume-the-minimal-base-modulus-length-to-be-32-and-increase-the-cost-when-it-is-larger-than-32-bytes&quot;&gt;3. Assume the minimal base &#x2F; modulus length to be 32 and increase the cost when it is larger than 32 bytes&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost calculation is modified from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if max_length &amp;gt; 32: multiplication_complexity = 2 * words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return multiplication_complexity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This change introduces a minimal multiplication complexity of 16 and doubles the complexity if the base or modulus length exceeds 32 bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Benchmarking the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile revealed several scenarios where its gas cost was significantly underestimated. Pricing adjustments are designed to rectify underpriced edge cases by modifying the existing &lt;code&gt;ModExp&lt;&#x2F;code&gt; pricing formula parameters. Specifically, the minimum cost for &lt;code&gt;ModExp&lt;&#x2F;code&gt; will rise from 200 to 500 (a 150% increase), the general cost will triple (a 200% increase), a minimum base&#x2F;modulus length of 32 bytes will be assumed and the cost will scale more aggressively when the base, modulus, or exponent exceed 32 bytes. These modifications aim to ensure that the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile&#x27;s performance, even in its most resource-intensive edge cases across all execution layer clients, no longer impedes potential increases to the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a backwards-incompatible change. However, similar gas repricings have occurred multiple times in the Ethereum ecosystem, and their effects are well understood.&lt;&#x2F;p&gt;
&lt;p&gt;An empirical analysis of this proposal is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7883&#x2F;assets&#x2F;call_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, with a separate breakdown by affected entities provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7883&#x2F;assets&#x2F;entity_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The most common usages (approximately 99.69% of historical &lt;code&gt;Modexp&lt;&#x2F;code&gt; calls as of January 4th, 2025) will experience either a 150% increase (from 200 to 500 gas) or a 200% increase (tripling from approximately 1360 gas).
No changes are made to the underlying interface or arithmetic algorithms, allowing existing test vectors to be reused. The table below presents the updated gas costs for these test vectors:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Test Case&lt;&#x2F;th&gt;&lt;th&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;EIP-2565&lt;&#x2F;a&gt; Pricing&lt;&#x2F;th&gt;&lt;th&gt;EIP-7883 Pricing&lt;&#x2F;th&gt;&lt;th&gt;Increase&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_square&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;td&gt;150%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_qube&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;td&gt;150%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_square&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;156%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_qube&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;156%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_square&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_qube&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;td&gt;32768&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_square&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_qube&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;td&gt;8192&lt;&#x2F;td&gt;&lt;td&gt;501%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;21845&lt;&#x2F;td&gt;&lt;td&gt;131072&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_square&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;td&gt;32768&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_qube&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;td&gt;32768&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;87381&lt;&#x2F;td&gt;&lt;td&gt;524288&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marius_1_even&lt;&#x2F;td&gt;&lt;td&gt;2057&lt;&#x2F;td&gt;&lt;td&gt;45296&lt;&#x2F;td&gt;&lt;td&gt;2102%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_1_even&lt;&#x2F;td&gt;&lt;td&gt;2298&lt;&#x2F;td&gt;&lt;td&gt;51136&lt;&#x2F;td&gt;&lt;td&gt;2125%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_2_even&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;td&gt;51152&lt;&#x2F;td&gt;&lt;td&gt;2124%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_3_even&lt;&#x2F;td&gt;&lt;td&gt;5400&lt;&#x2F;td&gt;&lt;td&gt;32400&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_guido_4_even&lt;&#x2F;td&gt;&lt;td&gt;1026&lt;&#x2F;td&gt;&lt;td&gt;94448&lt;&#x2F;td&gt;&lt;td&gt;9105%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_1_base_heavy&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;1152&lt;&#x2F;td&gt;&lt;td&gt;476%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_1_exp_heavy&lt;&#x2F;td&gt;&lt;td&gt;215&lt;&#x2F;td&gt;&lt;td&gt;16624&lt;&#x2F;td&gt;&lt;td&gt;7632%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_1_balanced&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;td&gt;1200&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_2_base_heavy&lt;&#x2F;td&gt;&lt;td&gt;867&lt;&#x2F;td&gt;&lt;td&gt;5202&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_2_exp_heavy&lt;&#x2F;td&gt;&lt;td&gt;852&lt;&#x2F;td&gt;&lt;td&gt;16368&lt;&#x2F;td&gt;&lt;td&gt;1821%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_2_balanced&lt;&#x2F;td&gt;&lt;td&gt;996&lt;&#x2F;td&gt;&lt;td&gt;5978&lt;&#x2F;td&gt;&lt;td&gt;500%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_3_base_heavy&lt;&#x2F;td&gt;&lt;td&gt;677&lt;&#x2F;td&gt;&lt;td&gt;2032&lt;&#x2F;td&gt;&lt;td&gt;200%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_3_exp_heavy&lt;&#x2F;td&gt;&lt;td&gt;765&lt;&#x2F;td&gt;&lt;td&gt;4080&lt;&#x2F;td&gt;&lt;td&gt;433%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_marcin_3_balanced&lt;&#x2F;td&gt;&lt;td&gt;1360&lt;&#x2F;td&gt;&lt;td&gt;4080&lt;&#x2F;td&gt;&lt;td&gt;200%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does not introduce any new functionality or make existing operations cheaper, therefore there are no direct security concerns related to new attack vectors or reduced costs. The primary security consideration for this EIP is the potential for &lt;code&gt;ModExp&lt;&#x2F;code&gt; scenarios to be overpriced, though this is deemed a lesser risk compared to the current underpricing issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - EXTCODEADDRESS instruction</title>
        <published>2025-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7880/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7880-eof-extcodeaddress-instruction/22845" />
        

        <id>https://wg-eips.ritovision.com/7880/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7880"
            label="EIP-7880" />
        

        
        

        
        <summary type="html">Add EXTCODEADDRESS instruction to EOF to address code delegation use cases</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7880/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add an instruction to EOF that reads code delegation designations from an account without requiring code introspection.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOFv1 as scoped in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt; removes code introspection capabilities from the EVM, preventing EOF from reading raw code values such as code delegation designations set by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;. There are a number of use cases where reading the delegation designation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; would allow contracts to be more proactive about user experience issues.&lt;&#x2F;p&gt;
&lt;p&gt;One example is a managed proxy contract. Such a contract may want to ensure security by not allowing the proxy to be updated to a delegated address. There are also safety concerns with pointing to a delegation, as the contract may be updated to non EOF code and &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; will no longer be able to call the contract, due to changes outside the control of the managed proxy contract.&lt;&#x2F;p&gt;
&lt;p&gt;Another example are contracts that need to ensure that the delegation has not changed over a limited scope of time, such as sponsorships. This will prevent a transaction from receiving gas sponsorship, changing the delegation, and performing an act different than what was approved. Sponsors can encode the delegation into the transaction data and verify with this instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, there is the case where contracts may want to de-escalate risks and only accept a small number of delegations for any given contract. To enable this validation contracts will need to be able to resolve the actual address of delegation, not just know that one exists.&lt;&#x2F;p&gt;
&lt;p&gt;To address this the essential task of the designation parsing is moved into a new opcode &lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt;, where the task of calculating the delegated address will be performed. For non-delegated accounts or empty accounts the address will be the same as the queried address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;2600&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;1adcc1bfe774798bcacc685aebc17bd9935078c3&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;gas.py#L65-L66&quot;&gt;Ethereum Execution Layer Spec Constants&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;100&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;1adcc1bfe774798bcacc685aebc17bd9935078c3&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;gas.py#L65-L66&quot;&gt;Ethereum Execution Layer Spec Constants&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce a new EOFv1 instruction &lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0xea&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;EOF code which contains this instruction prior to the fork activating this instruction is considered invalid. Beginning with the first block this EIP is activated in, this instruction is added to the set of valid EOFv1 instructions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;extcodeaddress&quot;&gt;&lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Deduct &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;pop 1 argument &lt;code&gt;target_address&lt;&#x2F;code&gt; from the stack&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;target_address&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address), then halt with an exceptional failure
&lt;ul&gt;
&lt;li&gt;Notice: Future expansion of the EVM address space may enlarge the number of valid addresses. Do not rely on this step always halting with the current restrictions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_COLD_ACCOUNT_ACCESS - GAS_WARM_ACCESS&lt;&#x2F;code&gt; if &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and add &lt;code&gt;target_address&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Load the code from &lt;code&gt;target_address&lt;&#x2F;code&gt; and refer to it as &lt;code&gt;loaded_code&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;loaded_code&lt;&#x2F;code&gt; indicates a delegation designator (for example, prefixed with &lt;code&gt;0xef0100&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;) push the address of the designation onto the stack.
&lt;ul&gt;
&lt;li&gt;Notice: if &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation designations are updated in a future fork (such as allowing chained delegations), then this section is expected to comply with any such hypothetical changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, push &lt;code&gt;target_address&lt;&#x2F;code&gt; onto the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: If &lt;code&gt;target_address&lt;&#x2F;code&gt; points to an account with a contract mid-creation, then &lt;code&gt;target_address&lt;&#x2F;code&gt; is returned. If delegation designator points to an account with a contract mid-creation, then address of the designation is returned.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Only &lt;code&gt;target_address&lt;&#x2F;code&gt; is warmed. If a delegation is found the address that it is delegated to is not added to the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. Also, whether the delegated address is in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; has no impact on the gas charged for the operation.&lt;&#x2F;p&gt;
&lt;p&gt;Note: This operation straddles the line between &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; code reading and code executing instructions.  The operation steps work as a code reading instruction, but the value returned is the resolved address as through it is a code executing instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is very similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7761&#x2F;&quot;&gt;EIP-7761&lt;&#x2F;a&gt;, which introduces account type introspection. Its rationale is included by reference as they all apply to this situation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-return-the-whole-designation-have-contract-parse&quot;&gt;Alternative: Return the whole designation, have contract parse&lt;&#x2F;h3&gt;
&lt;p&gt;One alternative is to have a specially limited &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; that would return just delegation designations. Apart from the general objections to code introspection this would then lock in and limit delegation designation formats and capabilities that must be preserved in future forks. By allowing access to the effect of the delegation rather than the mechanism, EOF preserves space for the mechanism to be changed without breaking existing code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;EXTCODEADDRESS&lt;&#x2F;code&gt; at &lt;code&gt;0xea&lt;&#x2F;code&gt; can be introduced in a backwards compatible manner into EOFv1 (no bump to version), because &lt;code&gt;0xea&lt;&#x2F;code&gt; has been rejected by EOF validation prior to the activation of this EIP, and there are no EOF contracts on-chain with an &lt;code&gt;0xea&lt;&#x2F;code&gt; instruction which would have their behavior altered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; code delegation is a new feature that has not been made accessible to mainnet yet. EIP authors will keep abreast of any developments and reflect on their impact to this proposed instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Compute Gas Cost Increase</title>
        <published>2025-02-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jacek Glen</name><uri>https://github.com/JacekGlen</uri>
	</author>
	
	<author>
		<name>Lukasz Glen</name><uri>https://github.com/lukasz-glen</uri>
	</author>
	
	<author>
		<name>Maria Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7904/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/gas-cost-repricing-to-reflect-computational-complexity/23067" />
        

        <id>https://wg-eips.ritovision.com/7904/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7904"
            label="EIP-7904" />
        

        
        

        
        <summary type="html">Gas Cost Increase to reflect computational complexity and transaction throughput increase</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7904/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal raises the gas costs of 13 compute operations and precompiles performing worse than 60 million gas per second (Mgas&#x2F;s). By removing these operations as bottlenecks, we can further increase the block gas limit, thus allowing for a higher throughput on the remaining operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Recent empirical measurements have shown that EVM operations don&#x27;t have a price consistent with their computational complexity. Some operations are significantly underpriced, leading to potential bottlenecks in transaction processing. These bottlenecks limit the overall throughput of the Ethereum network, as they consume a disproportionate amount of computational resources relative to their gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;By increasing the gas costs of these underpriced operations, we can alleviate these bottlenecks. This change will enable a higher block gas limit, allowing more transactions to be processed per block. The result is an overall increase in network throughput, improving the efficiency and scalability of the Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Upon activation of this EIP, the following gas costs will be updated.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Operation&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Parameter&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Current Gas&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;New Gas (Rounded)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ADDMOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;DIV&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;15&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;KECCAK256&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;30&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;KECCAK256&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;msg_size&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;MOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;MULMOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;11&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.38&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;SDIV&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;20&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;SMOD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;5&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;precompiles&quot;&gt;Precompiles&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Operation&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Parameter&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Current Gas&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;New Gas (Rounded)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLAKE2F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;170&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;NA&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLAKE2F&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;num_rounds&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;2&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLS12_G1ADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;375&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;643&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.71&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;BLS12_G2ADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;600&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;765&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.27&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECADD&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;150&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;314&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;1.09&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECPAIRING&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;45000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECPAIRING&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;num_pairs&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;34103&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;ECRECOVER&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;3000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;POINT_EVALUATION&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;constant&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;50000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;89363&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.79&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;empirical-estimation-of-gas-costs&quot;&gt;Empirical Estimation of Gas Costs&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;selecting-which-operations-to-reprice&quot;&gt;Selecting which Operations to Reprice&lt;&#x2F;h4&gt;
&lt;p&gt;The operations selected for repricing in this EIP were chosen based on their estimated million gas per second (Mgas&#x2F;s) performance. For this EIP, a performance target of &lt;strong&gt;60 million gas per second&lt;&#x2F;strong&gt; is chosen. With this performance target, we will be able to increase the base throughput of the chain by 3x from our current 20Mgas&#x2F;s performance.&lt;&#x2F;p&gt;
&lt;p&gt;An important consideration for repricing is whether poor performance is isolated to a single client or affects multiple implementations. This is important for distinguishing between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Operations that genuinely need repricing (multiple clients struggle)&lt;&#x2F;li&gt;
&lt;li&gt;Operations where a specific client needs optimization (only one client struggles)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To separate these cases, we analyze the performance of each operation the 5 main clients (besu, erigon, geth, nethermind and reth). If the difference in performance between the worst and the second-worst client is higher than 20%, we consider the operation to be a candidate for optimization rather than repricing. All the remaining operations are candidates for repricing.&lt;&#x2F;p&gt;
&lt;p&gt;The report with the full details of this step can be accessed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;assets&#x2F;included_operations&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-collection&quot;&gt;Data Collection&lt;&#x2F;h4&gt;
&lt;p&gt;The gas costs proposed in this EIP are based on the actual time each operation takes to run on the various execution clients. Similar to the methodology used in the Gas Cost Estimator project, synthetic blocks that isolate and stress individual EVM operations are generated. To benchmark a single operation, different blocks are created by varying the number of single operations executed and by changing the parameter values to the operation. The EEST benchmark suite contains the tests used to generate these blocks.&lt;&#x2F;p&gt;
&lt;p&gt;Then, the Nethermind&#x27;s Performance Benchmarking tool is used to collect the needed metrics. This tool returns the total execution time of the block and the number of times each operation was executed. Each test block is run multiple times on each client to account for variability in execution time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;What about dynamic costs?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Some operations have a dynamic component to their costs. For example, the &lt;code&gt;EXP&lt;&#x2F;code&gt; opcode has a gas cost that grows linearly with the exponent&#x27;s byte size. In these cases, the test benchmarks the operation with a range of inputs to assess how the resource costs vary with different inputs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;What about differences between client implementations?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, we require a single cost model that is independent of the client&#x27;s implementation. Although the decision may be different in a specific situation, the general rule is to take the worst client result that cannot be optimized. This means that the worst-performing client on a given operation and resource combination will define the cost of that operation for the entire network. This is the safer and most conservative choice.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;runtime-estimation&quot;&gt;Runtime Estimation&lt;&#x2F;h4&gt;
&lt;p&gt;To estimate the runtime of a single operation from the total execution time of the corresponding synthetic blocks, a &lt;strong&gt;Non-Negative Least Squares (NNLS) Linear Regression&lt;&#x2F;strong&gt; is used. This model enforces that all coefficients are non-negative, thus ensuring execution time cannot be negative. The model estimates runtime as a linear combination of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Constant term (intercept)&lt;&#x2F;strong&gt;: Base overhead for executing the test, which includes setup and teardown time&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operation count (slope)&lt;&#x2F;strong&gt;: Number of times the operation is executed in the test. This parameter is the one that allows us to estimate the per-operation runtime.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Operation-specific parameters&lt;&#x2F;strong&gt;: Variables like number of rounds, message size, or number of pairs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For simple operations (i.e., without additional parameters), the model estimates: &lt;code&gt;runtime = intercept + slope × operation_count&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For variable operations, the model estimates: &lt;code&gt;runtime = intercept + slope × operation_count + param1_coef × operation_count × param1 + param2_coef × operation_count × param2 + ...&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Independent models are created for each client and operation. Only operations and parameters with good model fits (R² &amp;gt; 0.5 and p-value &amp;lt; 0.05) are included in the gas cost proposal to ensure the reliability of the estimates.&lt;&#x2F;p&gt;
&lt;p&gt;The report with the model performance by operation and client can be accessed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;assets&#x2F;runtime_estimation&#x2F;2026-01-15_2026-01-29&#x2F;runtime_estimation_autogenerated_report&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, while the key model outputs can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;runtime_estimation&#x2F;2026-01-15_2026-01-29&#x2F;results.csv&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conversion-to-gas-costs&quot;&gt;Conversion to gas costs&lt;&#x2F;h4&gt;
&lt;p&gt;New gas costs are calculated using the same target performance of 60Mgas&#x2F;s. The formula used is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_gas = (anchor_rate * runtime_ms) &#x2F; 1000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;runtime_ms&lt;&#x2F;code&gt; is the estimated runtime in milliseconds from the regression models.&lt;&#x2F;p&gt;
&lt;p&gt;The report with the full details of this step can be accessed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;assets&#x2F;runtime_estimation&#x2F;2026-01-15_2026-01-29&#x2F;new_gas_proposal&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other-projects&quot;&gt;Other Projects&lt;&#x2F;h3&gt;
&lt;p&gt;Several initiatives have explored the real gas costs of EVM operations, providing valuable context for this EIP. Notable examples include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;gas-cost-estimator-report.pdf&quot;&gt;Gas Cost Estimator&lt;&#x2F;a&gt; project did a similar empirical analysis. It conducted extensive testing across seven widely-used EVM implementations to measure the actual computational effort required by various opcodes and operations. Conducted in a controlled environment to eliminate external variables, the tests produced accurate and reproducible &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;final_gas_schedule_comparison.csv&quot;&gt;results&lt;&#x2F;a&gt;. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7904&#x2F;.&#x2F;assets&#x2F;gas-cost-estimator.pdf&quot;&gt;findings&lt;&#x2F;a&gt; highlight misalignments between the current gas cost schedule and the real-world computational complexity of EVM operations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7883&#x2F;&quot;&gt;EIP-7883&lt;&#x2F;a&gt; - ModExp Gas Cost Increase: This EIP specifically analyzed the ModExp and proposed a revised pricing scheme. When adjusted with our &lt;code&gt;rescale factor&lt;&#x2F;code&gt;, its costs align with this proposal, requiring no further changes. This consistency validates our measuring approach.&lt;&#x2F;li&gt;
&lt;li&gt;Nethermind&#x27;s Gas Benchmarks: This project takes a different approach to measuring gas costs. It uses standalone clients rather than isolated EVM implementations. Despite the methodological difference, its results mirror those of the Gas Cost Estimator, reinforcing our conclusions.&lt;&#x2F;li&gt;
&lt;li&gt;EVM Memory Analysis by @raxhvl: This project focuses on memory-related costs, providing valuable insights into the memory access and expansion costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These projects collectively affirm the need to reassess gas costs and demonstrate broad alignment with our approach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;computational-complexity-only&quot;&gt;Computational Complexity Only&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP intentionally focuses on computational complexity—measured as execution time on a bare CPU — while excluding network-related costs like state persistency. This ensures the proposed gas cost adjustments remain implementation-agnostic, applicable across diverse EVM clients regardless of their technological stack. By leveraging empirical data from multiple EVM implementations, we establish a universal, verifiable benchmark for computational effort. This focus simplifies estimation and enhances the proposal’s clarity and applicability within Ethereum’s varied ecosystem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;impact-of-gas-costs-changes&quot;&gt;Impact of Gas Costs Changes&lt;&#x2F;h3&gt;
&lt;p&gt;Raising costs for underpriced operations strengthens security by deterring abuse but may increase transaction fees and reduce throughput.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adopts a conservative strategy, prioritizing increases for operations that empirical data show as underpriced. This allows us to increase the base throughput of the chain without changing the costs of the majority of the other operations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-evaluation-and-blob-fee-floor-price&quot;&gt;&lt;code&gt;POINT_EVALUATION&lt;&#x2F;code&gt; and Blob Fee Floor Price&lt;&#x2F;h4&gt;
&lt;p&gt;The proposed increase to &lt;code&gt;POINT_EVALUATION&lt;&#x2F;code&gt; gas cost (from 50,000 to 89,363) has implications for the blob fee floor price mechanism established in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7918&#x2F;&quot;&gt;EIP-7918&lt;&#x2F;a&gt;. Under EIP-7918, the blob base fee is bounded by execution costs through a reserve price of &lt;code&gt;BLOB_BASE_COST * base_fee_per_gas&lt;&#x2F;code&gt;, ensuring that blob consumers pay at least a relevant fraction of the market rate for the computational resources they impose on nodes. The computational resources imposed by blobs are the KZG proof commitments for blob transactions and, as such, the &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt; was originally defined based on the cost of the &lt;code&gt;POINT_EVALUATION&lt;&#x2F;code&gt; precompile. However, for simplicity reasons, we decide not to change the &lt;code&gt;BLOB_BASE_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consideration-of-zk-snark-proof-generation&quot;&gt;Consideration of ZK-SNARK Proof Generation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP focuses on optimizing gas costs based on general computational complexity, using a bare CPU as the reference point. Therefore, it does not specifically address the unique demands of ZK-SNARK proof generation. Nevertheless, given that this EIP is only increasing the gas costs of certain operations, it will help rather than hinder proving times for EVM blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards-incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Developers and node operators MUST update gas estimation handling to accommodate the new costs. Specifically:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wallets: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the updated gas parameters. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Node Software: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation with the new state access cost values.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts with Hardcoded Gas Limits: Contracts that specify hardcoded gas limits for subcalls (e.g., using call(gas, ...)) may face issues if the new gas costs exceed these limits. In these cases, developers MUST review and potentially update these contracts to ensure they function as intended post-upgrade.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Further research might be required to ensure that contracts that use hard coded limits are not broken.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Changing the cost of compute operations could impact the usability of certain applications. More analysis is needed to understand the potential effects on various dApps and user behaviors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - TXCREATE and InitcodeTransaction type</title>
        <published>2025-01-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7873/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7873-eof-txcreate-instruction-and-initcodetransaction-type/22765" />
        

        <id>https://wg-eips.ritovision.com/7873/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7873"
            label="EIP-7873" />
        

        
        

        
        <summary type="html">Adds a `TXCREATE` instruction to EOF and an accompanying transaction type allowing to create EOF contracts from transaction data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7873/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;EVM Object Format (EOF) removes the possibility to create contracts using creation transactions (with an empty &lt;code&gt;to&lt;&#x2F;code&gt; field), &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. We introduce a new instruction: &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;, as well as a new transaction type (&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt;), to provide a way to create contracts using EOF containers in transaction data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP uses terminology from the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; which introduces the EOF format.&lt;&#x2F;p&gt;
&lt;p&gt;Creation transaction and creation instructions &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are means provided by legacy EVM to deploy new code, but per requirement of removing code observability, they are not allowed to deploy EOF code. To allow Externally Owned Accounts (EOAs) to deploy EOF contracts, there must be a way to create EOF contracts using bytecode delivered in transaction data.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the new instruction and transaction type introduced in this EIP enable contracts to create other contracts using initcode from the transaction data, which in legacy EVM is achieved via a combination of &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; and loading the initcode from calldata.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism complements &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; and &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instructions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;&quot;&gt;EIP-7620&lt;&#x2F;a&gt;, and thus all use cases of contract creation that are available in legacy EVM are enabled for EOF.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; is not restricted to EOF containers, it also serves the purpose of bootstrapping EOF contracts into the state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x06)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;32000&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L42&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;1024&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;interpreter.py#L60&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;200&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;gas.py#L44&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_DATA_COST_PER_ZERO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;4&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L41&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_DATA_COST_PER_NON_ZERO&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;16&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L40&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;24576&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;transaction-types&quot;&gt;Transaction Types&lt;&#x2F;h3&gt;
&lt;p&gt;Introduce new transaction &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; (type &lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt;) which extends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; (type 2) transaction by adding a new field &lt;code&gt;initcodes: List[ByteList[MAX_INITCODE_SIZE], MAX_INITCODE_COUNT]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;initcodes&lt;&#x2F;code&gt; can only be accessed via the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction (see below), therefore &lt;code&gt;InitcodeTransactions&lt;&#x2F;code&gt; are intended to be sent to contracts including &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; in their execution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;initcodes&lt;&#x2F;code&gt; items data costs the same as calldata: transaction gas of an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is extended to include tokens in &lt;code&gt;initcodes&lt;&#x2F;code&gt; alongside tokens in &lt;code&gt;calldata&lt;&#x2F;code&gt;. Using the conventions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;, the transaction gas is calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; initcodes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_initcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_initcodes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transaction-validation&quot;&gt;Transaction validation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is invalid if there are zero entries in &lt;code&gt;initcodes&lt;&#x2F;code&gt;, or if there are more than &lt;code&gt;MAX_INITCODE_COUNT&lt;&#x2F;code&gt; entries.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is invalid if any entry in &lt;code&gt;initcodes&lt;&#x2F;code&gt; is zero length, or if any entry exceeds &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is invalid if the &lt;code&gt;to&lt;&#x2F;code&gt; is &lt;code&gt;nil&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Under transaction validation rules &lt;code&gt;initcodes&lt;&#x2F;code&gt; are not validated for conforming to the EOF specification. They are only validated when accessed via &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;. This avoids potential DoS attacks of the mempool. If during the execution of an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; no &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction is called, such transaction is still valid.&lt;&#x2F;p&gt;
&lt;p&gt;Other creation transactions that support contract creation (specifically type 0 &quot;Frontier,&quot; type 1 &quot;AccessList,&quot; type 2 &quot;FeeMarket&quot; transactions with an empty &lt;code&gt;to&lt;&#x2F;code&gt; field) will not attempt to parse EOF containers in their &lt;code&gt;input&lt;&#x2F;code&gt; field and will execute the code as non-EOF code. This will result in immediately executing the undefined &lt;code&gt;0xEF&lt;&#x2F;code&gt; instruction and halting.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rlp-and-signature&quot;&gt;RLP and signature&lt;&#x2F;h4&gt;
&lt;p&gt;Given the definitions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is the RLP serialization of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, initcodes, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt; and the signature values &lt;code&gt;y_parity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; are calculated by constructing a secp256k1 signature over the following digest:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;keccak256(INITCODE_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, initcodes]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Wherever not explicitly listed, the rules of EOF contract creation, as well as the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction, should be identical or analogous to those of &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instruction. This includes but is not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;behavior on &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and address collision (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EVM execution frame created for the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; initcode - memory, account context etc.&lt;&#x2F;li&gt;
&lt;li&gt;nonce bumping of the account of newly created contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;balance checking and transfer for the creation endowment (&lt;code&gt;value&lt;&#x2F;code&gt; argument)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Introduce a new instruction on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on: &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xed&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;txcreate&quot;&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;deduct &lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;halt with exceptional failure if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;pop &lt;code&gt;tx_initcode_hash&lt;&#x2F;code&gt;, &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;input_offset&lt;&#x2F;code&gt;, &lt;code&gt;input_size&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt; from the operand stack&lt;&#x2F;li&gt;
&lt;li&gt;perform (and charge for) memory expansion using &lt;code&gt;[input_offset, input_size]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;load initcode EOF container from the transaction &lt;code&gt;initcodes&lt;&#x2F;code&gt; array which hashes to &lt;code&gt;tx_initcode_hash&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;fails (returns 0 on the stack) if such initcode does not exist in the transaction, or if called from a transaction of &lt;code&gt;TransactionType&lt;&#x2F;code&gt; other than &lt;code&gt;INITCODE_TX_TYPE&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;caller&#x27;s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;let &lt;code&gt;initcontainer&lt;&#x2F;code&gt; be that EOF container, and &lt;code&gt;initcontainer_size&lt;&#x2F;code&gt; its length in bytes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;check that current call depth is below &lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt; and that caller balance is enough to transfer &lt;code&gt;value&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;in case of failure return 0 on the stack, caller&#x27;s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;validate the initcode container and all its subcontainers recursively&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;unlike in general validation, &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is additionally required to have &lt;code&gt;data_size&lt;&#x2F;code&gt; declared in the header equal to actual &lt;code&gt;data_section&lt;&#x2F;code&gt; size.&lt;&#x2F;li&gt;
&lt;li&gt;validation includes checking that the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; does not contain &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;fails (returns 0 on the stack) if container was invalid
&lt;ul&gt;
&lt;li&gt;caller’s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;caller&#x27;s memory slice &lt;code&gt;[input_offset:input_size]&lt;&#x2F;code&gt; is used as calldata&lt;&#x2F;li&gt;
&lt;li&gt;execute the container and deduct gas for execution. The 63&#x2F;64th rule from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; applies.&lt;&#x2F;li&gt;
&lt;li&gt;increment &lt;code&gt;sender&lt;&#x2F;code&gt; account&#x27;s nonce&lt;&#x2F;li&gt;
&lt;li&gt;calculate &lt;code&gt;new_address&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(0xff || sender32 || salt)[12:]&lt;&#x2F;code&gt;, where &lt;code&gt;sender32&lt;&#x2F;code&gt; is the sender address left-padded to 32 bytes with zeros&lt;&#x2F;li&gt;
&lt;li&gt;an unsuccessful execution of initcode results in pushing &lt;code&gt;0&lt;&#x2F;code&gt; onto the stack
&lt;ul&gt;
&lt;li&gt;can populate returndata if execution &lt;code&gt;REVERT&lt;&#x2F;code&gt;ed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&#x27;s nonce stays updated&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;a successful execution ends with initcode executing &lt;code&gt;RETURNCODE{deploy_container_index}(aux_data_offset, aux_data_size)&lt;&#x2F;code&gt; instruction (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;&quot;&gt;EIP-7620&lt;&#x2F;a&gt;). After that:
&lt;ul&gt;
&lt;li&gt;load deploy EOF subcontainer at &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; is executed&lt;&#x2F;li&gt;
&lt;li&gt;concatenate data section with &lt;code&gt;(aux_data_offset, aux_data_offset + aux_data_size)&lt;&#x2F;code&gt; memory segment and update data size in the header&lt;&#x2F;li&gt;
&lt;li&gt;if updated deploy container size exceeds &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;, instruction exceptionally aborts&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;state[new_address].code&lt;&#x2F;code&gt; to the updated deploy container&lt;&#x2F;li&gt;
&lt;li&gt;push &lt;code&gt;new_address&lt;&#x2F;code&gt; onto the stack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_CODE_DEPOSIT * deployed_code_size&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the implementations are expected to cache the result of container validation for the time of current transaction execution, and therefore the cost of each container&#x27;s validation is sufficiently covered by &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; intrinsic cost (initcodes charge).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;txcreate-failure-modes&quot;&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; failure modes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; has two &quot;light&quot; failure modes in case the initcontainer is not present and in case the EOF validation is unsuccessful. An alternative design where both cases led to a &quot;hard&quot; failure (consuming the entire gas available) was considered. We decided to have the more granular and forgiving failure modes in order to align the gas costs incurred to the actual work the EVM performs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-txcreate-in-legacy-evm&quot;&gt;Allowing &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; in legacy EVM&lt;&#x2F;h3&gt;
&lt;p&gt;EOF contract creation requires an exceptional possibility of calling an EOF opcode in legacy code - &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;, because otherwise neither legacy contracts nor create transactions can deploy EOF code to bootstrap. The alternative approach was to continue using legacy creation mechanisms, by either still relying on fetching the &lt;em&gt;initcode&lt;&#x2F;em&gt; from memory and not satisfy the overarching requirement of code non-observability, or to abuse the legacy creation transactions mechanism, or to introduce a predeployed Creator Contract into the state.&lt;&#x2F;p&gt;
&lt;p&gt;This also makes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7698&#x2F;&quot;&gt;EIP-7698&lt;&#x2F;a&gt; (EOF - Creation transaction) no longer an essential requirement for deploying EOF contracts onto the chain. The EIP could be removed from EOFv1 and withdrawn.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-address-hashing-scheme&quot;&gt;New address hashing scheme&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; uses the scheme &lt;code&gt;new_address = keccak256(0xff || sender32 || salt)[12:]&lt;&#x2F;code&gt;, same as &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction. The decision whether to include initcontainer hash into salt is left to the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; caller. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;&quot;&gt;EIP-7620&lt;&#x2F;a&gt; for detailed rationale.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-creation-transactions-vs-deployment-patterns&quot;&gt;EOF creation transactions vs deployment patterns&lt;&#x2F;h3&gt;
&lt;p&gt;Relying on the EOF creation transactions as the alternative solution makes it impossible for smart contract wallets to deploy arbitrary EOF contracts (only EOAs can). At the same time, it is a use case current legacy creation rules allow, thanks to &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. A workaround where those arbitrary EOF contracts are first &quot;uploaded&quot; to a factory contract, and then deployed using an &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;-&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; sequence, is very expensive, as it requires the deployed contract to be put on-chain twice. Because of this, the approach proposed in this EIP is more compatible with the Account Abstraction (AA) roadmap, where smart contract wallets should have feature parity with EOAs.&lt;&#x2F;p&gt;
&lt;p&gt;On top of this, relying on nonce-based hashing scheme to obtain addresses of newly created contracts, like in the case of the EOF creation transactions, would prevent EOF contracts from being deployed counterfactually to deterministic, cross-chain addresses. Introduction of the &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction, supports this out of the box. ERCs can be written to provide toehold contracts which will cater for the deployment patterns, such as salt-less deployment and hashing in the sender&#x27;s address as part of the salt.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;handling-of-0xef00-prefixed-code-in-existing-transaction-types&quot;&gt;Handling of &lt;code&gt;0xEF00&lt;&#x2F;code&gt; prefixed code in existing transaction types.&lt;&#x2F;h3&gt;
&lt;p&gt;Three existing transaction types (type 0 &quot;Frontier,&quot; type 1 &quot;AccessList,&quot; type 2 &quot;FeeMarket&quot;) accept code as part of their input data in certain configurations. This code can start with &lt;code&gt;EF&lt;&#x2F;code&gt; as it is initcode and not a deployed contract.&lt;&#x2F;p&gt;
&lt;p&gt;One possible way of handling potential EOF containers in these transactions is to make them invalid if they are attempting to execute an EOF container as initcode. Specifically the transactions is invalid if the input data begins with &lt;code&gt;0xef00&lt;&#x2F;code&gt; and if the &lt;code&gt;to&lt;&#x2F;code&gt; field is set to nil, signaling a contract creation transaction. This would make blocks containing these transactions invalid, whereas before the fork including this EIP they would have been valid.&lt;&#x2F;p&gt;
&lt;p&gt;One impact that would be seen by this would be block builders, as they would need to ensure that the transactions that are invalid are not included in a block. There is precedent for this, as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; established a new floor for the gas limit in transactions, prior to its adoption the limit was lower.  However, block builders have an existing check on gas limits and transactions and that change was adjusting the formula and constants.&lt;&#x2F;p&gt;
&lt;p&gt;We should also consider the treatment &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation designations receive if they show up as code in a contract creation transaction.  The transaction is valid, is executed as plain bytecode, ad the first operation executed is &lt;code&gt;0xEF&lt;&#x2F;code&gt;, which is an invalid opcode and would cause the whole transaction to abort.&lt;&#x2F;p&gt;
&lt;p&gt;Letting the inputdata of a type 0, 1, and 2 contract creation transaction execute as plain EVM code irrespective of the magic &lt;code&gt;0xEF00&lt;&#x2F;code&gt; bytes keeps a consistent behavior in client code and keeps block builders from having to update their logic in older transaction types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. Despite the new instruction being introduced for legacy bytecode (code which is not EOF formatted), there is little chance that a meaningful contract would unintentionally execute &lt;code&gt;0xed&lt;&#x2F;code&gt; instruction with formally valid operands and inadvertently cause it to run EOF initcode (which would also require an &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; to be used, otherwise the initcode lookup will fail).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction introduction into legacy EVM does not affect &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis, because instruction has no immediate arguments.&lt;&#x2F;p&gt;
&lt;p&gt;The transactions of the new type are invalid until this change activates.&lt;&#x2F;p&gt;
&lt;p&gt;Contract creation options do not change for legacy bytecode, including how existing transactions with &lt;code&gt;to: nil&lt;&#x2F;code&gt; behave when encountering code in their calldata that may look like an EOF container.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Enhanced RETURN opcodes</title>
        <published>2025-01-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Josh Weintraub</name><uri>https://github.com/jhweintraub</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7877/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7877-new-m-s-t-rreturn-opcodes/22731" />
        

        <id>https://wg-eips.ritovision.com/7877/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7877"
            label="EIP-7877" />
        

        
        

        
        <summary type="html">Deprecate RETURN opcode in favor of new opcodes that allow returning data from various locations without first having to write to memory.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7877/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a series of new &lt;code&gt;RETURN&lt;&#x2F;code&gt; opcodes which allow the user to specify which data location to return from
instead of defaulting to returning from memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the introduction of transient storage, many smart contracts have begun to store data using the new transient opcodes to optimize for gas usage, whereby a callback
involves returning the data previously stored transiently. However, the current &lt;code&gt;RETURN&lt;&#x2F;code&gt; opcode only allows for returning sequential bytes in memory. This requires
developers to incur additional gas overhead by manually writing data from transient storage to memory before returning,
incuring both an additional memory expansion and opcode cost from complicated for-loops. Similar
inefficiencies already occur when attempting to return data already placed in storage. This EIP attempts to rectify
this by allowing developers to optimize their code by deciding where to return data from directly, instead of requiring
the intermediate step of first copying the data to memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces 3 new opcodes as well as renaming&#x2F;aliasing an existing one.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SRETURN (0xf6)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TRETURN (0xf7)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RRETURN (0xf8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RETURN -&amp;gt; MRETURN (0xf3)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;MRETURN&lt;&#x2F;code&gt; opcode is a rename of &lt;code&gt;RETURN&lt;&#x2F;code&gt;, whereby sequential bytes in memory are returned. It will operate exactly as it currenty does as of the Cancun hard-fork, and its gas cost will remain the same.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RRETURN&lt;&#x2F;code&gt; operates similar to &lt;code&gt;MRETURN&lt;&#x2F;code&gt;. It pops two items off the stack, an offset to begin reading bytes from in the
existing &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt; buffer, and a number of bytes to return. Those bytes are used to overwrite the existing &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt; buffer and then a return to the previous function is performed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;SRETURN&lt;&#x2F;code&gt; and &lt;code&gt;TRETURN&lt;&#x2F;code&gt; operate similarly, except on storage and transient respectively. It pops two items off the stack,
a slot number to begin reading from, and a number of sequential slots to return from. Ex: &lt;code&gt;SRETURN(0x0, 0x40)&lt;&#x2F;code&gt; returns the 64 bytes of data in slots [0, 1], and &lt;code&gt;TRETURN(0x0, 0x40)&lt;&#x2F;code&gt; returns the data in transient storage slots [0, 1]. Since the
existing &lt;code&gt;S&#x2F;TLOAD&lt;&#x2F;code&gt; opcodes already return 32-bytes, having the opcode return data in chunks of 32-bytes should make implementation by assembly&#x2F;compiler much simpler.
If the length parameter is a zero, then only the initial slot value should be returned, so &lt;code&gt;SRETURN(0x00, 0x00)&lt;&#x2F;code&gt; returns the value at storage slot 0.&lt;&#x2F;p&gt;
&lt;p&gt;The cost for these opcodes should be similar to the cost of accessing data now.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SRETURN = (number_of_cold_slots) * 2100 + (numer_of_warm_slots * 100)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TRETURN = number_of_slots * 100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RRETURN = cost of RETURNDATACOPY without memory_expansion cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;minimum_word_size = (size + 31) &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;static_gas = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dynamic_gas = 3 * minimum_word_size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;overall = static_gas + dynamic_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Allowing for more targeted return opcodes allows for saving gas at all levels of smart contract optimization by eliminating
the intermediate steps of first writing any data to memory before returning. In events where this data may be large, this can result in significant gas savings. These opcodes can be built into the Solidity compiler directly so that all contracts
can take advantage of them. Similarly, by making return more explicit it allows for better static analysis by avoiding messy memory allocations.&lt;&#x2F;p&gt;
&lt;p&gt;There is precedent for these changes.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-3855: Introducing &lt;code&gt;PUSH0&lt;&#x2F;code&gt; opcode to optimize away alternative methods of pushing 0 onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-6: Renaming &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; without changing functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns, as &lt;code&gt;MRETURN&lt;&#x2F;code&gt; will utilize the same gas cost and opcode as &lt;code&gt;RETURN&lt;&#x2F;code&gt; does now. Due to EOF, it is suggested that these changes be
activated in future EVM version once EOF has been fully implemented.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations as it is fully backwards compatible, and reduces potential attack space through simplified bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add Auth Data to EIP-7623 Floor</title>
        <published>2025-01-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/8131/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-9999-add-auth-data-to-eip-7623-floor/12345" />
        

        <id>https://wg-eips.ritovision.com/8131/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:8131"
            label="EIP-8131" />
        

        
        

        
        <summary type="html">Add EIP-7702 authorization data to the EIP-7623 floor calculation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/8131/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP includes &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization data in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation, preventing circumvention of floor pricing through authorization lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization tuples are priced for execution (&lt;code&gt;PER_EMPTY_ACCOUNT_COST = 25,000&lt;&#x2F;code&gt; gas per authorization) but do not contribute to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation.&lt;&#x2F;p&gt;
&lt;p&gt;This enables achieving ~9% larger blocks than intended by combining calldata with authorization data at an optimal ratio, circumventing the floor pricing mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Source&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FLOOR_COST_PER_AUTH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4040&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;101 bytes × 4 tokens × 10 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;25000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation is modified to include authorization data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;floor_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The gas used calculation becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_EMPTY_ACCOUNT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;floor_gas&lt;&#x2F;code&gt; or below its intrinsic gas cost is considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;flat-cost-per-authorization&quot;&gt;Flat Cost Per Authorization&lt;&#x2F;h3&gt;
&lt;p&gt;Each authorization is charged a flat &lt;code&gt;FLOOR_COST_PER_AUTH = 4040&lt;&#x2F;code&gt; gas toward the floor, derived from:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;101 bytes per authorization tuple (as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;4 tokens per byte (treating all bytes as non-zero)&lt;&#x2F;li&gt;
&lt;li&gt;10 gas per token (&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This conservative approach avoids byte-level zero&#x2F;non-zero accounting while ensuring authorization data is properly reflected in the floor calculation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;floor-only-modification&quot;&gt;Floor-Only Modification&lt;&#x2F;h3&gt;
&lt;p&gt;Authorization costs are added to the floor calculation only, not to intrinsic gas. This differs from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7981&#x2F;&quot;&gt;EIP-7981&lt;&#x2F;a&gt; (access lists) because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Authorization execution cost (25,000 gas) far exceeds floor contribution (4,040 gas per auth)&lt;&#x2F;li&gt;
&lt;li&gt;Floor-only modification is sufficient to prevent bypass&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With this change:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Authorization data contributes to the floor path&lt;&#x2F;li&gt;
&lt;li&gt;High-execution transactions remain unaffected (execution exceeds floor)&lt;&#x2F;li&gt;
&lt;li&gt;Data-heavy transactions cannot use authorizations to bypass floor pricing&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Requires updates to gas estimation in wallets and nodes. Normal usage patterns remain largely unaffected since authorization execution cost typically dominates the floor contribution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;case-1-transaction-with-authorizations-only&quot;&gt;Case 1: Transaction with Authorizations Only&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Calldata: 0 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Authorizations: 10&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Old floor: 21,000 gas
New floor: 21,000 + 10 × 4,040 = 61,400 gas
Execution: 10 × 25,000 = 250,000 gas
Result: Pay execution (250,000) - unchanged, execution dominates&lt;&#x2F;p&gt;
&lt;h3 id=&quot;case-2-bypass-attempt-now-blocked&quot;&gt;Case 2: Bypass Attempt (Now Blocked)&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Calldata: 100,000 bytes (400,000 tokens)&lt;&#x2F;li&gt;
&lt;li&gt;Authorizations: 100&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Old floor: 21,000 + 400,000 × 10 = 4,021,000 gas
New floor: 21,000 + 400,000 × 10 + 100 × 4,040 = 4,425,000 gas
Execution: 21,000 + 1,600,000 + 2,500,000 = 4,121,000 gas
Result: Pay new floor (4,425,000) - bypass blocked&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4040&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 101 bytes * 4 tokens&#x2F;byte * 10 gas&#x2F;token&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_intrinsic_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Calculate intrinsic gas cost and floor gas cost.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns (intrinsic_gas, floor_gas).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calldata tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata_zero&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata_zero&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorization costs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_authorizations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    auth_exec_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; SetCodeTransaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        num_authorizations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorizations&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        auth_exec_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PER_EMPTY_ACCOUNT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Floor: calldata + flat cost per authorization&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    floor_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; num_authorizations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FLOOR_COST_PER_AUTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intrinsic: calldata + authorization execution cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    intrinsic_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; auth_exec_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floor_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP closes a loophole that allows circumventing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing. Without this fix, adversaries can achieve ~9% larger blocks by combining calldata with authorization data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;interaction-with-eip-7981&quot;&gt;Interaction with EIP-7981&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7981&#x2F;&quot;&gt;EIP-7981&lt;&#x2F;a&gt; is also adopted, both EIPs work together: access list tokens and authorization tokens are both included in the floor calculation. There are no conflicts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum state using a unified binary tree</title>
        <published>2025-01-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7864/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7864-ethereum-state-using-a-unified-binary-tree/22611" />
        

        <id>https://wg-eips.ritovision.com/7864/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7864"
            label="EIP-7864" />
        

        
        

        
        <summary type="html">Switch Ethereum state tree to a unified binary tree</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7864/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new binary state tree, intended to replace the hexary patricia trees. Account and storage tries are merged into a single tree with 32-byte keys, which also contains contracts code. Account data is broken into independent leaves which  are grouped by 256 in order to provide some locality.&lt;&#x2F;p&gt;
&lt;p&gt;Note: The hash function used in the current draft is not final. The current implementation uses BLAKE3 to reduce friction for EL clients experimenting with this EIP, but the final decision remains TBD. Other potential candidates include Keccak and Poseidon2.&lt;&#x2F;p&gt;
&lt;p&gt;For Poseidon2, there&#x27;s an ongoing Ethereum Foundation cryptography initiative assessing its security properties. If Poseidon2 is selected, additional specifications will be needed for field selection (BN254 scalar field, 31-bit field elements, etc.) and encoding 32-byte values into field elements.&lt;&#x2F;p&gt;
&lt;p&gt;The hash function can be switched with minimal impact on implementations as this EIP progresses toward acceptance. &lt;strong&gt;Do not&lt;&#x2F;strong&gt; assume BLAKE3 is a final decision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s long-term goal is to allow blocks to be proved with validity proof so that chain verification is as simple and fast as possible. One of the most challenging parts of achieving that goal is proving the state of the tree, which is required for EVM execution.&lt;&#x2F;p&gt;
&lt;p&gt;The current Merkle-Patricia Trie (MPT) design isn&#x27;t friendly to validity proofs for many reasons, such as using RLP for node encoding, Keccak as a hashing function, being a &quot;tree of trees&quot;, and not including accounts code as part of the state.&lt;&#x2F;p&gt;
&lt;p&gt;Apart from requiring a state tree design that is friendly for block validity proofs, it&#x27;s also important to have fast and small regular Merkle proofs when the amount of state to prove is small. This is useful not only for the application layer but also for supporting future protocol needs in a stateless world (e.g: inclusion lists).&lt;&#x2F;p&gt;
&lt;p&gt;Regarding these regular Merkle proofs in an MPT, since it&#x27;s a hexary tree, their size is quite big on average and in worst-case scenarios. Given a 2^32 size tree, the expected size for proving a single branch is &lt;code&gt;15 * 32 * log_16(2^32) = 3840&lt;&#x2F;code&gt;. From a worst-case block perspective, if 30M gas is used to access only a single byte of different account codes since this code isn&#x27;t chunkified, we&#x27;d need &lt;code&gt;30M&#x2F;2400*(5*480+24k)=330MB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A binary tree has a good balance between out-of-circuit and in-circuit proving. Since the tree arity is two, this reduces the size of regular Merkle proofs (i.e., &lt;code&gt;# siblings * log_arity(N)&lt;&#x2F;code&gt; for arity 2 is better than for arity 16). Moreover, we propose switching from Keccak to a more proving-friendly hash function, which would be more amenable to modern proving systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;notable-changes-from-the-hexary-structure&quot;&gt;Notable changes from the hexary structure&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The account and storage tries are merged into a single trie.&lt;&#x2F;li&gt;
&lt;li&gt;RLP is no longer used.&lt;&#x2F;li&gt;
&lt;li&gt;The account&#x27;s code is chunked and included in the tree.&lt;&#x2F;li&gt;
&lt;li&gt;Account data (e.g., balance, nonce, first storage slots, first code-chunks) is co-located in the tree to reduce branch openings.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;tree-structure&quot;&gt;Tree structure&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed Binary Tree stores key-value entries where both the key and value are 32 bytes. The first 31-bytes of the key define the entry stem, and the last byte is the subindex in that stem. If two keys have the same stem, they live in the same &quot;big branch&quot; — this co-locates groups of 256 keys (i.e: keys with the same first 31-bytes).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7864&#x2F;.&#x2F;assets&#x2F;diagram2.png&quot; alt=&quot;Image&quot; &#x2F;&gt;
(More details about the purple&#x2F;orange part in the &quot;Tree embedding&quot; section)&lt;&#x2F;p&gt;
&lt;p&gt;We can distinguish four node types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;InternalNode&lt;&#x2F;code&gt; has a &lt;code&gt;left_hash&lt;&#x2F;code&gt; and &lt;code&gt;right_hash&lt;&#x2F;code&gt; field (black).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;StemNode&lt;&#x2F;code&gt; has fields &lt;code&gt;stem&lt;&#x2F;code&gt;, &lt;code&gt;left_hash&lt;&#x2F;code&gt; and &lt;code&gt;right_hash&lt;&#x2F;code&gt; (blue).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LeafNode&lt;&#x2F;code&gt; has a field &lt;code&gt;value&lt;&#x2F;code&gt; which is a 32-byte blob or &lt;code&gt;empty&lt;&#x2F;code&gt;. (orange).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EmptyNode&lt;&#x2F;code&gt; represents an empty node&#x2F;sub-tree.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The path to a &lt;code&gt;StemNode&lt;&#x2F;code&gt; is defined by the key&#x27;s first 248-bits (31-bytes) from MSB to LSB. From this node, a subtree of 256 values exists indexed by the key&#x27;s last byte (8 bits). A newly created &lt;code&gt;StemNode&lt;&#x2F;code&gt; subtree (i.e: 256 values) has all leaves with &lt;code&gt;value: empty&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The path length isn&#x27;t 248-bits, but contains the minimal amount of &lt;code&gt;InternalNodes&lt;&#x2F;code&gt; required if other stems exist with the same prefix. As in, when walking the 248-bit path inserting a new &lt;code&gt;StemNode&lt;&#x2F;code&gt;, you can end on a &lt;code&gt;EmptyNode&lt;&#x2F;code&gt; or &lt;code&gt;StemNode&lt;&#x2F;code&gt;. In the former, you replace it with the new &lt;code&gt;StemNode&lt;&#x2F;code&gt;. In the latter, you create as many &lt;code&gt;InternalNodes&lt;&#x2F;code&gt; as common bits both stems have as prefixes. Another way to look at this is that there aren&#x27;t &lt;em&gt;extension nodes&lt;&#x2F;em&gt; in paths, but we use the minimal amount of &lt;code&gt;InternalNodes&lt;&#x2F;code&gt; to place &lt;code&gt;StemNode&lt;&#x2F;code&gt;s with common prefixes.&lt;&#x2F;p&gt;
&lt;p&gt;Below is an implementation that describes the tree structure:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stem must be 31 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BinaryTree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;key must be 32 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value must be 32 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        subindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 248&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;depth must be less than 248&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        stem_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_bytes_to_bits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the stem already exists, update the value.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            existing_stem_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_bytes_to_bits&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We&amp;#39;re in an internal node, go left or right based on the bit.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_insert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; depth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the stem bits are the same up to this depth, we need to create another&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; internal node and recurse.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_split_leaf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    leaf&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; existing_stem_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; new_internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_internal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; stem_bits&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;depth&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_bits_to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StemNode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_value&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;subindex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_internal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; leaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; new_internal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;node-merkelization&quot;&gt;Node merkelization&lt;&#x2F;h3&gt;
&lt;p&gt;Define &lt;code&gt;hash(value)&lt;&#x2F;code&gt; as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hash([0x00] * 64) = [0x00] * 32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;hash(value) = H(value)&lt;&#x2F;code&gt;, where H is the selected cryptographic hash function.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;value&lt;&#x2F;code&gt; parameter lengths can only be 32 and 64.&lt;&#x2F;p&gt;
&lt;p&gt;Merkelize each node type as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;internal_node_hash = hash(left_hash || right_hash)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;stem_node_hash = hash(stem || 0x00 || hash(left_hash || right_hash))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;leaf_node_hash = hash(value)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;empty_node_hash = [0x00] * 32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Below is an implementation of these rules using BLAKE3 as a reference implementation:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data must be 32 or 64 bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; blake3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will be replaced with the final hash function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;node&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; InternalNode&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            left_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;left&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            right_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;right&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;left_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; right_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            new_level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                new_level&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;level&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            level&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;node&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; level&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; _merkelize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;tree-embedding&quot;&gt;Tree embedding&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of a two-layer structure like the MPT, we will embed all information into a unique &lt;code&gt;key: value&lt;&#x2F;code&gt; space in the proposed single tree. This section specifies which tree keys store the state&#x27;s information (account header data, code, storage). The data is colocated in such way that data that is usually accessed together lives in the same &lt;code&gt;StemNode&lt;&#x2F;code&gt; which reduces branch openings.&lt;&#x2F;p&gt;
&lt;p&gt;The following is a big picture of what we&#x27;ll continue to describe in the rest of this section:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7864&#x2F;.&#x2F;assets&#x2F;diagram1.png&quot; alt=&quot;Image&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The account stem (green &lt;code&gt;account&lt;&#x2F;code&gt; node) contains accounts basic data, first 64-storage slots, and first 128-code chunks. This co-location of data allows having data in a single stem branch that is usually accessed together. The rest of storage slots and code-chunks are spread into groups of 256 values in the rest of the tree -- this is also done for convenience since slots&#x2F;code-chunks that are close together will share the same stem branch.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_HASH_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STEM_SUBTREE_WIDTH&lt;&#x2F;td&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;256**31&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;It&#x27;s a required invariant that &lt;code&gt;STEM_SUBTREE_WIDTH &amp;gt; CODE_OFFSET &amp;gt; HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; and that &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; is greater than the leaf keys. Additionally, &lt;code&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;code&gt; MUST be a power of &lt;code&gt;STEM_SUBTREE_WIDTH&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that addresses are always passed around as an &lt;code&gt;Address32&lt;&#x2F;code&gt;. To convert existing addresses to &lt;code&gt;Address32&lt;&#x2F;code&gt;, prepend with 12 zero bytes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; old_style_address_to_address32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-values&quot;&gt;Header values&lt;&#x2F;h3&gt;
&lt;p&gt;These are the positions in the tree at which header fields of an account are stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tree_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;inp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;blake3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blake3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;inp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tree_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; sub_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assumes STEM_SUBTREE_WIDTH = 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; tree_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tree_index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span&gt;sub_index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_basic_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASIC_DATA_LEAF_KEY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_code_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODE_HASH_LEAF_KEY&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An account&#x27;s &lt;code&gt;version&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are packed with big-endian encoding in the value found at &lt;code&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Offset&lt;&#x2F;th&gt;&lt;th&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;code_size&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Bytes &lt;code&gt;1..4&lt;&#x2F;code&gt; are reserved for future use.&lt;&#x2F;p&gt;
&lt;p&gt;The current layout and encoding allow for an extension of &lt;code&gt;code_size&lt;&#x2F;code&gt; to 4 bytes without changing the account version. The goal of packing these fields together in a basic-data leaf is to reduce gas costs, since we only need one branch opening compared with the usual 3 or 4 if the fields aren&#x27;t packed. This also simplifies witness generation.&lt;&#x2F;p&gt;
&lt;p&gt;When any account header field is set, the &lt;code&gt;version&lt;&#x2F;code&gt; field is also set to zero. The &lt;code&gt;codehash&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are set upon contract or EOA creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code&quot;&gt;Code&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_code_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chunk_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; chunk_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; chunk_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Chunk &lt;code&gt;i&lt;&#x2F;code&gt; stores a 32 byte value, where bytes 1…31 are bytes &lt;code&gt;i*31...(i+1)*31 - 1&lt;&#x2F;code&gt; of the code (i.e. the i&#x27;th 31-byte slice of it), and byte 0 is the number of leading bytes that are part of PUSHDATA (e.g. if part of the code is &lt;code&gt;...PUSH4 99 98 | 97 96 PUSH1 128 MSTORE...&lt;&#x2F;code&gt; where &lt;code&gt;|&lt;&#x2F;code&gt; is the position where a new chunk begins, then the encoding of the latter chunk would begin &lt;code&gt;2 97 96 PUSH1 128 MSTORE&lt;&#x2F;code&gt; to reflect that the first 2 bytes are PUSHDATA).&lt;&#x2F;p&gt;
&lt;p&gt;For precision, here is an implementation of code chunkification:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PUSH_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PUSH32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; chunkify_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pad to multiple of 31 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Figure out how much pushdata there is after including each byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes_to_exec_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PUSH_OFFSET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pushdata_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bytes_to_exec_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; pushdata_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; pushdata_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Output chunks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bytes_to_exec_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; storage_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAIN_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STEM_SUBTREE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that storage slots within the same range of size &lt;code&gt;STEM_SUBTREE_WIDTH&lt;&#x2F;code&gt; (i.e. a range with the form &lt;code&gt;x*STEM_SUBTREE_WIDTH ... (x+1)*STEM_SUBTREE_WIDTH-1)&lt;&#x2F;code&gt; are all, except for the &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; special case, part of a single stem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fork&quot;&gt;Fork&lt;&#x2F;h3&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;access-events&quot;&gt;Access events&lt;&#x2F;h3&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a new Binary Tree that starts empty. Only new state changes are stored in the tree. The MPT continues to exist but is frozen. This sets the stage for a future hard fork that migrates the MPT data to this Binary Tree (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7748&#x2F;&quot;&gt;EIP-7748&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-tree-design&quot;&gt;Single tree design&lt;&#x2F;h3&gt;
&lt;p&gt;The proposal uses a single-layer tree structure with 32-byte keys and values for several reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplicity&lt;&#x2F;strong&gt;: working with the abstraction of a key&#x2F;value store makes it easier to write code dealing with the tree (e.g. database reading&#x2F;writing, caching, syncing, proof creation, and verification) and upgrade it to other trees in the future. Additionally, witness gas rules can become simpler and clearer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Uniformity&lt;&#x2F;strong&gt;: the state is uniformly spread throughout the tree; even if a single contract has millions of storage slots, the contract&#x27;s storage slots are not concentrated in one place. This is useful for state-syncing algorithms. Additionally, it helps reduce the effectiveness of unbalanced tree-filling attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;: account headers and code being in the same structure as storage makes it easier to extend both features and even add new structures if desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;snark-friendliness-and-post-quantum-security&quot;&gt;SNARK friendliness and Post-Quantum security&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed design should consider the usual complexity, performance, and efficiency for out-of-circuit implementations (i.e. EL clients) and in-circuit ones for generating proofs in ZK circuits.&lt;&#x2F;p&gt;
&lt;p&gt;The tree design structure tries to be simple, by not having complex branching rules. For example, in contrast with the MPT, we avoid extension nodes injected in the middle of branches. Also, RLP encoding was removed since it adds unnecessary complexity. Although complexity can be managed more easily in out-of-circuit implementations, it&#x27;s valuable to help circuit implementations be as simple as possible to avoid proving overhead.&lt;&#x2F;p&gt;
&lt;p&gt;The most important factor in the design is the cryptographic hash function used for merkleization. This hash function should have efficient implementations both out and in circuits. The hash function selection remains TBD, with several candidates under consideration:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;BLAKE3&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Good out-of-circuit performance (i.e., for raw EL client execution)&lt;&#x2F;li&gt;
&lt;li&gt;Reasonable in-circuit performance for proving&lt;&#x2F;li&gt;
&lt;li&gt;Well-established security properties&lt;&#x2F;li&gt;
&lt;li&gt;Currently used in the reference implementation to facilitate experimentation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Keccak&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Already used in Ethereum, reducing implementation complexity&lt;&#x2F;li&gt;
&lt;li&gt;Well-studied security properties&lt;&#x2F;li&gt;
&lt;li&gt;Less efficient for circuit proving than alternatives&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Poseidon2&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Excellent in-circuit performance for ZK proofs&lt;&#x2F;li&gt;
&lt;li&gt;Potentially better proving throughput&lt;&#x2F;li&gt;
&lt;li&gt;Security analysis still ongoing through EF cryptography initiative&lt;&#x2F;li&gt;
&lt;li&gt;Would require additional specification for field selection and encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The final hash function selection will balance these considerations, with particular attention to security, proving efficiency, and implementation complexity.&lt;&#x2F;p&gt;
&lt;p&gt;Due to recent progress in the quantum computing field, expert estimations consider that they can become real in the 2030s. NIST suggests stopping the use of ECC by 2030 too. Other alternatives, such as Verkle Trees, introduce a new cryptography stack to the protocol, which relies on elliptic curves that aren&#x27;t post-quantum secure. This makes the current tree proposal attractive since it only depends on hash functions, which are still safe in this new paradigm.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, there has been impressive progress in proving systems, which indicates that we could be close to achieving the required performance for creating pre-state &amp;amp; post-state proofs fast enough. This last point is crucial since the main advantage of Verkle Trees was having proofs that are small and fast to generate.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the current state tree proposal will probably be the final state tree used in the protocol, compared with Verkle Trees, which would eventually need to be replaced by a post-quantum secure alternative.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arity-2&quot;&gt;Arity-2&lt;&#x2F;h3&gt;
&lt;p&gt;Binary tries have been chosen primarily because they reduce the witness size. In general, in an &lt;code&gt;N&lt;&#x2F;code&gt;-element tree with each element having &lt;code&gt;k&lt;&#x2F;code&gt; children, the average size of a branch is roughly &lt;code&gt;32 * (k-1) * log(N) &#x2F; log(k)&lt;&#x2F;code&gt; plus a few percent for overhead. 32 is the length of a hash; the &lt;code&gt;k-1&lt;&#x2F;code&gt; refers to the fact that a Merkle proof needs to provide all &lt;code&gt;k-1&lt;&#x2F;code&gt; sister nodes at each level, and &lt;code&gt;log(N) &#x2F; log(k)&lt;&#x2F;code&gt; is an approximation of the number of levels in the tree (e.g. a tree where each node has 5 children, with 625 nodes total, would have depth 4, as &lt;code&gt;625 = 5**4&lt;&#x2F;code&gt; and so &lt;code&gt;log(625) &#x2F; log(5) = 4&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For any &lt;code&gt;N&lt;&#x2F;code&gt;, the expression is minimized at &lt;code&gt;k = 2&lt;&#x2F;code&gt;. Here&#x27;s a table of branch lengths for different &lt;code&gt;k&lt;&#x2F;code&gt; values assuming &lt;code&gt;N = 2**24&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;k&lt;&#x2F;code&gt; (children per node)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (chunks)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (bytes)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1 * 24 = 24&lt;&#x2F;td&gt;&lt;td&gt;768&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;3 * 12 = 36&lt;&#x2F;td&gt;&lt;td&gt;1152&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;7 * 8 = 56&lt;&#x2F;td&gt;&lt;td&gt;1792&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;15 * 6 = 90&lt;&#x2F;td&gt;&lt;td&gt;2880&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Actual branch lengths might be slightly larger than this due to uneven distribution, but the pattern of &lt;code&gt;k=2&lt;&#x2F;code&gt; remains by far the best.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tree-depth&quot;&gt;Tree depth&lt;&#x2F;h3&gt;
&lt;p&gt;The tree design attempts to be as simple as possible considering both out-of-circuit and circuit implementations, while satisfying our throughput constraints on proving hashes.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed design avoids a full 248-bit depth as it would happen in a Sparse Merkle Tree (SMT). This approach helps reduce the hashing load in proving systems, which is currently a throughput bottleneck on commodity hardware. The choice of hash function will impact this consideration - arithmetic-friendly hash functions like Poseidon2 would have different performance characteristics than cryptographic hash functions like BLAKE3 or Keccak. There are some optimization techniques that could be applied, but they add complexity to the specification.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, we could push this further trying to introduce extension nodes in the middle of paths as done in a MPT, but this also adds complexity that might not be worth it considering the tree should be quite balanced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-expiry&quot;&gt;State-expiry&lt;&#x2F;h3&gt;
&lt;p&gt;State-expiry strategies such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7736&#x2F;&quot;&gt;EIP-7736&lt;&#x2F;a&gt; could still be applied, requiring a change in the design. One potential solution is adding a field to the &lt;code&gt;StemNode&lt;&#x2F;code&gt; with &lt;code&gt;epoch&lt;&#x2F;code&gt; as described in the mentioned EIP. Another alternative is to use 247-bits for the stem, and have two subtrees &lt;code&gt;StemValuesNode&lt;&#x2F;code&gt;, which would correspond to the current 256-values, and &lt;code&gt;StemMetaNode&lt;&#x2F;code&gt; which is also a 256-subtree that can be used to store arbitrary stem metadata.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The main breaking changes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(1) Gas costs for code chunk access can have an impact on applications&#x27; economic viability&lt;&#x2F;li&gt;
&lt;li&gt;(2) Tree structure change makes in-EVM proofs of historical state no longer work&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(1) can be mitigated by increasing the gas limit while implementing this EIP, allowing the same economic viability for applications.&lt;&#x2F;p&gt;
&lt;!-- TODO:

## Test Cases

- Add comprehensive test vectors for tree operations
- Finalize hash function selection and provide test vectors for the selected function
- Add test cases for edge cases in tree operations

--&gt;
&lt;!-- TODO: Remove external link

## Reference Implementation

Python reference implementation (`github.com&#x2F;jsign&#x2F;binary-tree-spec`).

--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-level Warming</title>
        <published>2025-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7863/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7863-block-level-warming/22572" />
        

        <id>https://wg-eips.ritovision.com/7863/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7863"
            label="EIP-7863" />
        

        
        

        
        <summary type="html">Warm addresses and storage keys over the duration of a block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7863/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces block-level address and storage key warming, allowing accessed addresses and storage keys to maintain their &quot;warm&quot; status throughout an entire block&#x27;s execution. Accessed slots can be effectively cached at the block level, allowing for this optimization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the EVM&#x27;s storage slot warming mechanism operates at the transaction level, requiring each transaction to &quot;warm up&quot; slots independently, even when accessing the same storage locations within the same block. This design does not take advantage of the fact that modern node implementations can effectively cache storage access patterns at the block level. By extending the slot warming duration to the block level, we can:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reduce redundant warming costs for frequently accessed slots&lt;&#x2F;li&gt;
&lt;li&gt;Better align gas costs with actual computational overhead&lt;&#x2F;li&gt;
&lt;li&gt;Improve overall network throughput without compromising security.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As of Jan. 2025, the empirically measured efficiency gains are around 5%.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;mechanics&quot;&gt;Mechanics&lt;&#x2F;h3&gt;
&lt;p&gt;When a storage slot is accessed within a block:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The first access to a slot in a block incurs the cold access cost as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;All subsequent accesses to the same slot within the same block incur only the warm access cost as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The warm&#x2F;cold status resets at block boundaries&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block Processing&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;At the start of each block:
&lt;ul&gt;
&lt;li&gt;Initialize two empty sets &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For each transaction in the block:
&lt;ul&gt;
&lt;li&gt;Before processing storage access:
&lt;ul&gt;
&lt;li&gt;Check if touched address is in &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If yes: charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If no:
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Add address to &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Check if storage key is in &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If yes: charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If no:
&lt;ul&gt;
&lt;li&gt;Charge &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Add storage key to &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation-details&quot;&gt;Implementation Details&lt;&#x2F;h3&gt;
&lt;p&gt;The implementation modifies the block execution process to maintain block-level sets of accessed addresses and storage slots.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-level-storage-management&quot;&gt;Block-Level Storage Management&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize block-level tracking sets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create environment with block-level context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Environment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other parameters ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process transaction and update block-level sets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; logs&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; accessed_addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; accessed_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This code shows how block-level slot warming is implemented at the execution layer. The &lt;code&gt;block_level_accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;block_level_accessed_storage_keys&lt;&#x2F;code&gt; sets are maintained throughout the block&#x27;s execution and passed to each transaction&#x27;s environment.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-processing&quot;&gt;Transaction Processing&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Environment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;Exception&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Add block-level pre-accessed slots&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    preaccessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_level_accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Handle access lists from transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This adds the block-level-accessed addresses and storage keys to the preaccessed addresses and storage keys.
As a result, from the perspective of a transaction, block-level accessed addresses and storage keys are treated the same as precompiles or the coinbase address.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_message_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Message&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; env&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Environment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; MessageCallOutput&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; MessageCallOutput&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other fields ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accessed_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The message call processing tracks accessed addresses and storage keys during execution, which are then propagated back up to the transaction level and ultimately to the block level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal builds on several key observations:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Caching Efficiency&lt;&#x2F;strong&gt;: Modern Ethereum clients already implement sophisticated caching mechanisms at the block level. Extending address and storage key warming to match this caching behavior better aligns gas costs with actual computational costs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Backward Compatibility&lt;&#x2F;strong&gt;: The worst-case scenario for any transaction remains unchanged - it will never pay more than the current cold access cost for its first access to a slot.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Handling Reverts&lt;&#x2F;strong&gt;: In EIP-2929, if a sub-call reverts, all accessed addresses and slots are reverted to a cold state. Under block-level warming, it remains an open question whether a failing transaction (i.e., one that reverts) should ‘unwarm’ previously warmed addresses and slots for subsequent transactions within the same block. Some propose removing this revert-induced “cold reset” altogether to maintain consistency with block-level warming. This point warrants further discussion, particularly around whether or not preserving a warmed state even upon failure aligns with the broader goal of better matching gas costs to actual client caching behavior.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;First Access Warms For All&lt;&#x2F;strong&gt;: Under the proposed mechanism, the first transaction in a block that accesses and warms multiple addresses or storage slots bears the entire cost of warming, even if subsequent transactions benefit from those already-warmed slots without incurring additional costs. This approach is deemed acceptable because early execution within a block—where warming typically occurs—is generally occupied for transactions placed by professional builders aiming for top-of-block execution. Since the resulting cost discrepancy is relatively minor, a more complex cost-sharing model is avoided in favor of maintaining simplicity.
An alternative to the one-warms-for-all mechanism involves distributing the warming costs across all accesses within a block. In this approach, each transaction must at least be able to pay the cold access cost. Once all transactions in the block are executed, the total warming costs are evenly distributed, and transaction originators are refunded accordingly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Alternative Block Warming Windows&lt;&#x2F;strong&gt;: Instead of applying warming at the block level, more advanced multi-block warming approaches can be considered. Potential options include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Warming addresses and storage keys over the duration of an epoch&lt;&#x2F;li&gt;
&lt;li&gt;Using a ring buffer spanning &lt;code&gt;x&lt;&#x2F;code&gt; blocks
Since the Execution Layer (EL) currently operates without regard to epoch boundaries, it may be preferable to maintain this design. Therefore, the second option, involving a ring buffer of size x, could be more suitable. For the ring buffer, one approach might be to store the relevant warmed information in the block header for those x blocks, but this introduces additional overhead and can complicate statelessness. Careful design would be required to manage these trade-offs (e.g., header size, client complexity) if a multi-block warming solution were adopted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backward compatible and requires a hard fork activation. However, it does not introduce any breaking changes for existing contracts, as:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;All existing transactions will continue to work as before&lt;&#x2F;li&gt;
&lt;li&gt;Gas costs will only decrease, never increase&lt;&#x2F;li&gt;
&lt;li&gt;Contract logic depending on gas costs will remain valid, as the worst-case scenario is unchanged&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Memory Usage&lt;&#x2F;strong&gt;: The set of warm slots is still bounded by block gas limit &#x2F; minimum gas cost per slot access, preventing DoS attacks through excessive memory usage.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;MEV Considerations&lt;&#x2F;strong&gt;: Block producers can optimize transaction ordering to maximize slot warming benefits for themselves. Third-party block builders can backrun transactions that warmed specific addresses or storage keys.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deactivate&#x2F;Reactivate a Delegated EOA&#x27;s Key</title>
        <published>2024-12-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Liyi Guo</name><uri>https://github.com/colinlyguo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7851/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7851-deactivate-reactivate-a-delegated-eoas-key/22344" />
        

        <id>https://wg-eips.ritovision.com/7851/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7851"
            label="EIP-7851" />
        

        
        

        
        <summary type="html">Introduce a new precompiled contract for EOAs with delegated code to deactivate or reactivate private keys.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7851/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a precompiled contract that enables Externally Owned Accounts (EOAs) with delegated control to smart contracts via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; to deactivate or reactivate their private keys. This design does not require additional storage fields or account state changes. By leveraging delegated code, reactivation can be performed securely through mechanisms such as social recovery.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; enables EOAs to gain smart contract capabilities, but the private key of the EOA still retains full control over the account.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, EOAs can fully migrate to smart contract wallets, while retaining private key recovery options with reactivation. The flexible deactivate and reactivate design also paves the way for native account abstraction. e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;&quot;&gt;EIP-7701&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xTBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PRECOMPILE_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;13000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;delegated-code-encoding&quot;&gt;Delegated Code Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;The deactivation status is encoded by appending or removing the &lt;code&gt;0x00&lt;&#x2F;code&gt; byte at the end of the delegated code. The transitions between two states are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Active state: &lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;. The private key is active and can sign transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Deactivated state: &lt;code&gt;0xef0100 || address || 0x00&lt;&#x2F;code&gt;. The private key is deactivated and cannot sign transactions or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation authorizations.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;precompiled-contract&quot;&gt;Precompiled Contract&lt;&#x2F;h3&gt;
&lt;p&gt;A new precompiled contract is introduced at address &lt;code&gt;PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;. It costs &lt;code&gt;PRECOMPILE_GAS_COST&lt;&#x2F;code&gt; and executes the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returns a precompile contract error, consumes all gas, and no state changes are made if:
&lt;ul&gt;
&lt;li&gt;Gas is insufficient.&lt;&#x2F;li&gt;
&lt;li&gt;Called via &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (i.e., in a read-only context).&lt;&#x2F;li&gt;
&lt;li&gt;Caller is not an EOA with delegated code (prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt; as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Updates caller&#x27;s delegated code based on length:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;23&lt;&#x2F;code&gt; bytes (&lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;): Appends &lt;code&gt;0x00&lt;&#x2F;code&gt; to deactivate private key authorization.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;24&lt;&#x2F;code&gt; bytes (&lt;code&gt;0xef0100 || address || 0x00&lt;&#x2F;code&gt;): Removes last byte &lt;code&gt;0x00&lt;&#x2F;code&gt; to activate private key authorization.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Saves updated code as caller&#x27;s new account code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transaction-validation&quot;&gt;Transaction Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validation to check whether a private key is deactivated (identified by a code prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt; and a code length of &lt;code&gt;24&lt;&#x2F;code&gt;) MUST be performed in the following scenarios:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;During transaction validity checks before execution, nodes MUST reject transactions signed with deactivated private keys to ensure such transactions cannot be included in blocks.&lt;&#x2F;li&gt;
&lt;li&gt;The same validation MUST be applied to the transaction pool when receiving new transactions to prevent invalid transactions from propagating through the network.&lt;&#x2F;li&gt;
&lt;li&gt;Any &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization issued by an authority with a deactivated private key MUST be treated as invalid and skipped.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;cost-of-precompiled-contract&quot;&gt;Cost of Precompiled Contract&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;PRECOMPILE_GAS_COST&lt;&#x2F;code&gt; represents the gas required to validate and potentially update an account&#x27;s code. A fair cost for calling this precompiled contract can be determined by analyzing its impact on the node:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reading the code of the address: &lt;code&gt;2600&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Changing the code hash (from non-zero to non-zero): &lt;code&gt;5000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Deploying at most &lt;code&gt;24&lt;&#x2F;code&gt; bytes of code: &lt;code&gt;200 * 24 = 4800&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The primary operation consumes a total of &lt;code&gt;12400&lt;&#x2F;code&gt; gas. To account for additional overhead, such as context switching during state transitions, as well as code prefix and length validations, the cost is rounded up to &lt;code&gt;13000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-transaction-validation-overhead&quot;&gt;Additional Transaction Validation Overhead&lt;&#x2F;h3&gt;
&lt;p&gt;Due to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, nodes already load the account code during transaction validation to verify whether the sender is an EOA (empty code or code with prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt;). This EIP introduces only a code length check after loading the code, resulting in minimal additional overhead. Similarly, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;’s authorization validation already involves retrieving the account code, with this EIP adding only a code length check, which is negligible compared to code reading.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction pools already perform state-based checks, such as those for nonce and balance. This EIP adds an account code read and a length check, which together are comparable to nonce and balance validations. DoS prevention mechanisms, expected in transaction pools, also support these additional checks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;an-alternative-eoa-deprecation-approach&quot;&gt;An Alternative EOA Deprecation Approach&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative deprecation approach involves using a hard fork to edit all existing and new EOAs to pre-written upgradeable smart contracts, which utilize the original EOA private key for authorization. Users can add and replace keys, or upgrade the smart contracts to other implementations. However, this approach is incompatible with EOAs already delegated to smart contracts, as it will overwrite the existing smart contract implementations. This EIP aims to fill this migration gap.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-a-precompiled-contract&quot;&gt;Using a Precompiled Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative methods for deactivating and reactivating EOA private keys include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Adding a new transaction type: Introducing a new transaction type could provide a mechanism to deactivate and reactivate EOA private keys. However, reactivating the private key would rely on a delegated contract as the authorizer, which complicates defining the rules for the new transaction type.&lt;&#x2F;li&gt;
&lt;li&gt;Deploying a smart contract: Compared to reusing the code field, using a smart contract has higher costs: (i) it requires new contract storage slots to track the deactivation status of each address (ii) executing bytecode increases the overhead of the node compared to precompiled contracts, (iii) during transaction validation, reusing the code field allows deactivation status check to be combined with existing code loading in some scenarios, thereby reducing the need for additional storage reads, as discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7851&#x2F;#additional-transaction-validation-overhead&quot;&gt;Additional Transaction Validation Overhead&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;in-protocol-reactivation&quot;&gt;In-Protocol Reactivation&lt;&#x2F;h3&gt;
&lt;p&gt;This approach ensures maximum compatibility with future migrations. EOAs can reactivate their private keys, delegate their accounts to an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;&quot;&gt;EIP-7701&lt;&#x2F;a&gt; contract, and then deactivate their private keys again. This avoids the limitations of contract upgrades. e.g., to remove legacy proxy contracts (reducing gas overhead) when upgrading to EOF contracts, one can reactivate the EOA and redelegate it to an EOF proxy contract.&lt;&#x2F;p&gt;
&lt;p&gt;Reactivation can only be performed by the delegated contract. Since reactivating the private key grants full control over the wallet, wallets must implement this interface with strict security measures. These measures should treat reactivation as the highest level of authority, equivalent to full wallet ownership. Users should delegate their EOAs only to wallets that have been thoroughly audited and follow best practices for security.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;avoiding-delegated-code-prefix-modification&quot;&gt;Avoiding Delegated Code Prefix Modification&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP appends a byte (&lt;code&gt;0x00&lt;&#x2F;code&gt;) to the delegated code instead of modifying the prefix (&lt;code&gt;0xef0100&lt;&#x2F;code&gt;) of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; to ensure forward compatibility. If new prefixes such as &lt;code&gt;0xef0101&lt;&#x2F;code&gt; are introduced in the future, changing the prefix to represent the deactivated status (e.g., &lt;code&gt;0xef01ff&lt;&#x2F;code&gt;) makes it unclear which prefix to restore (&lt;code&gt;0xef0100&lt;&#x2F;code&gt; or &lt;code&gt;0xef0101&lt;&#x2F;code&gt;) upon reactivation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;avoiding-account-state-changes&quot;&gt;Avoiding Account State Changes&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative is to add a &lt;code&gt;deactivated&lt;&#x2F;code&gt; field in the account state to track the status. However, this approach will introduce backward compatibility logic and more test vectors related to this optional field when enabling this EIP, because the field is not present in existing accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;When the private key is deactivated, this EIP introduces: (i) an extra byte (&lt;code&gt;0x00&lt;&#x2F;code&gt;) to be appended to the end of the delegated code, and (ii) the delegated code length becomes &lt;code&gt;24&lt;&#x2F;code&gt; bytes (e.g., &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; would return &lt;code&gt;24&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;These changes are not breaking. However, they require protocol, application, and contract implementations to use strict offsets to parse the delegated address correctly. Implementations must also check the delegated code prefix &lt;code&gt;0xef0100&lt;&#x2F;code&gt; to determine whether it represents an EOA with delegated code, while avoiding over-restrictive checks, such as asserting the code length to be exactly &lt;code&gt;23&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize the state database and precompiled contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StateDB&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;precompile&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Test 1: Valid activation and deactivation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0123&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;delegated_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1122334455667788990011223344556677889900&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;active_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DELEGATED_CODE_PREFIX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; delegated_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Active state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; active_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; active_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deactivated state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; active_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Turns to the active state again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 15000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Test 2: Error cases&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; read_only&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STATICCALL disallows state modification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;insufficient gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x4567&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EOA that is not delegated to code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the address is not an EOA delegated to code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x89ab&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This is a contract address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;60006000f3&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;error&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; precompile&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the address is not an EOA delegated to code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; gas_left&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PrecompiledContract&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    DELEGATED_CODE_PREFIX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fromhex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ef0100&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; read_only&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Switch the private key state of delegated EOAs between active and deactivated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - caller: The address calling the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - state_db: The state database&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - gas: Gas provided for execution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - read_only: Whether called in a read-only context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;        - Tuple of (result, gas_left)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          result: error bytes on failure, empty bytes on success&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;          gas_left: remaining gas, 0 on error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;        &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;insufficient gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check STATICCALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; read_only&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STATICCALL disallows state modification&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get and validate caller&amp;#39;s code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startswith&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DELEGATED_CODE_PREFIX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;the address is not an EOA delegated to code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update delegated code based on length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 23&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Active state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deactivate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 24&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deactivated state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Activate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Although this is not possible, it&amp;#39;s added for completeness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid delegated code length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PRECOMPILE_GAS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StateDB&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Simplified state database, omitting other account fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; __init__&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;accounts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;code&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contracts-using-ecdsa-secp256k1-signatures&quot;&gt;Contracts Using ECDSA &lt;code&gt;Secp256k1&lt;&#x2F;code&gt; Signatures&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts that have already been deployed and use ECDSA &lt;code&gt;secp256k1&lt;&#x2F;code&gt; signatures outside of transaction signatures (e.g., &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens that support &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;, the &lt;code&gt;permit&lt;&#x2F;code&gt; function) will not be able to verify the deactivated status of the EOA. This means that signatures signed by private keys will remain valid in these functions.&lt;&#x2F;p&gt;
&lt;p&gt;To handle deactivated EOAs, new or upgradeable contracts can check the signing address&#x27;s deactivation status, for example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; to get the account&#x27;s code length.&lt;&#x2F;li&gt;
&lt;li&gt;If the code length is &lt;code&gt;24&lt;&#x2F;code&gt; bytes, use &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; to verify the code starts with &lt;code&gt;0xef0100&lt;&#x2F;code&gt; (delegated code prefix).&lt;&#x2F;li&gt;
&lt;li&gt;If both conditions are satisfied (i.e., the code size is &lt;code&gt;24&lt;&#x2F;code&gt; bytes and the code starts with &lt;code&gt;0xef0100&lt;&#x2F;code&gt;), the private key is confirmed to be deactivated, and the signature should be rejected.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For non-upgradeable contracts, the above method cannot be applied directly. Another potential solution, at the protocol level, is to modify &lt;code&gt;ecRecover&lt;&#x2F;code&gt; precompiled contract: if the private key of the recovered address is deactivated, the &lt;code&gt;ecRecover&lt;&#x2F;code&gt; precompiled contract could return a precompile contract error (or, if not adding an error return path, return a zero address or a collision-resistant address, such as &lt;code&gt;0x1&lt;&#x2F;code&gt;). However, this approach also has limitations, as it cannot cover cases where contracts implement their own signature verification logic without relying on &lt;code&gt;ecRecover&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;irreversible-deactivation&quot;&gt;Irreversible Deactivation&lt;&#x2F;h3&gt;
&lt;p&gt;Delegating to a wallet that lacks reactivation support (e.g., by calling the precompiled contract through an appropriate interface) may result in irreversible deactivation. To mitigate this risk, users should delegate their EOAs only to thoroughly audited implementations that explicitly support this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deactivation-and-reactivation-replay&quot;&gt;Deactivation and Reactivation Replay&lt;&#x2F;h3&gt;
&lt;p&gt;Replay attacks can occur in two scenarios: (i) repeating the same authorization on a single chain, or (ii) using the authorization across different chains.&lt;&#x2F;p&gt;
&lt;p&gt;For deactivation through EOA-signed transactions, the use of nonces in transactions ensures the same message cannot be replayed multiple times on the same chain. Additionally, the replay protection mechanism provided by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;, if enabled, effectively prevents cross-chain message replay.&lt;&#x2F;p&gt;
&lt;p&gt;For deactivation or reactivation via delegated contracts, the contract should implement robust replay protection mechanism(s) (e.g., adding a customized nonce and the chain ID to the signed message) to safeguard against replay attacks both within the same chain and across different chains. Especially when the EOA has been (or will be) delegated to the same implementation on multiple chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Access List Cost</title>
        <published>2024-12-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7981/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7981-increase-access-list-cost/24680" />
        

        <id>https://wg-eips.ritovision.com/7981/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7981"
            label="EIP-7981" />
        

        
        

        
        <summary type="html">Price access lists for data to reduce maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7981/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP charges access lists for their data footprint, preventing the circumvention of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing. This effectively reduces the worst-case block size by ~21% with minimal impact on users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Access lists are only priced for storage but not for their data.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, access lists can circumvent the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing by contributing to EVM gas while still leaving a non-negligible data footprint. This enables achieving the maximal possible block size by combining access lists with calldata at a certain ratio.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Source&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2400&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1900&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Let &lt;code&gt;access_list_nonzero_bytes&lt;&#x2F;code&gt; and &lt;code&gt;access_list_zero_bytes&lt;&#x2F;code&gt; be the count of non-zero and zero bytes respectively in the addresses (20 bytes each) and storage keys (32 bytes each) contained within the access list.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;tokens_in_access_list = access_list_zero_bytes + access_list_nonzero_bytes * 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The access list cost formula changes from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; to include data cost:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ACCESS_LIST_ADDRESS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; access_list_addresses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; access_list_storage_keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor calculation is modified to include access list tokens:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;total_data_tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data_floor_gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; total_data_tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The gas used calculation becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; total_data_tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;21000 + TOTAL_COST_FLOOR_PER_TOKEN * total_data_tokens&lt;&#x2F;code&gt; or below its intrinsic gas cost is considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Access list data is always charged at floor rate (added to &lt;code&gt;access_list_cost&lt;&#x2F;code&gt;), and access list tokens are included in the floor calculation. This ensures:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Access list data always pays floor rate regardless of execution level&lt;&#x2F;li&gt;
&lt;li&gt;Access lists cannot be used to bypass the calldata floor pricing&lt;&#x2F;li&gt;
&lt;li&gt;Consistent pricing across all transaction data sources&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Requires updates to gas estimation in wallets and nodes. Normal usage patterns remain largely unaffected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_access_list_tokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Access&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Count data tokens in access list addresses and storage keys.&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; nonzero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_intrinsic_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Calculate intrinsic gas cost and floor gas cost.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Returns (intrinsic_gas, floor_gas).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calldata tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ulen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; calldata_zero_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Access list tokens and cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens_in_access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; has_access_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tokens_in_access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; calculate_access_list_tokens&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; access&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_ACCESS_LIST_ADDRESS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; ulen&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;access&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slots&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7981: Always charge data cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        access_list_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7981: Floor includes all data tokens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_data_tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_access_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    floor_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; total_data_tokens&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Intrinsic gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    create_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_CREATE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; init_code_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; is_create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    intrinsic_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; calldata_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; create_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; access_list_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floor_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP closes a loophole that allows circumventing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; floor pricing. Without this fix, attackers can achieve larger blocks than intended by combining access lists with calldata. All transaction data sources now contribute to the floor calculation consistently.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delayed State Root</title>
        <published>2024-12-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charlie Noyes</name><email>charlie@paradigm.xyz</email>
	</author>
	
	<author>
		<name>Dan Robinson</name><email>dan@paradigm.xyz</email>
	</author>
	
	<author>
		<name>Justin Drake</name><email>justin@ethereum.org</email>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7862/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7862-delayed-execution-layer-state-root/22559" />
        

        <id>https://wg-eips.ritovision.com/7862/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7862"
            label="EIP-7862" />
        

        
        

        
        <summary type="html">Separate state root computation from block validation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7862/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal decouples state root computation from block validation by deferring the execution layer&#x27;s state root reference by one block. Each block&#x27;s header contains the post-state root of the previous block rather than its own. Validators can attest to block validity without waiting for state root computation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;State root computation is a significant bottleneck in block production. With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt; (ePBS), builders have tighter timing constraints. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; (Block-Level Access Lists) enables parallel state access but doesn&#x27;t help with state root computation for builders.&lt;&#x2F;p&gt;
&lt;p&gt;With delayed state roots:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Builders compute one state root per slot&lt;&#x2F;strong&gt; (for the previous block) instead of thousands during the MEV auction window&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State root computation can use BAL data&lt;&#x2F;strong&gt; from the previous block to parallelize proof generation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;The critical path shifts&lt;&#x2F;strong&gt;: state root computation is frontloaded to the beginning of the slot rather than blocking attestations&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The state root in block &lt;code&gt;n&lt;&#x2F;code&gt; represents the post-state of block &lt;code&gt;n-1&lt;&#x2F;code&gt; (equivalently: the pre-state of block &lt;code&gt;n&lt;&#x2F;code&gt;). Light clients experience one slot of additional latency for state proofs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;header&quot;&gt;Header&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;state_root&lt;&#x2F;code&gt; field semantics change. No new fields are added.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ommers_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Post-state of block (n-1), i.e., pre-state of this block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Uint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_access_list_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;blockchain&quot;&gt;BlockChain&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BlockChain&lt;&#x2F;code&gt; object tracks the last computed state root:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Block&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    last_computed_state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header-validation&quot;&gt;Header Validation&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify delayed state root matches the last computed state root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_computed_state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... remaining validation unchanged&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;state-transition&quot;&gt;State Transition&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state_transition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; vm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;BlockEnvironment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        block_env&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        withdrawals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate all roots except state_root (already validated in header)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_output&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; InvalidBlock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ... other validations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute and store state root for the NEXT block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_computed_state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 255&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chain&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blocks&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;255&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fork-activation&quot;&gt;Fork Activation&lt;&#x2F;h3&gt;
&lt;p&gt;At activation block &lt;code&gt;F&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_fork&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;old&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; BlockChain&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize last_computed_state_root to current state root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (post-state of block F-1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_computed_state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;old&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; old&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Block &lt;code&gt;F&lt;&#x2F;code&gt; MUST contain the post-state root of block &lt;code&gt;F-1&lt;&#x2F;code&gt;. From &lt;code&gt;F+1&lt;&#x2F;code&gt; onwards, each block contains its parent&#x27;s post-state root.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;epbs-compatibility&quot;&gt;ePBS Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;&quot;&gt;EIP-7732&lt;&#x2F;a&gt;, the &lt;code&gt;ExecutionPayloadEnvelope&lt;&#x2F;code&gt; contains a CL &lt;code&gt;state_root&lt;&#x2F;code&gt; verified at the end of &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;. This EIP changes only the EL header&#x27;s &lt;code&gt;state_root&lt;&#x2F;code&gt; semantics. The CL state root verification is unaffected.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bal-synergy&quot;&gt;BAL Synergy&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7928&#x2F;&quot;&gt;EIP-7928&lt;&#x2F;a&gt; provides the block access list, which identifies all storage slots touched during execution. With delayed state roots, clients can:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Receive block &lt;code&gt;n&lt;&#x2F;code&gt; with BAL&lt;&#x2F;li&gt;
&lt;li&gt;Use the BAL to parallelize state root computation for block &lt;code&gt;n&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Include that root in block &lt;code&gt;n+1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Without this EIP, BALs don’t help with state root computation: the root is only known after execution finishes, which is too late to use within the same slot. With this proposal, builders can start constructing a block without fully executing the previous one, by applying the BAL state diff to the slot’s pre-state.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;light-client-impact&quot;&gt;Light Client Impact&lt;&#x2F;h3&gt;
&lt;p&gt;State proofs for block &lt;code&gt;n&lt;&#x2F;code&gt; require waiting for block &lt;code&gt;n+1&lt;&#x2F;code&gt;. Most light client protocols already tolerate multi-block delays for proof generation. The security model is unchanged; only timing shifts by one slot.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Requires a hard fork. Clients that do not implement this change will reject blocks with delayed state roots.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;reorganization-handling&quot;&gt;Reorganization Handling&lt;&#x2F;h3&gt;
&lt;p&gt;During reorgs, clients MUST recompute &lt;code&gt;last_computed_state_root&lt;&#x2F;code&gt; for each block in the new canonical chain. The delayed nature does not affect reorg logic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pre-state-availability&quot;&gt;Pre-state Availability&lt;&#x2F;h3&gt;
&lt;p&gt;Clients MUST retain the pre-state (post-state of parent block) until the current block&#x27;s state root is included in the next block. This is already standard practice for reorg handling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>On-chain upgrade signaling</title>
        <published>2024-12-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7848/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7848-on-chain-upgrade-signaling/22306" />
        

        <id>https://wg-eips.ritovision.com/7848/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7848"
            label="EIP-7848" />
        

        
        

        
        <summary type="html">Allows participants to indicate readiness for a client upgrade when producing blocks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7848/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a mechanism for clients to signal their willingness for a network upgrade by including a “reference implementation hash” field in each block. A network upgrade activates only if enough blocks specify that they are using the new software.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, upgrades to Ethereum Mainnet are announced on the ethereum.org blog. This proposal changes that process by activating upgrades based on the consent of network participants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum consensus clients shall identify with a reference implementation having its equivalent behaviors.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum consensus clients shall include a &lt;code&gt;referenceImplementationHash&lt;&#x2F;code&gt; (specified below) field immediately following the &lt;code&gt;extraData&lt;&#x2F;code&gt; field in the block header.&lt;&#x2F;p&gt;
&lt;p&gt;Proposed new Ethereum consensus clients shall initially behave as the then-current network does. If, and only if, a successful upgrade (defined below) is activated will the new behavior take effect.&lt;&#x2F;p&gt;
&lt;p&gt;When a network participant is willing to support a network upgrade, they shall immediately begin using the new software. The blocks they create including the new &lt;code&gt;referenceImplementationHash&lt;&#x2F;code&gt; will contribute to the network upgrade activation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-reference-implementation-hash&quot;&gt;The Reference Implementation Hash&lt;&#x2F;h3&gt;
&lt;p&gt;When proposing a network upgrade, the proposer shall point to a published, feature-complete reference implementation including the new software behaviors.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;strong&gt;reference implementation hash&lt;&#x2F;strong&gt; is the SHA-256 hash of the tarred source code of this reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h3&gt;
&lt;p&gt;Network participants shall study the reference implementation and decide whether they support an upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Network participants shall study any specific software they will run and ensure it faithfully implements the behaviors consistent with that reference implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;upgrade&quot;&gt;Upgrade&lt;&#x2F;h3&gt;
&lt;p&gt;Upgrade proposals (often referred to as hard fork EIPs) must specify an upgrade window and threshold. These parameters are implemented in the consensus client:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;VOTING_WINDOW_BEGIN&lt;&#x2F;code&gt;: the first block (inclusive) to count votes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt;: the last block (inclusive) to count votes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REFERENCE_IMPLEMENTATION_HASH&lt;&#x2F;code&gt;: this is defined above.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REQUIRED_APPROVALS&lt;&#x2F;code&gt;: the minimum number of approvals necessary for the upgrade.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The difference (&lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; - &lt;code&gt;VOTING_WINDOW_BEGIN&lt;&#x2F;code&gt;) must be strictly greater than 14400 (about two days) and should be chosen to provide sufficient time to advertise the upgrade to network participants.&lt;&#x2F;p&gt;
&lt;p&gt;The required approvals must be strictly greater than 50% of the blocks in the voting window. A higher threshold (such as 95% or more) is recommended.&lt;&#x2F;p&gt;
&lt;p&gt;When the block numbered &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; is created, the upgrade is considered &quot;activated&quot; if &lt;code&gt;REQUIRED_APPROVALS&lt;&#x2F;code&gt; or more blocks during the voting window had set &lt;code&gt;referenceImplementationHash&lt;&#x2F;code&gt; to the value &lt;code&gt;REFERENCE_IMPLEMENTATION_HASH&lt;&#x2F;code&gt;; otherwise, the upgrade fails.&lt;&#x2F;p&gt;
&lt;p&gt;Blocks created from &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; + 1 onward will use the new software behaviors if and only if the upgrade was successful.&lt;&#x2F;p&gt;
&lt;p&gt;For proof-of-work networks and other scenarios, it is possible that one fork activates the upgrade while another does not. In any case, blocks strictly greater than &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; shall be created according to the behaviors of the software considering the outcome of the votes in the voting window which are the ancestors of that block.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Just because an upgrade was activated, this does not necessarily mean that the new software behaviors must generate block &lt;code&gt;VOTING_WINDOW_END&lt;&#x2F;code&gt; + 1 differently than the old software behaviors. Perhaps the new software behaviors will stipulate that only blocks at some later time will generate differently. Perhaps the new software behaviors include some other consensus change which does not change how blocks are created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;forking-is-no-longer-possible&quot;&gt;Forking is no Longer Possible&lt;&#x2F;h3&gt;
&lt;p&gt;Since the merge, forking Ethereum Mainnet has become practically impossible. Validators stake valuable assets to participate in the network, so any rational validator will choose to upgrade only if they expect widespread adoption. If a validator expects 95% or more participants to upgrade, they should upgrade; if they expect only 5% or less, they should not. For intermediate cases, there is a threshold where a validator would rationally shut down (incurring a small penalty) rather than risk participating in the wrong network—which could result in slashing 100% of their staked ether (currently 16 Ether per share).&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, proper management of consensual upgrades is crucial.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;community-direction&quot;&gt;Community Direction&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The Ethereum project and community do not have an official mission statement or vision. However, this proposal asserts that the Ethereum community would prefer Ethereum Mainnet to be a community-directed project.&lt;&#x2F;li&gt;
&lt;li&gt;On-chain signaling of upgrades enables community direction in a way that is not possible today.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;window&quot;&gt;Window&lt;&#x2F;h3&gt;
&lt;p&gt;Using a voting window to count votes provides real-time on-chain feedback about upgrade readiness. The upgrade is activated only after the successful completion of the voting window.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;trademark&quot;&gt;Trademark&lt;&#x2F;h3&gt;
&lt;p&gt;The Ethereum Foundation (Stiftung Ethereum), Zug, Switzerland, owns the trademark “Ethereum.” As a result, if anybody publishes a proposed Ethereum Mainnet consensus client, the foundation may have the right to restrict marketing of that software as an “Ethereum” client. That also poses unique risks related to securities rules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-2124&quot;&gt;EIP-2124&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-2124 introduces a mechanism to communicate software versions between nodes. However, it does not allow for signaling readiness before an upgrade, nor does it specify what software is being upgraded to.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Any upgrade that achieves less than 100% participation will harm validators who do not participate.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Overlapping or competitive upgrades must be managed carefully; such scenarios could result in multiple networks achieving the minimum approval threshold.&lt;&#x2F;li&gt;
&lt;li&gt;An upgrade with an excessively long time period could hinder&#x2F;delay the proposal of subsequent upgrades.&lt;&#x2F;li&gt;
&lt;li&gt;Since the four voting parameters are embedded in the reference implementation, network participants must exercise due diligence to ensure that they understand the actual software behaviors.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights have been waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Scheduled function calls</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Keyvan Kambakhsh</name><uri>https://github.com/keyvank</uri>
	</author>
	
	<author>
		<name>Nobitex Labs</name><email>labs@nobitex.ir</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7833/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7833-scheduled-function-calls/21975" />
        

        <id>https://wg-eips.ritovision.com/7833/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7833"
            label="EIP-7833" />
        

        
        

        
        <summary type="html">Giving life to smart contracts by enabling their functions to be automatically invoked by block producers.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7833/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s smart contracts enable users to delegate control of their funds to code, but these contracts require an external trigger to execute. Timing is often critical, and issues such as network delays or malicious behavior by block producers—like MEV attacks—can prevent timely execution. To address these challenges, this Ethereum Improvement Proposal (EIP) introduces a new opcode, OFFERCALL, which allows contracts to schedule function calls. When functions self-schedule, they exhibit bot-like behavior. These scheduled calls would offer ETH to block producers as an incentive to prioritize their execution over manually submitted transactions. If the offer is not fulfilled, the bot is deactivated until manually re-ignited by the owner. The EIP proposes enforcing the execution of scheduled calls as a requirement for block validity. This could help mitigate MEV attacks, as block producers would be compelled to execute bots that neutralize market manipulation within the blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adding bot-like behavior to an EVM function is achieved by recursively scheduling a call to the same function in the next block. We propose introducing a new EVM opcode, OFFERCALL, which, as the name implies, offers ETH to be burnt to the block producer of the next block in exchange for invoking a function. These offers are aggregated and ranked by the Ethereum node, with only the top N offers being retained; all others are discarded. Scheduled calls must be executed before any user transactions, with execution order determined by their rank in the sorted list. The offered ETH is burnt to prevent block producers from exploiting the system by scheduling calls that pay the offered amounts back to themselves.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a solidity example of how the usage of OFFERCALL would look like:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Bot&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; offerPerCall&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offerPerCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ignite the bot with an initial invocation offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        offercall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; offerPerCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; setOffer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        offerPerCall &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; _offer&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do scheduled work&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The callee may reschedule itself in order to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; introduce a bot-like behavior.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The callee has to be careful about its offer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise it may die.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        offercall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; offerPerCall&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Once an offercall fails, the contract owner&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; may have to set a new offer by calling `setOffer`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; and then invoking the `update()` function again.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An OFFERCALL fails in two situations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract does not hold at least the offered amount of ETH.&lt;&#x2F;li&gt;
&lt;li&gt;The offered amount is not large enough to rank within the top N offers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the case of a self-scheduling function, once an OFFERCALL fails, the bot is deactivated. The only way to revive it is for the contract owner to manually call the function again, likely with a higher offer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind this Ethereum Improvement Proposal (EIP) stems from the need to enhance the reliability and fairness of smart contract execution on the Ethereum network. While Ethereum’s smart contracts allow for a high degree of programmability and automation, the execution of these contracts often depends on external triggers, such as user transactions or network conditions. This dependency introduces significant challenges, particularly in situations where timing is critical or when malicious actors, like block producers, can exploit the system for profit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of the new OFFERCALL opcode in this EIP requires a network upgrade, as it adds new functionality that is not currently supported by the Ethereum Virtual Machine (EVM). This change will affect how smart contracts can schedule and incentivize the execution of specific function calls, introducing a new mechanism that block producers must accommodate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The main concern with this EIP is whether it could lead to centralization, as wealthier users might dominate execution priorities. Burning unfulfilled offers partly addresses this by preventing endless offers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Separate Metadata Section for EOF</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kaan Uzdogan</name><uri>https://github.com/kuzdogan</uri>
	</author>
	
	<author>
		<name>Marco Castignoli</name><uri>https://github.com/marcocastignoli</uri>
	</author>
	
	<author>
		<name>Manuel Wedler</name><uri>https://github.com/manuelwedler</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7834/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7834-separate-metadata-section-for-eof/22138" />
        

        <id>https://wg-eips.ritovision.com/7834/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7834"
            label="EIP-7834" />
        

        
        

        
        <summary type="html">Introduce a new separate metadata section to the EOF</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7834/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new separate metadata section to the Ethereum Object Format (EOF) that is unreachable by the code, and any changes to which does not affect the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is desirable to include metadata in contract&#x27;s bytecode for various reasons. For instance, both the Solidity and Vyper compilers by default include the language and compiler version used to compile. Vyper (with 0.4.1) appends an integrity hash to the initcode in CBOR encoding. Solidity additionally includes the IPFS or the Swarm hash of the Solidity contract metadata.json file, and the experimental Solidity flag. The current (pre-EOF) practice is to append this CBOR encoded metadata section in the contract&#x27;s runtime bytecode, followed by the 2 bytes length of the CBOR encoded bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Solidity     ┌──────────────────────────────────────────0x0033 bytes──────────────────────────────────────────────┐&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...7265206c656e677468a2646970667358221220dceca8706b29e917dacf25fceef95acac8d90d765ac926663ce4096195952b6164736f6c634300060b0033&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This poses a problem for source code verification where the onchain bytecode is compared to the compiled bytecode of the given source code. During a contract verification, metadata sections, in particular the IPFS hash, need to be ignored and only the executional bytecode should be compared. Since pre-EOF bytecode is not structured, it is not possible to distinguish the metadata section from the executional bytecode easily. This gets even trickier in the case of factory contracts with multiple nested bytecodes, each having their own metadata sections. Verifiers need to implement their own heuristics and workarounds to find the metadata sections and ignore it.&lt;&#x2F;p&gt;
&lt;p&gt;The EOF brings structure to the bytecode by separating the code from the data, and placing the code of each contract in their respective containers. In its current form, this makes it possible to find the data easier than the pre-EOF bytecode. However, the current spec also does not describe a metadata section. Compilers currently need to place the contract metadata inside the data section which poses several problems:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It is not straightforward to distinguish the metadata part in the &lt;code&gt;data_section&lt;&#x2F;code&gt;, which poses the same problem as the pre-EOF bytecode.&lt;&#x2F;li&gt;
&lt;li&gt;Any change to the metadata&#x27;s size within the data section will change the executional bytecode, e.g. through shifting &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; offsets. With that, two identical contracts with different metadata sizes will not match during source code, since the code will be different.&lt;&#x2F;li&gt;
&lt;li&gt;The metadata can theoretically be reached by the code, e.g. via manipulating the &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; instructions.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Extending the format introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;, this EIP proposes to add a new OPTIONAL section in the body called &lt;code&gt;metadata_section&lt;&#x2F;code&gt; before the &lt;code&gt;data_section&lt;&#x2F;code&gt;, and to add two new OPTIONAL fields &lt;code&gt;kind_metadata&lt;&#x2F;code&gt; (value: &lt;code&gt;0x05&lt;&#x2F;code&gt;) and &lt;code&gt;metadata_size&lt;&#x2F;code&gt; to the header before the &lt;code&gt;kind_data&lt;&#x2F;code&gt; and &lt;code&gt;data_size&lt;&#x2F;code&gt; fields.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;container := header, body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;header :=&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic, version,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_type, type_size,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_code, num_code_sections, code_size+,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [kind_container, num_container_sections, container_size+,]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [kind_metadata, metadata_size,]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_data, data_size,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    terminator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body := types_section, code_section+, container_section*, [metadata_section], data_section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;types_section := (inputs, outputs, max_stack_increase)+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;header&quot;&gt;Header&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_metadata&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;td&gt;kind marker for metadata size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;metadata_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the metadata section content&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_data&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0xff&lt;&#x2F;td&gt;&lt;td&gt;kind marker for data size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the data section content (*)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;terminator&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;marks the end of the header&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;body&quot;&gt;Body&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;metadata_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary sequence of bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary sequence of bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The structure and the encoding of the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; is not defined by this EIP. It is left to the compilers, tooling, or the contract developers to define the encoding and the content. The current practice by the Solidity and Vyper compilers is to use CBOR encoding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;metadata_section&lt;&#x2F;code&gt; in the &lt;code&gt;body&lt;&#x2F;code&gt;, as well as the &lt;code&gt;kind_metadata&lt;&#x2F;code&gt; and &lt;code&gt;metadata_size&lt;&#x2F;code&gt; fields in the &lt;code&gt;header&lt;&#x2F;code&gt;, are OPTIONAL. This way, the compilers can avoid additional bytes in the container if they don&#x27;t want to write any metadata. The &lt;code&gt;data_section&lt;&#x2F;code&gt; can change in its size and content during deployment, therefore it needs to be REQUIRED, even if the data is empty. The &lt;code&gt;metadata_section&lt;&#x2F;code&gt; is not expected to change during the deployment.&lt;&#x2F;p&gt;
&lt;p&gt;The reason for placing the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; before the &lt;code&gt;data_section&lt;&#x2F;code&gt;, and assigning &lt;code&gt;kind_metadata&lt;&#x2F;code&gt; the value &lt;code&gt;0x05&lt;&#x2F;code&gt; (and not &lt;code&gt;0x04&lt;&#x2F;code&gt;) is to make it easier for the existing EOF tooling adapt the changes. Additionally, if the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; was placed after the &lt;code&gt;data_section&lt;&#x2F;code&gt;, changes to the &lt;code&gt;data_section&lt;&#x2F;code&gt; in deploy time would cause the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; to shift. By placing the &lt;code&gt;metadata_section&lt;&#x2F;code&gt; before, this could be mitigated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues are expected since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is not implemented yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations as this section is meant not to be executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SLOTNUM opcode</title>
        <published>2024-12-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marc Harvey-Hill</name><uri>https://github.com/Marchhill</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7843/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7843-slotnum-opcode/22234" />
        

        <id>https://wg-eips.ritovision.com/7843/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7843"
            label="EIP-7843" />
        

        
        

        
        <summary type="html">Opcode to get the current slot number</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7843/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to add a new opcode &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; (&lt;code&gt;0x4b&lt;&#x2F;code&gt;), that returns the corresponding slot number for the current block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are currently two ways to get the current slot number onchain:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Calculate from the block timestamp. This requires hardcoding the chain slot length into a smart contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Provide the slot number as calldata and prove it against the beacon block root (using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these approaches have significant drawbacks. (1) would break contracts in the event of a change to the slot length. (2) is expensive in terms of gas, encouraging approach (1) to be used instead.&lt;&#x2F;p&gt;
&lt;p&gt;A better approach is for the slot length to be abstracted away from applications, and instead the slot number can be calculated in the consensus layer client and exposed by an opcode. This paves the way for future changes to the slot length.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x4b&lt;&#x2F;code&gt;. It shall return one stack element.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output&quot;&gt;Output&lt;&#x2F;h3&gt;
&lt;p&gt;One element &lt;code&gt;slotNumber&lt;&#x2F;code&gt; is added to the stack; it is equal to the corresponding slot number for this block. &lt;code&gt;slotNumber&lt;&#x2F;code&gt; is a &lt;code&gt;uint64&lt;&#x2F;code&gt; in big endian encoding.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; is a fixed fee of &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rpc-changes&quot;&gt;RPC changes&lt;&#x2F;h3&gt;
&lt;p&gt;The slot number is calculated in the consensus layer and passed to the execution layer through the engine API.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h4&gt;
&lt;p&gt;The header encoding shall be extended to include a &lt;code&gt;slotNumber&lt;&#x2F;code&gt; field of type &lt;code&gt;uint64&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;engine-api-changes&quot;&gt;Engine API changes&lt;&#x2F;h4&gt;
&lt;p&gt;New objects &lt;code&gt;ExecutionPayloadV4&lt;&#x2F;code&gt; and &lt;code&gt;PayloadAttributesV4&lt;&#x2F;code&gt; are introduced, adding a &lt;code&gt;slotNumber&lt;&#x2F;code&gt; field of type &lt;code&gt;uint64&lt;&#x2F;code&gt;. The methods &lt;code&gt;engine_newPayloadV4&lt;&#x2F;code&gt;, &lt;code&gt;engine_getPayloadV6&lt;&#x2F;code&gt;, and &lt;code&gt;engine_forkChoiceUpdateV4&lt;&#x2F;code&gt; are added, to use the new objects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-price&quot;&gt;Gas Price&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode is priced to match similar opcodes in the &lt;code&gt;W_base&lt;&#x2F;code&gt; set.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calculation-in-consensus-layer&quot;&gt;Calculation in consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The slot number could alternatively be calculated in the execution layer using the timestamp, but it is more appropriate to calculate values pertaining to the beacon chain in the consensus layer. Additionally this avoids code duplication, as the slot number is already calculated in the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;zk-vm-proving&quot;&gt;ZK-VM proving&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SLOTNUM&lt;&#x2F;code&gt; opcode should not increase the complexity of proving EVM execution, as it is similar to existing opcodes such as &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt;. The slot number is included in the block header rather than as a &lt;code&gt;engine_newPayload&lt;&#x2F;code&gt; parameter, ensuring that the block is self-contained for proving; no extra inputs to the circuit are required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract size limit increase for EOF</title>
        <published>2024-11-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7830/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7830-contract-size-limit-increase-for-eof/21927" />
        

        <id>https://wg-eips.ritovision.com/7830/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7830"
            label="EIP-7830" />
        

        
        

        
        <summary type="html">Raise the limit for only EOF contracts to 64 KiB</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7830/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Revise the contract size limit for EOF contracts to be 64 KiB instead of the existing 24 KiB limit. Legacy contracts are unaffected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The contract size limit was introduced as a measure against DoS attacks. &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis is required for legacy contracts, and many of the algorithms performing it are not linear and&#x2F;or have unknown unknowns. This is one of the reasons for the hesitance of a limit increase.&lt;&#x2F;p&gt;
&lt;p&gt;For contract developers the limit poses annoying problems, given modern contracts with good error reporting would consume more space. They are forced to work with workarounds, like &quot;libraries&quot; (using &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), splitting an application across regular contracts (and &lt;code&gt;CALL&lt;&#x2F;code&gt;-ing across), or working with proxies (e.g. the &quot;diamond pattern&quot;). All these solutions have resulted in suboptimal patterns, bugs in deployed contracts, and loss of funds.&lt;&#x2F;p&gt;
&lt;p&gt;With EOF the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis is removed from runtime and a validation process is performed once during deployment. The initcode cost &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; introduced accounts for this validation too. Therefore, with EOF there are no known problems for increasing the limit, because the overheads are already accounted for.&lt;&#x2F;p&gt;
&lt;p&gt;Storage cost is already paid per contract byte.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; specifies &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; as 24576 bytes, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; specifies &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; as &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt; (49152 bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Starting &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, for EOF initcode&#x2F;code (code starting with the &lt;code&gt;0xEF 0x00&lt;&#x2F;code&gt; bytes) the limit is changed:&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; is set to 65536 bytes (64 KiB). This means &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; becomes 131072 bytes (128 KiB).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The 64 KiB limit is over 2x of existing limit, while it is not a significant increase, it is the realistic increase given the limitations of initcode. In EOF deployment the to-be-deployed code is stored as a section (&quot;subcontainer&quot;), which has a size limit of 64 KiB, therefore it is not possible to deploy larger contracts without introducing a large or variable-length-encoded size field.&lt;&#x2F;p&gt;
&lt;p&gt;A further increase can be proposed with applying these changes to EOF.&lt;&#x2F;p&gt;
&lt;p&gt;This increase still fits within the gas schedule, limiting the size to less than what gas limits allow.  In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; the gas limit was first set &quot;by setting the cap at a value slightly higher than what is feasible with current gas limits.&quot; At that time the gas limit had not exceeded 5M gas.&lt;&#x2F;p&gt;
&lt;p&gt;A simple analysis shows contract deployments for 64 KiB contracts to be between 14M and 16M gas, roughly close to the current 15M target.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cancun&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;This EIP&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;36M Gas&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Max Initcode&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Initcode bytes&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65,536&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Deployed Bytes&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;24,576&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65,536&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;165,331&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;65,536&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Zero byte ratio&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Initcode Cost&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&#x2F;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Intrinsic Gas&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;53,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Calldata Gas&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;366,685&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;972,893&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,449,859&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,939,866&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;EIP-3860 Gas&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;49,552&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;131,472&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;331,062&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;262,144&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;EVM Execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Code Deposit&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,915,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,107,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33,066,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,107,200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total Cost&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,484,437&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14,364,565&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;36,000,121&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;15,462,210&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that the Max 30M gas contract size of 135 KiB is outside the limits of what is proposed in this EIP and is included to show what it would take to exceed current gas limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards compatible change. Existing contracts are unaffected, and only new deployments see the effect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Given the analysis cost is paid as part of deployment, the size of contract should have no effect on the runtime.&lt;&#x2F;p&gt;
&lt;p&gt;A more thorough analysis may be needed to determine whether the proposed limit poses any risk because of client storage architectures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Gas Limit Cap</title>
        <published>2024-11-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Giulio Rebuffo</name><uri>https://github.com/Giulio2002</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7825/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7825-transaction-gas-limit-cap/21848" />
        

        <id>https://wg-eips.ritovision.com/7825/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7825"
            label="EIP-7825" />
        

        
        

        
        <summary type="html">Introduce a protocol-level cap on the maximum gas used by a transaction to 16,777,216 (2^24).</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7825/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a protocol-level cap on the maximum gas usage per transaction to 16,777,216 (2^24) gas. By implementing this limit, Ethereum can enhance its resilience against certain DoS vectors, improve network stability, and provide more predictability to transaction processing costs, especially in the context of increasing the gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, transactions can theoretically consume up to the entire block gas limit, which poses several risks:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;DoS Attacks&lt;&#x2F;strong&gt;: A single transaction consuming most or all of the block gas can result in uneven load distribution and impact network stability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;State Bloat Risks&lt;&#x2F;strong&gt;: High-gas transactions often result in larger state changes, increasing the burden on nodes and exacerbating the Ethereum state growth problem.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Validation Overhead&lt;&#x2F;strong&gt;: High-gas transactions can lead to longer block verification times, negatively impacting user experience and network decentralization.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;By limiting individual transactions to a maximum of 16,777,216 gas, we aim to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reduce the risks of single-transaction DoS attacks.&lt;&#x2F;li&gt;
&lt;li&gt;Promote fairer gas allocation across transactions within a block.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure better synchronization among nodes by mitigating extreme block validation times.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cap&quot;&gt;Gas Cap&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Enforce a protocol-level maximum of &lt;strong&gt;16,777,216 gas (2^24)&lt;&#x2F;strong&gt; for any single transaction.&lt;&#x2F;li&gt;
&lt;li&gt;This cap applies regardless of the block gas limit set by miners or validators.&lt;&#x2F;li&gt;
&lt;li&gt;Transactions specifying gas limits higher than 16,777,216 gas will be rejected with an appropriate error code (e.g., &lt;code&gt;MAX_GAS_LIMIT_EXCEEDED&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;changes-to-evm-behavior&quot;&gt;Changes to EVM Behavior&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Txpool Validation&lt;&#x2F;strong&gt;: During transaction validation, if the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; specified by the sender exceeds 16,777,216, the transaction is invalidated (not included in the txpool).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Validation&lt;&#x2F;strong&gt;: As part of block validation before processing, any block having a transaction with &lt;code&gt;gasLimit&lt;&#x2F;code&gt; &amp;gt; 16,777,216 is deemed invalid and rejected.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;protocol-adjustment&quot;&gt;Protocol Adjustment&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;GAS_LIMIT&lt;&#x2F;code&gt; parameter for transactions will be capped in client implementations at 16,777,216.&lt;&#x2F;li&gt;
&lt;li&gt;This cap is &lt;strong&gt;independent&lt;&#x2F;strong&gt; of the block gas limit, which exceeds this value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-16-777-216-2-24&quot;&gt;Why 16,777,216 (2^24)?&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed cap of 16,777,216 gas (2^24) provides a clean power-of-two boundary that simplifies implementation while still being large enough to accommodate most complex transactions, including contract deployments and advanced DeFi interactions. This value represents approximately half of typical block sizes (30-40 million gas), ensuring multiple transactions can fit within each block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatibility-with-current-gas-dynamics&quot;&gt;Compatibility with Current Gas Dynamics&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Backward Compatibility&lt;&#x2F;strong&gt;: Transactions with gas usage below 16,777,216 remain unaffected. Existing tooling and dApps need only minor updates to enforce the new cap.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Impact on Validators&lt;&#x2F;strong&gt;: Validators can continue to process blocks with a gas limit exceeding 16,777,216, provided individual transactions adhere to the cap.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is &lt;strong&gt;not backward-compatible&lt;&#x2F;strong&gt; with transactions that specify gas limits exceeding 16,777,216. Transactions with such high limits will need to be split into smaller operations. This adjustment is expected to impact a minimal number of users and dApps, as most transactions today fall well below the proposed cap.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7825&#x2F;assets&#x2F;analysis&#x2F;&quot;&gt;empirical analysis&lt;&#x2F;a&gt; has been conducted to assess the potential impact of this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;DoS Mitigation&lt;&#x2F;strong&gt;: A fixed cap reduces the risk of DoS attacks caused by excessively high-gas transactions.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Block Verification Stability&lt;&#x2F;strong&gt;: By capping individual transactions, the validation of blocks becomes more predictable and uniform.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Edge Cases&lt;&#x2F;strong&gt;: Certain highly complex transactions, such as large contract deployments, may require re-architecting to fit within the 16,777,216 gas cap.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SETDELEGATE instruction</title>
        <published>2024-11-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7819/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7819-create-delegate/21763" />
        

        <id>https://wg-eips.ritovision.com/7819/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7819"
            label="EIP-7819" />
        

        
        

        
        <summary type="html">Introduce a new instruction allowing contracts to create clones using EIP-7702 delegation designations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7819/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new instruction that allows smart contracts to create (and update) delegation accounts that match &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;&#x27;s design. These accounts can be used similarly to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1167&#x2F;&quot;&gt;ERC-1167&lt;&#x2F;a&gt; clones, with significant advantages.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many on-chain applications involve creating multiple instances of the same code at different locations. These applications often rely on clones, or proxies, to reduce deployment costs.&lt;&#x2F;p&gt;
&lt;p&gt;Clones, such as the one described in ERC-1167 are minimal pieces of code that contain the target address directly in the code. That makes them extremely light but prevents any form of reconfiguration (upgradability).&lt;&#x2F;p&gt;
&lt;p&gt;Upgradeable proxies differ from clones in that they read the implementation&#x27;s address from storage. This makes them more versatile but also more expensive to use.&lt;&#x2F;p&gt;
&lt;p&gt;In both cases delegating the received calls to an implementation using EVM code comes with some downsides:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Calldata must be copied to memory before performing the delegate call&lt;&#x2F;li&gt;
&lt;li&gt;If EOF is enabled, clones and proxy written in EOF do not support delegation to an implementation written in legacy EVM code, and are thus limited or possibly dangerous. This encourages the continued use of legacy EVM code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;EIP-7702 introduces a new type of object that has the expected behavior: delegation indicator. These objects are designed to be instantiated at the address of EOA&#x27;s, but the same behavior could be re-used to implement clones at the protocol level. Using delegation indicators for this use-case provides upgradeability without the need for storage lookups if the contract calling the &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; allows it. It also removes any issue related to code version incompatibilities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-abstraction&quot;&gt;Account abstraction&lt;&#x2F;h3&gt;
&lt;p&gt;Smart accounts, as in contracts that are &quot;owned&quot; by one or multiple keys and are intended to replace EOAs, are often deployed using clones or proxies that point to a singleton implementation. This forces a choice between having an upgradeable or a non-upgradeable design. Both designs come with downsides. Non-upgradeable design can leave you stranded with a buggy (or limited) account code. Upgradeable design comes with costs associated with fetching the implementation address.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; instruction would enable new factories to implement an upgradeable design without the added cost of the lookup. Factories could also deploy non-upgradeable variants, or even selectively disable the upgradeability of some accounts. Both the upgrade mechanism and the selective locking would be handled at the factory level, which removes the burden of implementing the upgrade logic into the account itself.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, using EIP-7702 delegations instead of clones&#x2F;proxies moves the call redirection logic from the userspace to the protocol. This means fewer EVM operations, and thus a reduced gas consumption of every operation that calls these contracts. This includes the verification of signatures and the execution of user operations, but also transfers of assets that include a callback, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; tokens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scalability&quot;&gt;Scalability&lt;&#x2F;h3&gt;
&lt;p&gt;Clones and proxy contracts are present in large numbers in the blockchain state. OpenZeppelin&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1967&#x2F;&quot;&gt;ERC-1967&lt;&#x2F;a&gt; proxies are ~708 bytes. Using EIP-7702 delegations that are only 23 bytes would reduce blockchain state usage.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, clones and proxy contracts have to handle the redirection of the call in the userspace, which includes execution cost. Using EIP-7702 delegations, which would move the redirection to the protocol level, would reduce the gas cost of all operations that target. This means more gas &#x2F; blockspace is available for the actual execution of the contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new instruction (&lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;) is added at &lt;code&gt;0xf6&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;Executing this instruction does the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;deduct &lt;code&gt;EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;halt if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;pop &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;target&lt;&#x2F;code&gt; from the operand stack&lt;&#x2F;li&gt;
&lt;li&gt;calculate &lt;code&gt;location&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(DESIGNATOR ++ address ++ salt)[12:]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;add &lt;code&gt;location&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;halt if the code at &lt;code&gt;location&lt;&#x2F;code&gt; is not empty and does not start with &lt;code&gt;0xEF0100&lt;&#x2F;code&gt; (no empty and not a delegation indicator)&lt;&#x2F;li&gt;
&lt;li&gt;add &lt;code&gt;EMPTY_ACCOUNT_COST - BASE_COST&lt;&#x2F;code&gt; gas to the global refund counter if &lt;code&gt;location&lt;&#x2F;code&gt; exists in the trie&lt;&#x2F;li&gt;
&lt;li&gt;set the code of &lt;code&gt;location&lt;&#x2F;code&gt; to be &lt;code&gt;DESIGNATOR ++ target&lt;&#x2F;code&gt;, matching the delegation process defined in EIP-7702
&lt;ul&gt;
&lt;li&gt;Similarly to EIP-7702, if &lt;code&gt;target&lt;&#x2F;code&gt; is &lt;code&gt;0x0&lt;&#x2F;code&gt; do not write the designation. Clear the code at &lt;code&gt;location&lt;&#x2F;code&gt; and reset the &lt;code&gt;location&lt;&#x2F;code&gt;&#x27;s code hash to the empty hash &lt;code&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;if the nonce of the account at &lt;code&gt;location&lt;&#x2F;code&gt; is 0, increment it to 1&lt;&#x2F;li&gt;
&lt;li&gt;push &lt;code&gt;location&lt;&#x2F;code&gt; onto the stack&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;On step 8, &lt;code&gt;target&lt;&#x2F;code&gt; MUST be exactly 20 bytes. If the value retrieved from the stack is smaller than 20 bytes, it MUST be left fill (big-endian notation) with zeros. If it is bigger than 20 bytes, it must be trimmed of the highest bytes. The code placed at &lt;code&gt;location&lt;&#x2F;code&gt; MUST be exactly 23 bytes long, following EIP-7702.&lt;&#x2F;p&gt;
&lt;p&gt;The delegation indicator created at &lt;code&gt;location&lt;&#x2F;code&gt; behaves identically to those created by EIP-7702.&lt;&#x2F;p&gt;
&lt;p&gt;Note: The delegation is effective immediately upon the completion of the operation. Calls to the address as soon as the next operation will execute the newly delegated code.&lt;&#x2F;p&gt;
&lt;p&gt;The delegation indicators created by the &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; opcode are the same objects as the one created using EIP-7702. Therefore, all the behavior specificities documented in EIP-7702 (&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, targeting precompile, or chaining delegation indicator) also apply here. Any future EIP that modify the behavior of EIP-7702 delegation indicators should also apply to the delegation indicators created using &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;. They are not contracts, and cannot be deleted using &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, even if the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; appens in the same transaction that created the account at &lt;code&gt;location&lt;&#x2F;code&gt;. Destruction of the delegations SHOULD only be possible by the same caller (that created them) doing a new &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; call with the same salt and a zero target.&lt;&#x2F;p&gt;
&lt;p&gt;Step 9 ensures that an account that was created using &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; never returns to an empty state (forbiden by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7523&#x2F;&quot;&gt;EIP-7523&lt;&#x2F;a&gt;). Even if the balance is zero, no state was ever set, and the code is removed by a &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; operation (with zero target), then the nonce being (at least) one would guarantee the account is not empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;These parameters are the same ones as used in EIP-7702.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DESIGNATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0xef0100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;25000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The execution of the &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; instruction involves fewer moving pieces than what EIP-7702 gas costs account for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;there is no signature recovery&lt;&#x2F;li&gt;
&lt;li&gt;there is no dedicated calldata that must be accounted for that is not already paid for at the transaction level&lt;&#x2F;li&gt;
&lt;li&gt;there is no nonce update&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Therefore, the cost of executing this instruction could be lower than EIP-7702. Numbers from EIP-7702 are reused for simplicity. They are lower than &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; operations, making the use of this instruction competitive for the intended use-cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;address-collision&quot;&gt;Address collision&lt;&#x2F;h3&gt;
&lt;p&gt;The derivation of the &lt;code&gt;location&lt;&#x2F;code&gt; is designed not to conflict with contracts created using the &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcodes. In particular, the pre-images used to hash the produced address have different lengths, preventing any collision:&lt;&#x2F;p&gt;
&lt;p&gt;Contracts deployed using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; have an address that is derived from a 85 bytes long pre-image, as opposed to 55 bytes for &lt;code&gt;SET_DELEGATE&lt;&#x2F;code&gt;. This observation alone remove the risk of pre-image collision.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts deployed using &lt;code&gt;CREATE&lt;&#x2F;code&gt; have an address that is derived from the &lt;code&gt;RLP([address, nonce])&lt;&#x2F;code&gt;. For this pre-image to have a length 55 (like &lt;code&gt;SET_DELEGATE&lt;&#x2F;code&gt;), &lt;code&gt;nonce&lt;&#x2F;code&gt; must be 32 bytes long. In that case, the &lt;code&gt;RLP([address, nonce])&lt;&#x2F;code&gt; would be &lt;code&gt;0xf694&amp;lt;address&amp;gt;a0&amp;lt;nonce&amp;gt;&lt;&#x2F;code&gt; and would thus not start with the magic value used by &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;. A smaller nonce could lead to the pre-image starting with &lt;code&gt;0xef&lt;&#x2F;code&gt;, but in that case the pre-image would be smaller than 55 bytes. Even in that case, the pre-image would start with &lt;code&gt;0xef94&lt;&#x2F;code&gt;, &lt;code&gt;0x94&lt;&#x2F;code&gt; encoding the &lt;code&gt;address&lt;&#x2F;code&gt; object (that is 20 bytes long).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;delegator-upgrades-deletion&quot;&gt;Delegator upgrades &amp;amp; deletion&lt;&#x2F;h3&gt;
&lt;p&gt;Reusing EIP-7702 behavior, including clearing the code if the target is 0, results in the ability to upgrade or even &quot;remove&quot; the created designator. This process is controlled (and can be restricted) by the factory (the contract that calls &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt;). Some factories will add checks that prevent re-executing &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; with a salt that was already used, making the create designator immutable. Others may allow access-restricted upgrades, but prevent deletion. In any case, guarantees about the lifecycle of the designator created using &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; are provided by the contracts that call it and not by the protocol.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delegator-chaining&quot;&gt;Delegator chaining&lt;&#x2F;h3&gt;
&lt;p&gt;As documented in EIP-7702, designator chains or loops are not resolved. This means that, unlike clones, chaining is an issue. This is however something developers are used to, as chaining proxy can result in strange behaviors, including infinite delegation loops.&lt;&#x2F;p&gt;
&lt;p&gt;Factories may want to protect against this risk by verifying that the &lt;code&gt;target&lt;&#x2F;code&gt; doesn&#x27;t contain a designator. This can be achieved using a legacy contract helper that has access to &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;. It could also be done using other forms of introspection such as an &lt;code&gt;ACCOUNT_TYPE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;front-running-initialization&quot;&gt;Front running initialization&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike EIP-7702 signature, which can be included in any transaction, and can thus lead to initialization front-running if the implementation doesn&#x27;t check the authenticity of the initialization parameters, &lt;code&gt;CREATE_DELEGATE&lt;&#x2F;code&gt; is executed by a smart contract that can execute the initialization logic atomically, just after the delegation is created. This process is well-known to developers that initialize clones and proxies just after creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiple-delegation-changes-within-a-single-transaction&quot;&gt;Multiple delegation changes within a single transaction.&lt;&#x2F;h3&gt;
&lt;p&gt;If a contract performs multiple &lt;code&gt;SETDELEGATE&lt;&#x2F;code&gt; operations with the same salt but different targets within the same transaction, while doing calls corresponding address, this would have, in the same transaction without reverts, an address that has multiple different codes associated with it, two or more of which are executed. This include the delegation being removed&#x2F;reset any number of time during the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This behavior, is already possible with more traditional upgradeable contracts, where change of target are caused by a specific storage slot being modified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Set upper bounds for MODEXP</title>
        <published>2024-11-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Radoslaw Zagorowicz</name><uri>https://github.com/rodiazet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7823/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7823-set-upper-bounds-for-modexp/21798" />
        

        <id>https://wg-eips.ritovision.com/7823/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7823"
            label="EIP-7823" />
        

        
        

        
        <summary type="html">Each input field is restricted to a maximum of 8192 bits</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7823/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce an upper bound on the inputs of the MODEXP precompile. This can reduce the number of potential bugs, because the testing surface is not infinite anymore, and makes it easier to be replaced using EVMMAX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The MODEXP precompile has been a source of numerous consensus bugs. Many of them were due to specifically crafted cases using impractical input lengths.&lt;&#x2F;p&gt;
&lt;p&gt;Its pricing function is also quite complex given its nature of unbounded inputs. While we don&#x27;t suggest to rework the pricing function, it may be possible in a future upgrade once the limits are in place.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore this limitation makes it more feasible to have the precompile replaced with EVM code through features like EVMMAX.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Recap from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;At address &lt;code&gt;0x00……05&lt;&#x2F;code&gt;, add a precompile that expects input in the following format:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;length_of_BASE&amp;gt; &amp;lt;length_of_EXPONENT&amp;gt; &amp;lt;length_of_MODULUS&amp;gt; &amp;lt;BASE&amp;gt; &amp;lt;EXPONENT&amp;gt; &amp;lt;MODULUS&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We introduce an upper bound to the inputs of the precompile, each of the length inputs (&lt;code&gt;length_of_BASE&lt;&#x2F;code&gt;, &lt;code&gt;length_of_EXPONENT&lt;&#x2F;code&gt; and &lt;code&gt;length_of_MODULUS&lt;&#x2F;code&gt;) MUST be less than or equal to 8192 bits (1024 bytes).&lt;&#x2F;p&gt;
&lt;p&gt;If any of these inputs are larger than the limit, the precompile execution stops, returns an error, and consumes all gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;limit&quot;&gt;Limit&lt;&#x2F;h3&gt;
&lt;p&gt;This upper bound allows the existing use cases of MODEXP:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;RSA verification with up to 8192 bit keys. Commonly used ones are 1024&#x2F;2048&#x2F;4096 bits.&lt;&#x2F;li&gt;
&lt;li&gt;Elliptic curve related use cases are usually less than 384 bits.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;evmmax&quot;&gt;EVMMAX&lt;&#x2F;h3&gt;
&lt;p&gt;Replacing the precompile with EVM code using an instruction set like EVMMAX would be made simpler with this limit: Common cases (256, 381, 1024, 2048) could be implemented in special fast paths, while a slow fallback could be provided for the rest. Or even special, frequently used, moduli could have their own paths.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore one could consider limiting the lengths to certain inputs only.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;analysis&quot;&gt;Analysis&lt;&#x2F;h3&gt;
&lt;p&gt;Since MODEXP was introduced in the Byzantium hard fork, an analysis has been conducted between block 5472266 (April 20, 2018) and block 21550926 (January 4th, 2025). All lengths of inputs are expressed in bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;base-length-occurrences&quot;&gt;Base length occurrences&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;input_of_BASE&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;count&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;2439595&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;4167&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;td&gt;2969&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;160&lt;&#x2F;td&gt;&lt;td&gt;436&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;78&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;513&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;129&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;385&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;exponent-length-occurrences&quot;&gt;Exponent length occurrences&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;input_of_EXPONENT&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;count&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;2442255&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;4771&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;159&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;29&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;modulo-length-occurrences&quot;&gt;Modulo length occurrences&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;input_of_MODULUS&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;count&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;2439594&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;4167&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;td&gt;2968&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;160&lt;&#x2F;td&gt;&lt;td&gt;436&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;38&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;78&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;129&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;384&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;257&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This shows that no past successful use case exceeded an input length of 513 bytes, and the majority uses 32&#x2F;128&#x2F;256 byte inputs.&lt;&#x2F;p&gt;
&lt;p&gt;Besides these, there were a few invocations with invalid inputs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Empty inputs&lt;&#x2F;li&gt;
&lt;li&gt;Inputs consisting of only &lt;code&gt;0x9e5faafc&lt;&#x2F;code&gt; or &lt;code&gt;0x85474728&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A large, but invalid input: &lt;code&gt;0x9e281a98000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000021e19e0c9bab2400000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible change. However, based on analysis until block 21550926 (see above), no past transaction would have behaved differently after this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since only the accepted input range is reduced, no new security surface area is expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fork-choice enforced Inclusion Lists (FOCIL)</title>
        <published>2024-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Thomas Thiery</name><uri>https://github.com/soispoke</uri><email>thomas.thiery@ethereum.org</email>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><email>francesco.damato@ethereum.org</email>
	</author>
	
	<author>
		<name>Julian Ma</name><email>julian.ma@ethereum.org</email>
	</author>
	
	<author>
		<name>Barnabé Monnot</name><email>barnabe.monnot@ethereum.org</email>
	</author>
	
	<author>
		<name>Terence Tsao</name><email>ttsao@offchainlabs.com</email>
	</author>
	
	<author>
		<name>Jacob Kaufmann</name><email>jacob.kaufmann@ethereum.org</email>
	</author>
	
	<author>
		<name>Jihoon Song</name><email>jihoon.song@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7805/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7805-committee-based-fork-choice-enforced-inclusion-lists-focil/21578" />
        

        <id>https://wg-eips.ritovision.com/7805/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7805"
            label="EIP-7805" />
        

        
        

        
        <summary type="html">Allow a committee of validators to force-include a set of transactions in every block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7805/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;FOCIL implements a robust mechanism to preserve Ethereum’s censorship resistance properties by guaranteeing timely transaction inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;FOCIL (&lt;strong&gt;Fo&lt;&#x2F;strong&gt;rk-&lt;strong&gt;c&lt;&#x2F;strong&gt;hoice enforced &lt;strong&gt;I&lt;&#x2F;strong&gt;nclusion &lt;strong&gt;L&lt;&#x2F;strong&gt;ists) is built in a few simple steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In each slot, a set of validators is selected as inclusion list (IL) committee members. Each member builds and gossips one IL according to their subjective view of the mempool.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer and all attesters of the next slot monitor, store and forward available ILs.&lt;&#x2F;li&gt;
&lt;li&gt;The proposer (or the builder if the block is not built locally by the proposer) includes transactions from all collected ILs in its block. The proposer then broadcasts the block including IL transactions to the rest of the network.&lt;&#x2F;li&gt;
&lt;li&gt;Attesters only vote for the proposer&#x27;s block if it includes transactions from all stored ILs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In an effort to shield the Ethereum validator set from centralizing forces, the right to build blocks has been auctioned off to specialized entities known as &lt;em&gt;builders&lt;&#x2F;em&gt;. This has led to a few sophisticated builders dominating block production, leading to a deterioration of the network’s censorship resistance properties. To address this issue, research has focused on improving Ethereum&#x27;s transaction inclusion guarantees by enabling validators to impose constraints on builders. This is achieved by force-including transactions in blocks via ILs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;high-level-overview&quot;&gt;High-level Overview&lt;&#x2F;h3&gt;
&lt;p&gt;FOCIL is a committee-based, fork-choice enforced inclusion list (IL) design that improves upon previous IL mechanisms and block co-creation proposals. It addresses issues related to bribing&#x2F;extortion attacks, IL equivocation, account abstraction (AA), and transaction invalidation.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;.&#x2F;assets&#x2F;diagram_FOCIL.png&quot; alt=&quot;FOCIL diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;roles-and-participants&quot;&gt;Roles And Participants&lt;&#x2F;h3&gt;
&lt;p&gt;This section outlines the workflow of FOCIL, detailing the roles and responsibilities of various participants: IL committee members, validators, builders, proposers and attesters.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;il-committee-members&quot;&gt;IL Committee Members&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=0 to 8s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
IL committee members construct their ILs by including transactions pending in the public mempool, and broadcast them over the P2P network after processing the block for &lt;code&gt;slot N&lt;&#x2F;code&gt; and confirming it as the head. If no block is received by &lt;code&gt;t=7s&lt;&#x2F;code&gt;, they should run &lt;code&gt;get_head&lt;&#x2F;code&gt; and build and release their ILs based on the node’s local head.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;IL committee members may follow different strategies for constructing their ILs as discussed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;#il-building&quot;&gt;IL Building&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validators&quot;&gt;Validators&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=0s to 9s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Validators receive ILs from the P2P network and store (1) all new ILs that pass the CL P2P validation rules, and (2) any evidence of IL equivocation by committee members (i.e., if multiple ILs are received from the same committee member).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=9s&lt;&#x2F;code&gt; to &lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=4s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: After the view freeze deadline at &lt;code&gt;t=9s&lt;&#x2F;code&gt;, validators:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Do not store new ILs received after the deadline.&lt;&#x2F;li&gt;
&lt;li&gt;Continue forwarding ILs to peers following the CL P2P validation rules.&lt;&#x2F;li&gt;
&lt;li&gt;Record any evidence of IL equivocation that occurs after the view freeze deadline.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After the attestation deadline of &lt;strong&gt;&lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=4s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;, validators ignore any new ILs related to the previous slot&#x27;s IL committee, and stop recording equivocation evidence for the previous slot&#x27;s ILs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;builder&quot;&gt;Builder&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=0s to 11s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: The builder (i.e., a proposer doing local block building or an external builder) receives ILs from the P2P network, forwarding and caching those that pass the CL P2P validation rules. Optionally, an RPC endpoint can be added to allow the builder to request missing ILs from its peers (e.g., by committee index at &lt;code&gt;t=10s&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;Slot N&lt;&#x2F;code&gt;, &lt;code&gt;t=11s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
The builder freezes its view of ILs and asks the EL to update its execution payload by adding transactions from its view (the exact timings will be defined after running some tests&#x2F;benchmarks).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;proposer&quot;&gt;Proposer&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=0s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
The proposer broadcasts its block with the up-to-date execution payload satisfying IL transactions over the P2P network.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;attesters&quot;&gt;Attesters&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;Slot N+1&lt;&#x2F;code&gt;, &lt;code&gt;t=4s&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;:
Attesters monitor the P2P network for the proposer’s block. Upon detecting it, they verify whether all transactions from their stored ILs are included in the proposer’s execution payload, except for ILs whose sender has equivocated. Based on their frozen view of the ILs from &lt;code&gt;t=9s&lt;&#x2F;code&gt; in the previous slot, attesters check if the execution payload satisfies IL conditions. This is done either by confirming that all transactions are present or by determining if any missing transactions are invalid when appended to the end of the payload. In such cases, attesters use the EL to perform nonce and balance checks to validate the missing transactions and check whether there is enough space in the block to include the transaction(s).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;cl-p2p-validation-rules&quot;&gt;CL P2P Validation Rules&lt;&#x2F;h4&gt;
&lt;p&gt;When validators receive ILs from the P2P network, they perform a series of validation checks before forwarding or caching them. These rules protect against Denial-of-Service attacks by (1) limiting ILs&#x27; byte size and (2) restricting IL proposals to a small committee of IL committee members, thereby tightly bounding bandwidth, the main resource consumed by the propagation of ILs. Consumption of other relevant resources, such as verification time, is minimal because the only nontrivial check performed on IL propagation is signature verification. At this stage, there is no EL verification of the transactions within ILs. This means that ILs are allowed to contain any transactions—valid or invalid—since validators do not perform EL-side validity checks. This design choice is intended to avoid additional computational overhead.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The slot of the IL matches the current or previous slot.&lt;&#x2F;li&gt;
&lt;li&gt;The root of the IL committee referenced in the IL matches the expected IL committee root for its slot.&lt;&#x2F;li&gt;
&lt;li&gt;Received two or fewer ILs from this IL committee member (see IL equivocation section below).&lt;&#x2F;li&gt;
&lt;li&gt;The IL is correctly signed by the validator.&lt;&#x2F;li&gt;
&lt;li&gt;The validator is part of the IL committee.&lt;&#x2F;li&gt;
&lt;li&gt;The size of a IL does not exceed the maximum size allowed (e.g., &lt;code&gt;MAX_BYTES_PER_INCLUSION_LIST = 8 KiB&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;On the execution layer, an additional check is introduced for new payloads. After all of the transactions in the payload have been executed, we check whether any transaction from ILs, that is not already present in the payload, could be validly included (i.e. nonce and balance checks pass). If that is the case for any transaction, then an error is returned to the CL. Although the block is valid, the CL will not attest to it.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;B&lt;&#x2F;code&gt; denote the current block.
Let &lt;code&gt;S&lt;&#x2F;code&gt; denote the execution state following the execution of the last transaction in &lt;code&gt;B&lt;&#x2F;code&gt;.
Let &lt;code&gt;gas_left&lt;&#x2F;code&gt; be the gas remaining after execution of B.&lt;&#x2F;p&gt;
&lt;p&gt;For each transaction &lt;code&gt;T&lt;&#x2F;code&gt; in ILs, perform the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Check whether &lt;code&gt;T&lt;&#x2F;code&gt; is present in &lt;code&gt;B&lt;&#x2F;code&gt;. If &lt;code&gt;T&lt;&#x2F;code&gt; is present, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Check whether &lt;code&gt;B&lt;&#x2F;code&gt; has enough remaining gas to execute &lt;code&gt;T&lt;&#x2F;code&gt;. If &lt;code&gt;T.gas&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;gas_left&lt;&#x2F;code&gt;, then jump to the next transaction, else continue with next step.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Validate &lt;code&gt;T&lt;&#x2F;code&gt; against &lt;code&gt;S&lt;&#x2F;code&gt; by checking the nonce and balance of &lt;code&gt;T.origin&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is invalid, then continue to the next transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;T&lt;&#x2F;code&gt; is valid, terminate process and return an &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt; status.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;engine-api-changes&quot;&gt;Engine API Changes&lt;&#x2F;h4&gt;
&lt;p&gt;We make the following changes to the engine API:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;engine_getInclusionListV1&lt;&#x2F;code&gt; endpoint to retrieve an IL from the &lt;code&gt;ExecutionEngine&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;engine_updatePayloadWithInclusionListV1&lt;&#x2F;code&gt; endpoint to update a payload with the IL that should be used to build the block. This takes as an argument an 8-byte &lt;code&gt;payloadId&lt;&#x2F;code&gt; of the ongoing payload build process, along with the IL itself.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;engine_newPayload&lt;&#x2F;code&gt; endpoint to include a parameter for transactions in ILs determined by the IL committee member. If the IL is not satisfied an &lt;code&gt;INCLUSION_LIST_UNSATISFIED&lt;&#x2F;code&gt; status must be returned.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;il-building&quot;&gt;IL Building&lt;&#x2F;h4&gt;
&lt;p&gt;The rules for building ILs are left to the discretion of implementers. For instance, they may select transactions from the public mempool in various ways such as at random, by priority fee, or based on how long they have been pending. The IL has a maximum size of &lt;code&gt;MAX_BYTES_PER_INCLUSION_LIST = 8 KiB&lt;&#x2F;code&gt; for all of the RLP encoded transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The full consensus changes can be found in the following GitHub repository. They are split between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;beacon-chain.md&quot;&gt;Beacon Chain&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;fork-choice.md&quot;&gt;Fork choice&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;p2p-interface.md&quot;&gt;P2P&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;e678deb772fe83edd1ea54cb6d2c1e4b1e45cec6&#x2F;specs&#x2F;_features&#x2F;eip7805&#x2F;validator.md&quot;&gt;Honest validator guide&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;beacon-chain-changes&quot;&gt;Beacon chain changes&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;preset&quot;&gt;Preset&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_IL_COMMITTEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0C000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;IL_COMMITTEE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**4)&lt;&#x2F;code&gt; (=16)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BYTES_PER_INCLUSION_LIST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**13)&lt;&#x2F;code&gt; (=8192)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;new-containers&quot;&gt;New containers&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; InclusionList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_committee_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedInclusionList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; InclusionList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;fork-choice-changes&quot;&gt;Fork choice changes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Store ILs observed over gossip before the view freeze deadline.&lt;&#x2F;li&gt;
&lt;li&gt;If more than one IL is observed from the same IL committee member, mark the committee member as an equivocator and ignore any further ILs from them.&lt;&#x2F;li&gt;
&lt;li&gt;The beacon block from the current slot is only attested to if it satisfies IL conditions, based on all stored ILs from non equivocators.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;p2p-changes&quot;&gt;P2P changes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;SignedInclusionList&lt;&#x2F;code&gt; objects.&lt;&#x2F;li&gt;
&lt;li&gt;A new RPC topic for request &lt;code&gt;SignedInclusionList&lt;&#x2F;code&gt; based on IL committee index.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;core-properties&quot;&gt;Core Properties&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Committee-based: FOCIL relies on a committee of multiple validators, rather than a single proposer, to construct and broadcast ILs. This approach significantly reduces the surface for bribery and extortion attacks and strengthens censorship resistance.&lt;&#x2F;li&gt;
&lt;li&gt;Fork-choice enforced: FOCIL incorporates the force-inclusion mechanism into the fork-choice rule, an integral component of the consensus process, thereby preventing any actor from bypassing the system. Attesters vote only for blocks that include transactions from a set of ILs provided by the IL committee and that satisfy the IL constraints. Any block failing to meet these criteria will not be voted on by the attesters, and therefore cannot be canonical.&lt;&#x2F;li&gt;
&lt;li&gt;Same-slot: With FOCIL running in parallel with the block building process for &lt;code&gt;slot N+1&lt;&#x2F;code&gt; during &lt;code&gt;slot N&lt;&#x2F;code&gt;, the constraints imposed on &lt;code&gt;block B&lt;&#x2F;code&gt; for &lt;code&gt;slot N+1&lt;&#x2F;code&gt; can include transactions submitted during &lt;code&gt;slot N&lt;&#x2F;code&gt;. This represents a strict improvement over forward IL designs like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7547&#x2F;&quot;&gt;EIP-7547&lt;&#x2F;a&gt;, where the forward property introduced a 1-slot delay.&lt;&#x2F;li&gt;
&lt;li&gt;Conditional inclusion: FOCIL adopts conditional inclusion, accepting blocks that may lack some transactions from ILs if they cannot append the transactions to the end of the block or if they are full.&lt;&#x2F;li&gt;
&lt;li&gt;Anywhere-in-block: FOCIL is unopinionated about the placement of transactions from ILs within a block. This reduces incentives for sophisticated actors to use side channels to bypass the mechanism. Combined with conditional inclusion, this flexibility makes the emergence of off-protocol markets less attractive.&lt;&#x2F;li&gt;
&lt;li&gt;No incentive mechanism: FOCIL does not provide explicit rewards for IL committee members participating in the mechanism. We believe that the added complexity of implementing a transaction fee system for FOCIL is not justified. Instead, we rely on altruistic behavior, as FOCIL requires only a &lt;code&gt;1-out-of-N&lt;&#x2F;code&gt; honesty assumption from IL committee members for the mechanism to work as intended.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork. These changes do not break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-liveness&quot;&gt;Consensus Liveness&lt;&#x2F;h3&gt;
&lt;p&gt;The builder of &lt;code&gt;slot N+1&lt;&#x2F;code&gt; cannot construct a canonical block without first receiving the ILs broadcast during &lt;code&gt;slot N&lt;&#x2F;code&gt;. This means that the builder (including cases in which the proposer locally builds its block) must be well-connected to the IL committee members to ensure timely access to these inclusion lists. Additionally, there must be sufficient time between the view freeze deadline (&lt;code&gt;t=9s&lt;&#x2F;code&gt; of &lt;code&gt;slot N&lt;&#x2F;code&gt;) and the moment the proposer must broadcast &lt;code&gt;block B&lt;&#x2F;code&gt; to the rest of the network. This buffer allows the builder to gather all available ILs and update the execution payload of &lt;code&gt;block B&lt;&#x2F;code&gt; accordingly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;il-equivocation&quot;&gt;IL Equivocation&lt;&#x2F;h3&gt;
&lt;p&gt;To mitigate IL equivocation, FOCIL introduces a new P2P network rule that allows forwarding up to two ILs per IL committee member. If the proposer or attesters detect two different ILs sent by the same IL committee member, they should ignore all ILs from that member. In the worst case, the bandwidth of the IL gossip subnet can at most double.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;payload-construction&quot;&gt;Payload Construction&lt;&#x2F;h3&gt;
&lt;p&gt;The builder, responsible for constructing the execution payload, must ensure that the IL is satisfied. A naive way to do so would be to build an initial payload in whatever way the builder desires, then execute the following algorithm:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Sequentially check validity of any yet-to-be-included IL tx against the post-state. If none is found, payload building is over.&lt;&#x2F;li&gt;
&lt;li&gt;If one is found, append it to the end of the payload and update the post-state. Go back to step 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The issue with this simple approach is that, given a set of &lt;code&gt;n&lt;&#x2F;code&gt; IL transactions, one might end up needing to do &lt;code&gt;n + (n-1) + (n-2) + ...&lt;&#x2F;code&gt; validity checks, so &lt;code&gt;O(n^2)&lt;&#x2F;code&gt;. For example, the &lt;code&gt;n&lt;&#x2F;code&gt;th tx might be valid while all others are not, but its execution sends balance to the sender of the &lt;code&gt;(n-1)&lt;&#x2F;code&gt;th tx, making it valid, and in turn, the &lt;code&gt;(n-1)&lt;&#x2F;code&gt;th sends balance to the sender of the &lt;code&gt;(n-2)&lt;&#x2F;code&gt;th tx, etc.&lt;&#x2F;p&gt;
&lt;p&gt;To efficiently ensure that all valid IL txs have been included in the payload, builders can adopt a simple strategy: prior to building the payload, they store the &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;balance&lt;&#x2F;code&gt; of all Externally Owned Accounts (EOAs) involved in IL transactions. As they construct the payload, builders track these EOAs, maintaining and updating each EOA&#x27;s &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;balance&lt;&#x2F;code&gt; whenever changes occur—specifically, when the &lt;code&gt;nonce&lt;&#x2F;code&gt; increments (indicating that a transaction from that EOA has been executed) or when the &lt;code&gt;balance&lt;&#x2F;code&gt; changes without a &lt;code&gt;nonce&lt;&#x2F;code&gt; increment (e.g., after an Account Abstraction (AA) transaction has interacted with that EOA).&lt;&#x2F;p&gt;
&lt;p&gt;This tracking allows builders to verify IL transaction validity in real-time, enabling them to add transactions sequentially until all remaining transactions are either invalid because the nonce or balance of the associated EOA does not change or cannot be included due to insufficient gas. This approach minimizes overhead by keeping track only of the state changes that are relevant to the validity of IL txs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Withdrawal Credential Update Request</title>
        <published>2024-10-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lucas Saldanha</name><uri>https://github.com/lucassaldanha</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7804/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7804-withdrawal-credential-update-request/21514" />
        

        <id>https://wg-eips.ritovision.com/7804/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7804"
            label="EIP-7804" />
        

        
        

        
        <summary type="html">Allow validators to update their withdrawal credentials via execution requests</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7804/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a mechanism to allow validators to update their withdrawal
credentials using a new execution request type (0x03). The request allows for
changing the execution address and the withdrawal credential prefix (0x01 or 0x02).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When the ability to update a validator BLS withdrawal credentials to execution
address was introduced in Capella, one of the most common questions was about
allowing the withdrawal credential to be changed in the future.
Either for security (e.g. credential rotation) or to allow for alternative ways
of handling withdrawals (e.g. having a contract address as credentials).
The main reason for not adding this options was because implementing
this communication channel between the Execution Layer and the Consensus Layer is
complex (based on the experience with the Eth1 bridge).&lt;&#x2F;p&gt;
&lt;p&gt;In Electra, the protocol was upgraded with Execution Requests (deposits, withdrawals and
consolidations), and a mechanism for general purpose execution requests
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt;, decreasing the complexity of adding
a new request from execution to consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;The introduction of execution requests that are created on the execution layer,
opened up possibilities on how validators can be managed.
Execution request can be created via smart contracts, allowing for decentralized
and on-chain mechanisms to be explored.
This also means validators will be able to move between execution and compounding
withdrawal credentials (following the correct churn on the total staked amount).&lt;&#x2F;p&gt;
&lt;p&gt;For an execution request to be authorized in the consensus layer, the withdrawal
credential of the validator must be the same of the &lt;code&gt;msg.caller&lt;&#x2F;code&gt; when processing
the transaction on the EVM.
So the validator&#x27;s withdrawal credential must be the same address of the smart contract
creating the request (not the credential of the transaction sender), or the contract
needs to use &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; to ensure the caller address matches the address in the
validator&#x27;s withdrawal credential.
Validators that already have a contract address as their withdrawal credentials should
be able to update their contracts to meet this demand (assuming they have an
updatable contract).&lt;&#x2F;p&gt;
&lt;p&gt;There problems for existing validators that have their withdrawal credentials
set to an EOA account is they will never be able to use smart contracts
for creating execution requests, because the current design does not allow for these
credentials to ever be changed.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing for validators to update their withdrawal credentials mean they can opt-in
and out of different schemes and strategies on managing their validators, favouring
experimentation and innovation.
Today, the only alternative to this is exiting the validator and creating a new
validator with different withdrawal credentials.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;em&gt;TBD&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x09Fc772D0857550724b07B850a4323f39112aAaA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about the withdrawal credentials update mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for withdrawal credential update request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_WITHDRAWAL_CREDENTIALS_UPDATE_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Pointer to head of the withdrawal credential update request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the withdrawal credential update request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;The start memory slot of the in-state withdrawal credential update request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_WITHDRAWAL_CREDENTIALS_UPDATE_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of withdrawal credential update requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_WITHDRAWAL_CREDENTIALS_UPDATE_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;17&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain with the &lt;code&gt;timestamp&lt;&#x2F;code&gt; greater or equal to &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;withdrawal-credentials-update-request-operation&quot;&gt;Withdrawal Credentials Update request operation&lt;&#x2F;h4&gt;
&lt;p&gt;The new withdrawal credential update request operation is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request
with type &lt;code&gt;0x03&lt;&#x2F;code&gt; and consists of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;old_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;new_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a withdrawal credential update request is computed as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_CREDENTIALS_UPDATE_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; read_withdrawal_credential_update_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdrawal-credentials-update-request-contract&quot;&gt;Withdrawal Credentials Update Request Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract is similar to other execution requests contracts for Deposits, Withdrawals and Consolidation.
The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add request - requires a &lt;code&gt;68&lt;&#x2F;code&gt; byte input, the validator&#x27;s public key concatenated with the new address for withdrawal credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Excess requests getter - if the input length is zero, return the current excess requests count.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by system address, pop off the withdrawal credential update requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;!-- TODO add sudo code &#x2F; bytecode &#x2F; deployment &#x2F; etc (very similar to existing request contracts) --&gt;
&lt;h4 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h4&gt;
&lt;p&gt;At the end of processing any execution block where &lt;code&gt;block.timestamp &amp;gt;= FORK_TIMESTAMP&lt;&#x2F;code&gt; (i.e. after processing all transactions and after performing the block body requests validations) client software &lt;strong&gt;MUST&lt;&#x2F;strong&gt; include a call the contract as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; and empty input data to trigger the system subroutine execute. The response should be treated as a new request type (0x03) according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-validation&quot;&gt;Block Validation&lt;&#x2F;h4&gt;
&lt;p&gt;EL must check that the commitment hash in the execution block header matches the hash of the list of execution requests the CL sends when
validating the execution block (including any requests of the new defined type 0x03).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;!-- TODO complete the specification --&gt;
&lt;p&gt;Summary of changes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;New container &lt;code&gt;WithdrawalCredentialUpdateRequest&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New method in Block Processing: &lt;code&gt;process_withdrawal_credential_update_request&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New Beacon State mutator method: &lt;code&gt;update_withdrawal_credentials&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; WithdrawalCredentialUpdateRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSPubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; request contract will set this to msg.caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_withdrawal_credential_update_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WithdrawalCredentialUpdateRequest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;v&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify pubkey exists&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    request_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; request_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;request_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify withdrawal credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; has_execution_withdrawal_credential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_correct_old_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;old_address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;has_correct_credential&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; is_correct_old_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_eth1_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ETH1_ADDRESS_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_compounding_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify valid type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;is_eth1_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; is_compounding_type&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-deprecated&quot;&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; credential_type&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_update_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;new_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; new_credential_type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; new_withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old_credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_credential_type&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; new_withdrawal_credentials&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If moving from 0x01 to 0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;old_credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ETH1_ADDRESS_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; new_credential_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: in this case we need to ensure we put them through the churn&#x2F;likely re-using some of the exiting rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      switch_to_compounding_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Ownership is defined based on control of the withdrawal credential account, either as a private key (for EOA accounts) or controlling
the smart contract at the address set as withdrawal credential. Therefore allowing an update should not bring any security implications.&lt;&#x2F;p&gt;
&lt;p&gt;Further discussion needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>System logs</title>
        <published>2024-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7799/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7799-system-logs/21497" />
        

        <id>https://wg-eips.ritovision.com/7799/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7799"
            label="EIP-7799" />
        

        
        

        
        <summary type="html">Per-block logs without associated transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7799/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines an extension for eth_getLogs to provide logs for events that are not associated with a given transaction, such as block rewards and withdrawals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7708&#x2F;&quot;&gt;EIP-7708&lt;&#x2F;a&gt; wallets gain the ability to use eth_getLogs to track changes to their ETH balance. However, the ETH balance may change without an explicit transaction, through block production and withdrawals. By having such operations emit block-level system logs, eth_getLogs provides a complete picture of ETH balance changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-payment-logs&quot;&gt;Fee payment logs&lt;&#x2F;h3&gt;
&lt;p&gt;A log, identical to a LOG2, is issued for every transaction and appended after all other logs created by EVM execution. The fee amount incorporates the total fee charged during transaction execution, including the base fee, the priority fee, and potential blob fees.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7bd3aa7d673767f759ebf216e7f6c12844986c661ae6e0f1d988cf7eb7394d1d&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Fee(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;from&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;system-logs-list&quot;&gt;System logs list&lt;&#x2F;h3&gt;
&lt;p&gt;A new list is introduced to track all block level logs emitted from system interactions. The definition uses the &lt;code&gt;Log&lt;&#x2F;code&gt; SSZ type from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;system_logs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; log_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; log_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;priority-fee-processing&quot;&gt;Priority fee processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log SHALL be appended to the system logs list when crediting the batched &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8115&#x2F;&quot;&gt;EIP-8115&lt;&#x2F;a&gt; priority fee.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x5dfe9c0fd3043bb299f97cfece428f0396cf8b7890c525756e4ea5c0ff7d61b2&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;PriorityRewards(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;withdrawal-processing&quot;&gt;Withdrawal processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log SHALL be appended to the system logs list on every &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895&lt;&#x2F;a&gt; withdrawal.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Withdrawal(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;genesis-processing&quot;&gt;Genesis processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log SHALL be appended to the system logs list when generating genesis blocks for networks that adopt this EIP from the beginning.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xba2f6409ffd24dd4df8e06be958ed8c1706b128913be6e417989c74969b0b55a&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Genesis(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;5713591d0366da78a913a811c7502d9ca91d29a8&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&lt;&#x2F;a&gt; is extended with a new field, &lt;code&gt;system-logs-root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;system_logs_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; system_logs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;Block header objects in the context of the JSON-RPC API are extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;systemLogsRoot&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 32 Bytes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Log objects in the context of the JSON-RPC API are updated as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;logIndex&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - The additional system logs are indexed consecutively after the existing logs from transaction receipts&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transactionIndex&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - &lt;code&gt;null&lt;&#x2F;code&gt; is also used for system logs; pending logs can still be identified by checking the &lt;code&gt;blockHash&lt;&#x2F;code&gt; for &lt;code&gt;null&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;transactionHash&lt;&#x2F;code&gt;: DATA, 32 Bytes - &lt;code&gt;null&lt;&#x2F;code&gt; is also used for system logs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;In the engine API, the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; for versions corresponding to forks adopting this EIP is extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;systemLogsRoot&lt;&#x2F;code&gt;: &lt;code&gt;DATA&lt;&#x2F;code&gt;, 32 Bytes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As part of &lt;code&gt;engine_forkchoiceUpdated&lt;&#x2F;code&gt;, Execution Layer implementations SHALL verify that &lt;code&gt;systemLogsRoot&lt;&#x2F;code&gt; for each block matches the actual value computed from local processing. This extends on top of existing &lt;code&gt;receiptsRoot&lt;&#x2F;code&gt; validation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;The consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; type is extended with a new field to store the system logs root.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    system_logs_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Together with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7708&#x2F;&quot;&gt;EIP-7708&lt;&#x2F;a&gt; this EIP provides the ability for wallets to compute the exact ETH balance from logs without requiring download of every single block header and all withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;The block reward from priority fees no longer has to be summed up by processing all receipts and can be obtained from the system logs root, making it efficiently provable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives-future&quot;&gt;Alternatives &#x2F; Future&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;The information from withdrawals is now duplicated across both the &lt;code&gt;withdrawals&lt;&#x2F;code&gt; list and the system logs. Maybe the information could be massaged into the emitted &lt;code&gt;Withdrawal&lt;&#x2F;code&gt; log data, allowing the existing &lt;code&gt;withdrawals&lt;&#x2F;code&gt; list to be retired. The current list design requires the wallet to obtain all block headers and all withdrawals to ensure they obtained all data pertaining to the observed account. Allowing them to be queried using &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; is more in line with how deposits are being tracked.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The log definitions themselves are subject to change. Aligning them with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; for plain credits provides consistency. For withdrawals, the log data could match the form of deposit logs and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request logs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As a new field is added to the block header, applications assuming a specific block header layout may need updating.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The emitted logs use &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; as their &lt;code&gt;address&lt;&#x2F;code&gt; which cannot conflict with user controlled smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ execution blocks</title>
        <published>2024-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7807/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7807-ssz-execution-blocks/21580" />
        

        <id>https://wg-eips.ritovision.com/7807/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7807"
            label="EIP-7807" />
        

        
        

        
        <summary type="html">Migration of execution blocks to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7807/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of execution blocks to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; SSZ transactions, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt; SSZ receipts, and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6465&#x2F;&quot;&gt;EIP-6465&lt;&#x2F;a&gt; SSZ withdrawals, all Merkle-Patricia Tries (MPT) besides the state trie are converted to SSZ. This enables the surrounding data structure, the execution block itself, to also convert to SSZ, achieving a unified block representation across both Consensus Layer and Execution Layer.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Normalized block hash:&lt;&#x2F;strong&gt; The Consensus Layer can compute the block hash autonomously, enabling it to process all consistency checks that currently require asynchronous communication with the Execution Layer (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#modified-verify_and_notify_new_payload&quot;&gt;&lt;code&gt;verify_and_notify_new_payload&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;). This allows early rejection of inconsistent blocks and dropping the requirement to wait for engine API interactions while syncing.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Optimized engine API:&lt;&#x2F;strong&gt; With all exchanged data supporting SSZ, the engine API can be changed from the textual JSON encoding to binary SSZ encoding, reducing exchanged data size by ~50% and significantly improving encoding&#x2F;parsing efficiency.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Proving support:&lt;&#x2F;strong&gt; With SSZ, individual fields of the execution block header become provable without requiring full block headers to be present. With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495&lt;&#x2F;a&gt; SSZ &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, proofs are forward compatible as long as underlying semantics of individual fields are unchanged, reducing maintenance requirements for smart contracts and verifying client applications.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cleanup opportunity:&lt;&#x2F;strong&gt; The conversion to SSZ allows dropping historical fields from the PoW era and the inefficient logs bloom mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-amounts&quot;&gt;Gas amounts&lt;&#x2F;h3&gt;
&lt;p&gt;The different kinds of gas amounts are combined into a single structure, mirroring the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#gas-fees&quot;&gt;EIP-6404 gas fees&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;GasAmount&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GasAmounts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    regular&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;requests-hash-computation&quot;&gt;Requests hash computation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;requests_hash&lt;&#x2F;code&gt; is changed to &lt;code&gt;ExecutionRequests.hash_tree_root()&lt;&#x2F;code&gt; using the same structure as in the Consensus Layer &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-block-headers&quot;&gt;Execution block headers&lt;&#x2F;h3&gt;
&lt;p&gt;New execution block headers use a normalized SSZ representation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    miner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6404 transactions.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6466 receipts.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6465 withdrawals.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    requests_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-6110 execution_requests.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    system_logs_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; EIP-7799 system_logs.hash_tree_root()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-block-hash-computation&quot;&gt;Execution block hash computation&lt;&#x2F;h3&gt;
&lt;p&gt;For new blocks, the execution block hash is changed to be based on &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; in all contexts, including (1) the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode, (2) JSON-RPC API interactions (&lt;code&gt;blockHash&lt;&#x2F;code&gt; field), (3) devp2p networking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;Usages of &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; are replaced with &lt;code&gt;ExecutionBlockHeader&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Usages of &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; are updated to share &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; with &lt;code&gt;ExecutionBlockHeader&lt;&#x2F;code&gt;. &lt;code&gt;transactions_root&lt;&#x2F;code&gt;, &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; and &lt;code&gt;requests_hash&lt;&#x2F;code&gt; are expanded to their full list contents.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    miner&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mix_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmounts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionRequests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    system_logs_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This completes the transition to SSZ for everything except the execution state trie.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future&quot;&gt;Future&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;With SSZ &lt;code&gt;Log&lt;&#x2F;code&gt;, the withdrawals mechanism and validator requests could be redefined to be based on logs (similar to deposits, originally, but without the delay), possibly removing the need for &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; and &lt;code&gt;requests_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The CL would insert the extra logs for minting (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7799&#x2F;&quot;&gt;EIP-7799&lt;&#x2F;a&gt;) and could fetch the ones relevant for withdrawing (deposits, requests, consolidations). That mechanism would be more generic than &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; and would drop requiring the EL to special case requests, including &lt;code&gt;compute_requests_hash&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For client applications and smart contracts, it would streamline transaction history verification based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7792&#x2F;&quot;&gt;EIP-7792&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The Engine API should be updated with (1) possible withdrawals&#x2F;requests refactoring as above, (2) dropping the &lt;code&gt;block_hash&lt;&#x2F;code&gt; field so that &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; is replaced with &lt;code&gt;ExecutionBlockHeader&lt;&#x2F;code&gt;, (3) binary encoding based on &lt;code&gt;ForkDigest&lt;&#x2F;code&gt;-context (through HTTP header or interleaved, similar to beacon-API). This reduces encoding overhead and also simplifies sharing data structures in combined CL&#x2F;EL in-process implementations.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This breaks compatibility of smart contracts that depend on the previous block header binary format, including for &quot;generic&quot; implementations that assume a common prefix and run the entire data through a linear keccak256 hash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The SSZ block hash is based on SHA256 and shares the namespace with existing keccak256 based block hashes. As these hash algorithms are fundamentally different, no significant collision risk is expected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Double speed for hash_tree_root</title>
        <published>2024-10-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7797/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7797-double-speed-for-hash-tree-root/21447" />
        

        <id>https://wg-eips.ritovision.com/7797/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7797"
            label="EIP-7797" />
        

        
        

        
        <summary type="html">Double the performance of hash_tree_root by customizing SHA-256</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7797/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP explains how to customize &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;&lt;code&gt;hash_tree_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to double its performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Hashing is a dominant performance bottleneck for Consensus Layer implementations. To support large validator counts, it is critical to optimize hashing performance.&lt;&#x2F;p&gt;
&lt;p&gt;Consensus Layer hashes are based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;&lt;code&gt;hash_tree_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, a mechanism that splits up the data into chunks and then forms a tree by recursively combining two adjacent chunks and hashing them into a single parent chunk until only a single root chunk remains.&lt;&#x2F;p&gt;
&lt;p&gt;For hashing, Secure Hash Algorithm 2 with a digest size of 256 bits is used (SHA-256). This algorithm produces &lt;em&gt;exactly&lt;&#x2F;em&gt; 256 bits of output for a variable-length input message. However, as &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; pads all input chunks to exactly 256 bits, the effective input message length is always &lt;em&gt;exactly&lt;&#x2F;em&gt; 512 bits.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP defines how the SHA-256 algorithm used by &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; can be customized to exploit knowledge of the exact input length to double its performance, while retaining its security properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sha-256-preprocessing&quot;&gt;SHA-256 preprocessing&lt;&#x2F;h3&gt;
&lt;p&gt;Before SHA-256 hash computation begins, the input message is preprocessed. A single &lt;code&gt;1&lt;&#x2F;code&gt; bit is appended to the input message, followed by a varying number of &lt;code&gt;0&lt;&#x2F;code&gt; bits, and finally a big endian &lt;code&gt;uint64&lt;&#x2F;code&gt; indicating the input message bit length. The number of &lt;code&gt;0&lt;&#x2F;code&gt; bits is chosen so that the message size is the smallest possible multiple of 512 bits. In the context of &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; where the input message size is 512 bits, preprocessing results in the following padded message:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x00 |                                               |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x10 |                     Input                     |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x20 |                    message                    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x30 |                                               |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x40 |80|00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x50 |00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x60 |00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   0x70 |00 00 00 00 00 00 00 00|00 00 00 00 00 00 02 00|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sha-256-blocks&quot;&gt;SHA-256 blocks&lt;&#x2F;h3&gt;
&lt;p&gt;SHA-256 operates on message blocks of 512 bits. Therefore, in the context of &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; where the input message size is 512 bits, two message blocks are formed, the first containing the entire input message, and the second containing entirely static data resulting from the preprocessing step.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the second 512 bit message block does not provide any entropy, and is only useful to distinguish input messages that share a common prefix and only vary in the number of trailing &lt;code&gt;0&lt;&#x2F;code&gt; bits. As &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; uses a fixed message size, no distinguishing is necessary. Further, SHA-256 is also considered secure for padded messages that fit into a single message block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sha-256-512&quot;&gt;SHA-256-512&lt;&#x2F;h3&gt;
&lt;p&gt;A new algorithm SHA-256-512 is defined as a modified SHA-256 algorithm that skips input message preprocessing and is restricted to inputs of exactly 512 bits. The input message SHALL be processed as is, as a single 512-bit SHA-256 message block.&lt;&#x2F;p&gt;
&lt;p&gt;For every &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;composite SSZ type&lt;&#x2F;a&gt; in use, implementations SHALL support a new type that shares the same functionality, but hashes using SHA-256-512 instead of regular SHA-256.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-types&quot;&gt;Consensus types&lt;&#x2F;h3&gt;
&lt;p&gt;Starting with the hard fork that introduces this EIP, the SHA-256-512 based composite SSZ types SHOULD be preferred over existing SHA-256 based types.&lt;&#x2F;p&gt;
&lt;p&gt;Certain use cases covering historical objects MAY require conversion to the historical data type and re-hashing with the original SHA-256 type to recover their historical root. This includes &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#compute_signing_root&quot;&gt;&lt;code&gt;compute_signing_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; signing over historical data, and also individual fields such as &lt;code&gt;BeaconState.latest_block_header&lt;&#x2F;code&gt; which MAY refer to data from prior forks.&lt;&#x2F;p&gt;
&lt;p&gt;Certain other objects such as &lt;code&gt;DepositData&lt;&#x2F;code&gt; or &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt; MAY continue to rely on existing SHA-256 logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Doubling the throughput of the underlying hash algorithm allows scaling to more validators on the same hardware, or allows using the freed CPU time for other tasks. Even when caching rarely-changed intermediate hashes across computations such as the &lt;code&gt;validators&lt;&#x2F;code&gt; list of a &lt;code&gt;BeaconState&lt;&#x2F;code&gt;, and employing hardware-accelerated SHA-256 implementations that are further optimized for the tree structure using libraries such as &lt;code&gt;prysmaticlabs&#x2F;hashtree&lt;&#x2F;code&gt;, the state root validation step of the Consensus Layer state transition function can still consume ~25% of CPU time (Holesky test network, ~1.7m validators), mostly dominated by frequently changing per-validator structures such as the &lt;code&gt;EpochParticipationFlags&lt;&#x2F;code&gt; lists.&lt;&#x2F;p&gt;
&lt;p&gt;If the hash algorithm is changed to a more zero-knowledge friendly one in the future, similar efforts as described in this EIP would be needed to identify the locations where historical objects need to be hashed using historical hashes, and also to introduce new composite SSZ types. A switch from SHA-256 to SHA-256-512 would pull such work ahead, and any future hash algorithm changes would solely have to extend on these known locations. The total work necessary to switch hash algorithms multiple times is comparable to switching a single time.&lt;&#x2F;p&gt;
&lt;p&gt;Existing hardware acceleration for SHA-256 continues to be viable, as only the message preprocessing step is dropped. Hardware acceleration typically only implements the SHA-256 message block function, which is unchanged by this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contracts and client applications that verify Consensus Layer data require updates to remain compatible with data hashed using SHA-256-512. New logic may be required to correctly select the hash algorithm for historical structures such as &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;SSZ serialization, generalized indices, as well as semantics of individual object fields remain unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Certain SHA-256-512 hashes of 512 bit data may collide with regular SHA-256 hashes of shorter data. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any common 440-bit prefix: &lt;code&gt;COMMON_PREFIX := 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313233343536&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHA-256-512(COMMON_PREFIX ++ 0x80 ++ 0x00000000000001b8) == 463eb28e72f82e0a96c0a4cc53690c571281131f672aa229e0d45ae59b598b59&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SHA-256(COMMON_PREFIX) == 463eb28e72f82e0a96c0a4cc53690c571281131f672aa229e0d45ae59b598b59&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Because SSZ has never hashed data with sizes different from 512 bits, SSZ hashes based on SHA-256 do not collide with hashes based on SHA-256-512.&lt;&#x2F;p&gt;
&lt;p&gt;SHA-256-512 SHOULD NOT be used for purposes other than SSZ Merkleization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verifiable logs</title>
        <published>2024-10-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7792/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7792-verifiable-logs/21424" />
        

        <id>https://wg-eips.ritovision.com/7792/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7792"
            label="EIP-7792" />
        

        
        

        
        <summary type="html">Scheme to make the eth_getLogs response verifiable</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7792/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a method to make the &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; JSON-RPC response verifiable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; endpoint is used by wallets to obtain the transaction history pertaining to an account or a topic. To verify correctness and completeness of the logs, a wallet would also have to obtain all block headers and check against their logs bloom. However, that mechanism is inefficient due to its high false positive rate and also involves an unpractical amount of network round trips. This EIP defines a replacement mechanism to efficiently and incrementally verify correctness and completeness of &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; responses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LOG_CONTRACT_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;log-accumulation&quot;&gt;Log accumulation&lt;&#x2F;h3&gt;
&lt;p&gt;After executing all transactions of a block, commitments of all emitted logs are accumulated into the storage of &lt;code&gt;LOG_CONTRACT_ADDRESS&lt;&#x2F;code&gt;. The contract has no code, and its storage layout consists of three slots of type &lt;code&gt;mapping&lt;&#x2F;code&gt;. However to prevent &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;158&#x2F;&quot;&gt;EIP-158&lt;&#x2F;a&gt; cleanup, the contract&#x27;s nonce is set to &lt;code&gt;1&lt;&#x2F;code&gt; at the first write.&lt;&#x2F;p&gt;
&lt;p&gt;| Name | Value | Type |
| &lt;code&gt;LOG_ADDRESS_STORAGE_SLOT&lt;&#x2F;code&gt; | &lt;code&gt;0&lt;&#x2F;code&gt; | &lt;code&gt;mapping(address =&amp;gt; bytes32)&lt;&#x2F;code&gt; |
| &lt;code&gt;LOG_TOPICS_STORAGE_SLOT&lt;&#x2F;code&gt; | &lt;code&gt;1&lt;&#x2F;code&gt; | &lt;code&gt;mapping(bytes32 =&amp;gt; bytes32)&lt;&#x2F;code&gt; |
| &lt;code&gt;LOG_ADDRESS_TOPICS_STORAGE_SLOT&lt;&#x2F;code&gt; | &lt;code&gt;2&lt;&#x2F;code&gt; | &lt;code&gt;mapping(bytes32 =&amp;gt; bytes32)&lt;&#x2F;code&gt; |&lt;&#x2F;p&gt;
&lt;p&gt;Additional metadata about each log&#x27;s origin is mixed in to each &lt;code&gt;LogEntry&lt;&#x2F;code&gt;. The definition uses the &lt;code&gt;Log&lt;&#x2F;code&gt; SSZ type as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlockMeta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogMeta&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlockMeta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TOPICS_PER_LOG&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ByteList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_LOG_DATA_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; LogEntry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    meta&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; LogMeta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Log&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;hash_tree_root(LogEntry)&lt;&#x2F;code&gt; commitments are subsequently tracked as part of &lt;code&gt;LOG_CONTRACT_ADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hashlib&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; root&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; track_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; entry&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; LogEntry&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entry_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow verification via `address` filter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_ADDRESS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; topic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow verification via `topics` filter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;topic&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_TOPICS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Allow verification via combined `address` + `topics` filter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;entry&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; topic&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;encode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; LOG_ADDRESS_TOPICS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accumulate_log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; entry_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; response format is extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blockTimestamp&lt;&#x2F;code&gt;: &lt;code&gt;QUANTITY&lt;&#x2F;code&gt; - The timestamp field of the block referred to by &lt;code&gt;blockHash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;eth_getLogs(address, topics, fromBlock, toBlock)&lt;&#x2F;code&gt;, the response data can be verified for correctness and completion by obtaining:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;fromBlock&lt;&#x2F;code&gt; and &lt;code&gt;toBlock&lt;&#x2F;code&gt; block headers (validated against their known hashes)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fromBlock&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;parentBlock&lt;&#x2F;code&gt; header (validated against &lt;code&gt;fromBlock.parentHash&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Historical log accumulator at &lt;code&gt;parentBlock&lt;&#x2F;code&gt; based on given filters (validated with &lt;code&gt;eth_getProof&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Log accumulator at &lt;code&gt;toBlock&lt;&#x2F;code&gt; based on given filters (validated with &lt;code&gt;eth_getProof&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Starting from the historical log accumulator from (3), each response entry is applied to it in a way compatible with &lt;code&gt;accumulate_log&lt;&#x2F;code&gt; above. If the log accumulator ends up matching the value from (4), the response data is correct and &lt;code&gt;LogEntry&lt;&#x2F;code&gt; derived from it can be trusted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Making the &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; response verifiable adds the necessary security attributes to enable wallets to transition away from relying on trusted data providers, ultimately improving the wallet&#x27;s privacy guarantees as it is no longer subject to the privacy policy of any given provider.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost produced by this scheme is significantly higher than what &lt;code&gt;LOG#&lt;&#x2F;code&gt; opcodes produce as of Prague, primarily due to the additional &lt;code&gt;SLOAD&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and the double cost of &lt;code&gt;SHA256&lt;&#x2F;code&gt; opcodes compared to &lt;code&gt;KECCAK256&lt;&#x2F;code&gt; opcodes. The gas cost increases outweigh the savings from dropping logs blooms.&lt;&#x2F;p&gt;
&lt;p&gt;If the mechanism turns out to be prohibitively expensive even when optimized, it may be necessary to move the log accumulators to a separate optimized data structure (not in &lt;code&gt;state_root&lt;&#x2F;code&gt;), or to an out-of-protocol zk system. Even then, the gas cost for logs should still reflect the actual overall cost to update a typical out-of-protocol accumulator to deter against log spamming.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-number-transaction-index-in-meta-instead-of-hashes&quot;&gt;Block number &#x2F; transaction index in meta instead of hashes&lt;&#x2F;h3&gt;
&lt;p&gt;As long as the accumulators are stored in the state trie, they cannot refer to the block hash as the block hash hashes over the state trie, producing a cyclic dependency. If an external system is used, hashes may be included as in that scenario the state root is not affected by the IVC.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is still possible to process &lt;code&gt;eth_getLogs&lt;&#x2F;code&gt; responses from trusted servers as is, without verifying them. Client applications with strict response validation may need to be updated to allow the additional &lt;code&gt;blockTimestamp&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This scheme reuses existing &lt;code&gt;eth_getProof&lt;&#x2F;code&gt; and SSZ Merkle proofs; it does not introduce new security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Conditional Transactions</title>
        <published>2024-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marc Harvey-Hill</name><uri>https://github.com/Marchhill</uri>
	</author>
	
	<author>
		<name>Ahmad Bitar</name><uri>https://github.com/smartprogrammer93</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7793/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7793-asserttxindex-opcode/21513" />
        

        <id>https://wg-eips.ritovision.com/7793/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7793"
            label="EIP-7793" />
        

        
        

        
        <summary type="html">Transactions that only executes at a specific index and slot</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7793/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to add a new transaction format for &quot;conditional transactions&quot;, that are only valid at a specified slot and index within the block. A new opcode &lt;code&gt;TXINDEX&lt;&#x2F;code&gt; is introduced to expose the conditional transaction index onchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal aims to improve support for encrypted mempools. Transactions in an encrypted mempool are ordered while the transactions are encrypted, before being decrypted and included onchain at the top of the block. If the builder does not respect the order when including the decrypted transactions then they could frontrun decrypted transactions. The new transaction type can be used to make this impossible; if a decrypted transaction is not included at the correct index, it will be invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COND_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x05)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXINDEX_OPCODE_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x4c)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TXINDEX_OPCODE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;conditional-transaction-type&quot;&gt;Conditional Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new type of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction, &quot;conditional transactions&quot;, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;COND_TX_TYPE&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following &lt;code&gt;TransactionPayloadBody&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, conditional_slot, conditional_tx_index, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The fields &lt;code&gt;chain_id&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, &lt;code&gt;access_list&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. The field &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; is the same except that the list may be empty for a conditional transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The fields &lt;code&gt;conditional_slot&lt;&#x2F;code&gt; and &lt;code&gt;conditional_tx_index&lt;&#x2F;code&gt; are both &lt;code&gt;uint64&lt;&#x2F;code&gt; and specify the slot and transaction index in which this transaction should be considered valid respectively. In order to verify that &lt;code&gt;conditional_slot&lt;&#x2F;code&gt; is correct, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7843&#x2F;&quot;&gt;EIP-7843&lt;&#x2F;a&gt; is a dependency, as this adds the slot number to the header. For both fields &lt;code&gt;-1&lt;&#x2F;code&gt; is used as a sentinel value for which the slot or transaction index check will not take place.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signature&quot;&gt;Signature&lt;&#x2F;h4&gt;
&lt;p&gt;The signature values &lt;code&gt;y_parity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; are calculated by constructing a secp256k1 signature over the following digest:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;keccak256(COND_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, conditional_slot, conditional_tx_index]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;txindex-opcode&quot;&gt;TXINDEX opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;TXINDEX&lt;&#x2F;code&gt; is introduced at &lt;code&gt;TXINDEX_OPCODE_BYTE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;p&gt;One element &lt;code&gt;TransactionIndex&lt;&#x2F;code&gt; is added to the stack. &lt;code&gt;TransactionIndex&lt;&#x2F;code&gt; is a &lt;code&gt;uint64&lt;&#x2F;code&gt; in big endian encoding. It is equal to &lt;code&gt;conditional_tx_index&lt;&#x2F;code&gt; if the current transaction is a conditional transaction, and &lt;code&gt;-1&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h4&gt;
&lt;p&gt;The gas cost for &lt;code&gt;TXINDEX&lt;&#x2F;code&gt; is a fixed fee of &lt;code&gt;TXINDEX_OPCODE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transaction-type&quot;&gt;Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative design could simply return the current transaction index without adding a new transaction type. Adding a new transaction type is favoured as it means that the expected transaction index must be declared statically upfront, rather than allowing dynamic behaviour based on the returned transaction index. This prevents complex constraints being imposed that makes it difficult to build a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-price&quot;&gt;Gas Price&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode is priced to match similar opcodes in the &lt;code&gt;W_base&lt;&#x2F;code&gt; set.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Dynamic target blob count</title>
        <published>2024-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Marc Harvey-Hill</name><uri>https://github.com/Marchhill</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7788/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7788-dynamic-target-blob-count/21399" />
        

        <id>https://wg-eips.ritovision.com/7788/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7788"
            label="EIP-7788" />
        

        
        

        
        <summary type="html">Target blob count changes dynamically to aim for constant blob costs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7788/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to make the target blob count adjust dynamically up to a safe maximum target. This adjustment will target a constant price in ETH for blobs, aiming for consistent costs of L2 transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently uses a target of 50% capacity for blob count, with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; smoothing out short-term spikes and pushing average throughput towards the target. A dynamic target is orthogonal to EIP-1559, tweaking the target itself over a longer timescale to aim for some desired blob cost.&lt;&#x2F;p&gt;
&lt;p&gt;With static targeting the target may be higher than the actual demand, causing the protocol to undercharge for blobspace. This decreases the amount of fees burned, negatively affecting the price of ETH and total network security.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, consider what would happen if there was a large increase in max blob count due to DAS implementation but the target remained at 50%. It is unlikely that demand would immediately jump to anywhere near the target, and so for months or years the protocol would effectively charge nothing for L2 transactions. With a dynamic target, the target blob count would drop until the cost of blobspace for an L2 transaction approximated some affordable constant value. In this way, some fees are still burned by the protocol, but new L2s are not discouraged from using Ethereum blobspace, knowing that the target will increase in response to an increase in demand and blob fees will remain reasonably consistent.&lt;&#x2F;p&gt;
&lt;p&gt;While the max blob count and max target are hard constraints based on resource utilisation limits, setting the target itself is far more subjective. A dynamic target can optimise for constant and affordable L2 transaction costs without requiring regular intervention by core developers to make tweaks based on changes in demand.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_COUNT_CHANGE_RATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_COST_CHANGE_MARGIN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2^48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2^49&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;dynamic-targeting&quot;&gt;Dynamic targeting&lt;&#x2F;h3&gt;
&lt;p&gt;The target blob count changes each epoch based on the mean blob cost over the previous epoch. If the average cost exceeds the desired amount beyond some margin then the target is increased; likewise if it is below the desired amount by some margin the target will decrease. The target can increase up to &lt;code&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;, which is deemed to be a safe average throughput for the network, and down to a minimum of &lt;code&gt;MIN_TARGET_BLOB_COUNT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Calculating targets:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;blob_cost_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; mean_blob_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;target_change_direction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; blob_cost_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOB_COST_CHANGE_MARGIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; blob_cost_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_COST_CHANGE_MARGIN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;next_epoch_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; previous_epoch_blob_count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;target_change_direction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_COUNT_CHANGE_RATE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_TARGET_BLOB_COUNT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;engine-api-change&quot;&gt;Engine API change&lt;&#x2F;h3&gt;
&lt;p&gt;The Engine API is extended to provide the &lt;code&gt;mean_blob_cost&lt;&#x2F;code&gt; for the current epoch when the CL requests it from the EL. The CL requests this at the end of an epoch to set the target for the next epoch (depends on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7742&#x2F;&quot;&gt;EIP-7742&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constant-blob-cost-target&quot;&gt;Constant blob cost target&lt;&#x2F;h3&gt;
&lt;p&gt;A constant blob cost target can keep L2 transaction costs affordable for end users. Volatility in the price of ETH would affect affordability, but is unlikely to be significant compared to normal fluctuations in blob gas costs due to spikes in activity. In future the costs could be adjusted in the case of changes in the order of magnitude of ETH price.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative approach would be to track a target blob cost in fiat. However, choosing a specific fiat currency is not credibly neutral, and introducing exchange rate oracles into the protocol could be an attack vector.&lt;&#x2F;p&gt;
&lt;p&gt;Yet another alternative is to have validators vote on the target blob cost, but they may have conflicts of interest (for example if they operate a rollup) so again this is not credibly neutral.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-block-gas&quot;&gt;Target block gas&lt;&#x2F;h3&gt;
&lt;p&gt;The same logic could be applied to the target block gas, but generally blockspace is in high demand so arguably gas costs are never too low. The target should be set to the maximum average throughput that the network can safely handle, a dynamic target is not necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-choices&quot;&gt;Parameter choices&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TARGET_BLOB_COST&lt;&#x2F;code&gt; is chosen so that the system targets affordable L2 transactions. Assuming that the theoretical compressed size of a simple transfer is 23 bytes, this gives a blobspace cost for L2 transactions of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(23 &#x2F; 125000) * TARGET_BLOB_COST ≈ 104 gWei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At today’s prices, $1 would cover blobspace for around 3700 simple transfers on L2. The blob cost target should be chosen with extensive community involvement. Note that this is the cost of blobspace for an L2 transaction; the total cost will be more due to rollup execution costs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TARGET_BLOB_COUNT_CHANGE_RATE&lt;&#x2F;code&gt; is chosen as a compromise between the system being reactive to changes in demand, and not having large jumps in average throughput. &lt;code&gt;BLOB_COST_CHANGE_MARGIN&lt;&#x2F;code&gt; is set such that target blob count will stay static when blob costs are within a range ±50% of &lt;code&gt;TARGET_BLOB_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MAX_TARGET_BLOB_COUNT&lt;&#x2F;code&gt; is set to &lt;code&gt;3&lt;&#x2F;code&gt; to match the current static target. This value should be increased in future when it is deemed to be safe to increase average blob throughput.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>GETCONTRACT opcode</title>
        <published>2024-10-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Tim Pechersky</name><uri>https://github.com/peersky</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7784/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7784-getcontract-code/21325" />
        

        <id>https://wg-eips.ritovision.com/7784/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7784"
            label="EIP-7784" />
        

        
        

        
        <summary type="html">Global byte code accessing by its hash</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7784/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is a proposal to add a new opcode, &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt;. The &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt; opcode would return the address containing the bytecode by its hash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Content addressing by hash is a common pattern in database design. It allows to store and retrieve data by its unique footprint in the storage. This pattern is widely used in the industry and it allows abstracting the actual storage location and allows reusing the same bytecode in multiple contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Today, existing contract discovery relies on addresses, which are non-deterministic and can be obfuscated through proxies. Indexing by bytecode hash provides a deterministic and tamper-proof way to identify and verify contract code, enhancing security and trust in the Ethereum ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a security auditor who wants to attest to the integrity of a contract’s code. By referencing bytecode hashes, auditors can focus their audit on the bytecode itself, without needing to assess deployment parameters or storage contents. This method verifies the integrity of a contract’s codebase without auditing the entire contract state.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, bytecode referencing allows whitelist contracts before deployment, allowing developers to get pre-approval for their codebase without disclosing the code itself, or even pre-setup infrastructure that will change it behavior upon adding some determined functionality on chain.&lt;&#x2F;p&gt;
&lt;p&gt;For developers relying on extensive code reuse, bytecode referencing protects against malicious changes that can occur with address-based referencing through proxies. This builds long-term trust chains extending to end-user applications.&lt;&#x2F;p&gt;
&lt;p&gt;For decentralized application (dApp) developers, a code index can save gas costs by allowing them to reference existing codebase instead of redeploying them, optimizing resource usage. This can be useful for dApps that rely on extensive re-use of same codebase as own dependencies.&lt;&#x2F;p&gt;
&lt;p&gt;This also allows to build new core standards more conveniently, for example, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; can use it as dependency, to allow users who want to set up one-time code on their EOAs by referring to &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt; instead of specifying potentially mutable address based functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcode-definition&quot;&gt;Opcode Definition&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mnemonic:&lt;&#x2F;strong&gt; &lt;code&gt;GETCONTRACT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Opcode Value:&lt;&#x2F;strong&gt; &lt;code&gt;0x4f&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Input:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;codehash&lt;&#x2F;code&gt;: A single 32-byte code hash from the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Output:&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt;:  If the &lt;code&gt;codehash&lt;&#x2F;code&gt; exists in the state, pushes the corresponding contract address onto the stack. Otherwise, pushes 0.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Gas Cost:&lt;&#x2F;strong&gt; 150&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Stack Effects:&lt;&#x2F;strong&gt; Pops 1 item, pushes 1 item.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Error Handling:&lt;&#x2F;strong&gt;  If the &lt;code&gt;codehash&lt;&#x2F;code&gt; is invalid or the bytecode retrieval encounters an error, the instruction will revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Every contract stored in EVM MUST be added to the state trie with the key being the keccak256 hash of the contract&#x27;s bytecode, provided it is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;not already present&lt;&#x2F;li&gt;
&lt;li&gt;The contract did not invoke the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; return value IS NOT &lt;code&gt;0xeadcdba66a79ab5dce91622d1d75c8cff5cff0b96944c3bf1072cd08ce018329&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(0xef01)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;example-usage&quot;&gt;Example Usage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; getContractAddress&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    address&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        contractAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; GETCONTRACT&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; contractAddress&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Bytecode over Addresses&lt;&#x2F;strong&gt;: Bytecode is deterministic and can be verified on-chain, while addresses are opaque and mutable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Do not re-index&lt;&#x2F;strong&gt;: There is small, yet non-zero probability of hash collision attack. Disallowing updates to indexed location of bytecode coupes with this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Gas cost&lt;&#x2F;strong&gt;: This operation is more complex than simple data retrieval, however lookup in the database by hash generally is simpler in complexity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Malicious Code&lt;&#x2F;strong&gt;: The index does NOT guarantee the safety or functionality of indexed contracts. Users MUST exercise caution and perform their own due diligence before interacting with indexed contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Storage contents of registered contracts&lt;&#x2F;strong&gt;: The index only refers to the bytecode of the contract, not the storage contents. This means that the contract state is not indexed and may change over time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegation:&lt;&#x2F;strong&gt; Temporary code delegation is disallowed to prevent case of registering a code hash that becomes unavailable. Standard explicitly disallows contracts with bytecode delegated via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; from being indexed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;SELFDESTRUCT&lt;&#x2F;strong&gt;: Contracts that &lt;code&gt;selfdestruct&lt;&#x2F;code&gt; are not indexed, as they will not have a codehash in the state trie.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce Block Latency</title>
        <published>2024-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Paul Harris</name><uri>https://github.com/rolfyone</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7782/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7782-reduce-block-latency/21271" />
        

        <id>https://wg-eips.ritovision.com/7782/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7782"
            label="EIP-7782" />
        

        
        

        
        <summary type="html">Reduce Ethereum&#x27;s slot time from 12s to 6s to decrease latency by 50%, distribute bandwidth usage, and improve UX.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7782/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce Ethereum&#x27;s slot time from 12 s to 6 s, halving on‑chain latency and epoch duration. This doubles slot throughput while keeping block and blob sizes unchanged, smoothing bandwidth usage. The change delivers better user experience, faster Layer 2 interaction, tighter DEX pricing, reduced MEV, and quicker finality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Protocol Carrying Capacity&lt;&#x2F;strong&gt; It is impractical to increase block sizes beyond 10MiB without substantial networking changes. However it is practical to decrease slot time to achieve similar effect while also improving the UX at same time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Enhanced UX&lt;&#x2F;strong&gt;: Confirmations now arrive in ~6 s instead of 12 s.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Faster Finality&lt;&#x2F;strong&gt;: Epochs shrink from 384 s (32 × 12 s) to 192 s (32 × 6 s), accelerating Casper‑FFG finality.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;L2 Interoperability&lt;&#x2F;strong&gt;: Layer 2 rollups see half the settlement delay on L1, improving throughput and reducing reorg risk period.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Based rollups&lt;&#x2F;strong&gt;: Based rollup sequencing is tied to L1 block time so faster blocks directly improves based rollups.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;DEX Economics&lt;&#x2F;strong&gt;: More frequent blocks decrease LVR (Loss Versus Rebalancing), which improves the economics for liquidity providers. More liquidity means lower spreads (reduced slippage).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Bandwidth Smoothing&lt;&#x2F;strong&gt;: Doubling slot rate distributes bandwidth evenly without increasing peak block size; nodes with modest capacity remain supported.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;On the consensus layer, a new parameter is added to the configuration:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SLOT_SCHEDULE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - EPOCH: 348618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SECONDS_PER_SLOT: 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  - EPOCH: 355368&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SECONDS_PER_SLOT: 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The parameters and schedules above are purely illustrative. Actual values and schedules are beyond the scope of this specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adjustment-to-gas-and-blob-limits&quot;&gt;Adjustment to gas and blob limits&lt;&#x2F;h3&gt;
&lt;p&gt;The first execution block after the fork needs to specify half the previous gas limit. With this fork, all gas limit settings are reinterpreted as &quot;gas per 12 seconds&quot;. I.e., if the user configuration or otherwise default gas limit vote was 36,000,000, the client should now vote for 18,000,000. All values are rounded down to integers.&lt;&#x2F;p&gt;
&lt;p&gt;The blob target and limit are also halved, rounded down to the nearest integer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attestation-deadlines&quot;&gt;Attestation deadlines&lt;&#x2F;h3&gt;
&lt;p&gt;All clients need to be reconfigured so that deadlines can be configured in milliseconds for finer granularity. Currently the slot is split into three equal intervals, with proposal happening at time 0, and attestations and aggregations being sent at one thirds and two thirds of the slot time. We change this to a new uneven schedule, in order to give sufficient time for block propagation, which takes the most time:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Block proposal at 0 ms&lt;&#x2F;li&gt;
&lt;li&gt;Attestations at 3000 ms&lt;&#x2F;li&gt;
&lt;li&gt;Aggregates at 4500 ms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal balances user experience, economic efficiency, and network stability:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;UX &amp;amp; Finality: Halving slot time directly reduces confirmation latency and halves epoch duration, delivering faster feedback to users and speeding up Casper-FFG finality.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Economic Efficiency: Increased block frequency tightens DEX price spreads, lowers slippage, and diminishes arbitrage and MEV opportunities, improving on-chain trading conditions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;L2 &amp;amp; Based Rollups Synergy: Layer 2 rollups, especially based rollups, benefit from reduced L1 settlement delays, enhancing throughput and user-perceived performance in rollup ecosystems.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Network Stability: Maintaining existing p2p network maximum smooths bandwidth usage over time, avoiding peak-load spikes and preserving accessibility for nodes with diverse bandwidth capacities.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Network Congestion&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Increased Message Frequency&lt;&#x2F;strong&gt;: The network must handle more frequent messages without congestion.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Mitigation&lt;&#x2F;strong&gt;: Implement network optimizations and encourage the use of efficient client software.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Consensus Integrity&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Fork Choice Stability&lt;&#x2F;strong&gt;: Ensure that the fork choice rule remains robust against potential reorganization attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Finality Gadgets&lt;&#x2F;strong&gt;: Confirm that finality mechanisms function correctly under new timing conditions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0 1.0 Universal.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Gas Accounting without Refunds</title>
        <published>2024-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7778/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7778-prevent-block-gas-smuggling/21234" />
        

        <id>https://wg-eips.ritovision.com/7778/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7778"
            label="EIP-7778" />
        

        
        

        
        <summary type="html">Prevent Block Gas Limit Circumvention by Excluding Refunds from Block Gas Accounting</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7778/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies the block gas accounting mechanism to prevent the circumvention of block gas limits. It proposes that gas refunds, particularly those from SSTORE operations setting storage slots to zero, should not reduce the gas counted toward the block gas limit, while still being applied to transaction gas costs for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, gas refunds from operations like clearing storage slots (setting to zero) reduce both the transaction gas cost for users and the gas counted toward the block gas limit. This creates a discrepancy between the computational work performed and the gas accounted for in the block.&lt;&#x2F;p&gt;
&lt;p&gt;Example: Block &lt;code&gt;20878522&lt;&#x2F;code&gt; shows a net usage of 28.5 MGas, but contains 4.01 MGas of refunds, bringing the gross usage to 32.51 MGas—exceeding the block gas limit by 2.51 MGas.&lt;&#x2F;p&gt;
&lt;p&gt;This mechanism can be exploited to perform more operations in a block than the gas limit intends to allow, potentially leading to:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Network instability due to oversized blocks&lt;&#x2F;li&gt;
&lt;li&gt;Denial-of-service vectors&lt;&#x2F;li&gt;
&lt;li&gt;Computational loads exceeding the intended block gas limit&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-accounting-changes&quot;&gt;Gas Accounting Changes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;User Gas Accounting (Unchanged):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Users continue to receive gas refunds for operations that qualify (e.g., setting storage to zero)&lt;&#x2F;li&gt;
&lt;li&gt;Transaction gas: &lt;code&gt;gas_spent = max(tx_gas_used - gas_refund, calldata_floor_gas_cost)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Block Gas Accounting (Modified):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When calculating gas for block gas limit enforcement, refunds are not subtracted&lt;&#x2F;li&gt;
&lt;li&gt;Block gas accounting becomes: &lt;code&gt;block.gas_used += max(tx_gas_used, calldata_floor_gas_cost)&lt;&#x2F;code&gt; (incorporating the calldata floor from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Storage discounts that reflect actual reduced computational work (e.g., warm storage access, reverting to original values) remain applied to block gas accounting&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;aligning-gas-limits-with-computational-work&quot;&gt;Aligning Gas Limits with Computational Work&lt;&#x2F;h3&gt;
&lt;p&gt;The block gas limit is designed to constrain the computational load per block. Gas refunds were introduced to incentivize &quot;cleaning up&quot; the state, not to allow exceeding computational limits. By excluding refunds from block gas accounting, we ensure the block gas limit effectively constrains computational load&lt;&#x2F;p&gt;
&lt;h3 id=&quot;preserving-user-incentives&quot;&gt;Preserving User Incentives&lt;&#x2F;h3&gt;
&lt;p&gt;Users still receive gas refunds, maintaining incentives for efficient state management. Only the accounting for block-level constraints changes, not the economics for individual users&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;This change is not backwards compatible and requires a hard fork&lt;&#x2F;li&gt;
&lt;li&gt;User and developer experience for individual transactions remains unchanged&lt;&#x2F;li&gt;
&lt;li&gt;Block producers need to adjust their transaction selection algorithms to account for the new gas accounting rules&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;SSTORE Operations:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Setting storage to zero: User receives refund, but block gas accounting uses full cost&lt;&#x2F;li&gt;
&lt;li&gt;Verify blocks containing many storage-clearing operations still adhere to gas limits&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Block Gas Limit Edge Cases:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Construct blocks with varying amounts of refundable operations&lt;&#x2F;li&gt;
&lt;li&gt;Ensure blocks cannot exceed gas limits through refund mechanisms&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Transaction Gas vs Block Gas:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Verify that transaction costs for users remain unchanged&lt;&#x2F;li&gt;
&lt;li&gt;Confirm block gas accounting properly excludes refunds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Eliminates potential denial-of-service vectors that exploit gas refunds to exceed block computational limits&lt;&#x2F;li&gt;
&lt;li&gt;Improves predictability of block processing times by enforcing stricter limits on computational work&lt;&#x2F;li&gt;
&lt;li&gt;Prevents miners&#x2F;validators from including transactions that collectively contain more computational work than intended&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BURN opcode</title>
        <published>2024-09-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dev Bear</name><uri>https://github.com/itsdevbear</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7775/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7775-burn-opcode/21287" />
        

        <id>https://wg-eips.ritovision.com/7775/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7775"
            label="EIP-7775" />
        

        
        

        
        <summary type="html">An opcode to burn native ether at the given address</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7775/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces a &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode to the EVM. When called, the opcode is to burn native ether at the address of the current evm context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation for this proposal is to provide a standardized and efficient way to burn native ether directly within the EVM. Historically, contracts such as the BeaconDepositContract have &quot;burned&quot; ether by making it irrecoverable from the given address. This approach can lead to confusion and potential misuse. By introducing a dedicated &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode, we can ensure a clear and consistent method for burning native ether. This could become useful for Ethereum L2s when transferring ether back to the L1, as well as other EVM L1 chains that could leverage this for their cryptoeconomics.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;behaviour&quot;&gt;Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode &lt;code&gt;(0xFC)&lt;&#x2F;code&gt; is introduced with the following behavior:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pops one 32-byte word from the top of the stack, treating these bytes as the &lt;code&gt;uint256&lt;&#x2F;code&gt; amount of native ether to be burned.&lt;&#x2F;li&gt;
&lt;li&gt;Retrieves the current address from the EVM execution context.&lt;&#x2F;li&gt;
&lt;li&gt;Checks the balance of the current address.&lt;&#x2F;li&gt;
&lt;li&gt;If the amount to be burned is greater than the balance of the current address, the opcode &lt;code&gt;MUST&lt;&#x2F;code&gt; revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the amount to be burned is 0, the execution &lt;code&gt;MUST NOT&lt;&#x2F;code&gt; revert.&lt;&#x2F;li&gt;
&lt;li&gt;Subtracts the amount from the current address&#x27;s native ether balance.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When &lt;code&gt;BURN&lt;&#x2F;code&gt; is used in the context of a DELEGATECALL or CALLCODE, the contract whose balance is to be manipulated is the contract that issued the DELEGATECALL or CALLCODE instruction.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;BURN&lt;&#x2F;code&gt; is used in the context of a STATICCALL the call &lt;code&gt;MUST&lt;&#x2F;code&gt; revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The base gas cost for the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode is 100 gas. The dynamic gas cost is determined as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the value to be burned is 0, the dynamic gas cost is 0.&lt;&#x2F;li&gt;
&lt;li&gt;If the account doesn&#x27;t exist, or the balance of the account is 0, the dynamic gas cost is 0.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the dynamic gas cost is 2800.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The total gas cost for the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode is the sum of the base gas cost and the dynamic gas cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h3&gt;
&lt;p&gt;Example pseudocode for the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; op_burn&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; interpreter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the base gas cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;consume_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pop the value to be burned from the stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value_to_burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the value to be burned is 0, do not revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; value_to_burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve the current address from the EVM execution context&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; scope&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check the balance of the current address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the value to be burned is greater than the balance, revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; value_to_burn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ErrInsufficientBalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the account balance is 0, return.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Subtract the value from the current address&amp;#39;s balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sub_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value_to_burn&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The account is known to exist at this point, thus we consume &amp;quot;warm&amp;quot; gas.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;consume_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2800&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of the &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode helps clean up a piece of weird semantics in the Ethereum. Historically, burning native ether involved sending them to an address from which they could not be recovered, such as the zero address or a contract with no withdrawal functionality. This method is not only inefficient but also confusing for indexers and other tools that track token movements. By providing a dedicated &lt;code&gt;BURN&lt;&#x2F;code&gt; opcode, we eliminate this ambiguity and ensure that the act of burning tokens is explicit and standardized.&lt;&#x2F;p&gt;
&lt;p&gt;Potential Pros:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Provides a clear and standardized method for burning native ether within smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Allows for better accounting practices of native token within smart contracts.&lt;&#x2F;li&gt;
&lt;li&gt;Reduces the possibility of a smart contract exploit caused by native token that was marked as &quot;burned&quot; being unintetionally recovered.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Potential Cons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Does not help remove unrecoverable ether sitting in existing contracts.&lt;&#x2F;li&gt;
&lt;li&gt;New code in the clients&lt;&#x2F;li&gt;
&lt;li&gt;New concept needed to be added to the yellow paper.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode and thus must be activated via a scheduled hardfork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;!-- TODO --&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Potentially opens up misuse when using &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTCODETYPE instruction</title>
        <published>2024-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7761/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7761-is-contract-instruction/20936" />
        

        <id>https://wg-eips.ritovision.com/7761/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7761"
            label="EIP-7761" />
        

        
        

        
        <summary type="html">Add EXTCODETYPE instruction to EOF to address common uses of EXTCODE* instructions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7761/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Allow EOF contracts to discriminate between EOAs (Externally Owned Accounts) and contract accounts by introducing an &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOFv1 as scoped in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7692&#x2F;&quot;&gt;EIP-7692&lt;&#x2F;a&gt; removes code introspection capabilities from the EVM, including the &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; instruction (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;). This makes it hard for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1155&#x2F;&quot;&gt;ERC-1155&lt;&#x2F;a&gt; standard contracts to be implemented, as they rely on discovering whether a token&#x27;s &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; call target was an EOA or a contract account:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;safeTransfers&lt;&#x2F;code&gt; to EOAs succeed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;safeTransfers&lt;&#x2F;code&gt; to contract accounts call an &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; (&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt;) on them and expect to get a special magic return value, otherwise the transfer reverts (on the assumption that such a recipient may not be able to interact with the token)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Application and library developers are also concerned about dynamic proxies written in EOF accidentally pointing to legacy accounts which cannot safely be called with &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;. They would like a way to differentiate between EOF and legacy contracts.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; is aimed to fill this gap and bring back the possibility to easily implement ERC-721 and ERC-1155 standard contracts in EOF as well as preserve EOF proxy contract safety.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;tbd&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_COLD_ACCOUNT_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;2600&lt;&#x2F;code&gt; in the [Ethereum Execution Layer Spec Constants]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;100&lt;&#x2F;code&gt; in the [Ethereum Execution Layer Spec Constants]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TYPE_NONE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TYPE_LEGACY_CONTRACT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TYPE_EOF_CONTRACT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce a new EOFv1 instruction on the block number &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; (&lt;code&gt;0xe9&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;EOF code which contains this instruction before &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; is considered invalid. Beginning with block &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; &lt;code&gt;0xe9&lt;&#x2F;code&gt; is added to the set of valid EOFv1 instructions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;extcodetype&quot;&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_WARM_ACCESS&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;pop 1 argument &lt;code&gt;target_address&lt;&#x2F;code&gt; from the stack&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;target_address&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address), then halt with an exceptional failure
&lt;ul&gt;
&lt;li&gt;Notice: Future expansion of the EVM address space may remove or reduce the number of bytes in this check.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_COLD_ACCOUNT_ACCESS - GAS_WARM_ACCESS&lt;&#x2F;code&gt; if &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and add &lt;code&gt;target_address&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Load the code from &lt;code&gt;target_address&lt;&#x2F;code&gt; and refer to it as &lt;code&gt;loaded_code&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;loaded_code&lt;&#x2F;code&gt; is empty (does not exist or has zero length), push &lt;code&gt;TYPE_NONE&lt;&#x2F;code&gt; onto the stack and stop processing the operation&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;loaded_code&lt;&#x2F;code&gt; indicates a delegation designator (for example, &lt;code&gt;0xef0100&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;),
&lt;ul&gt;
&lt;li&gt;replace &lt;code&gt;loaded_code&lt;&#x2F;code&gt; with the delegated code.&lt;&#x2F;li&gt;
&lt;li&gt;deduct gas in accordance with the delegation designation rules&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;loaded_code&lt;&#x2F;code&gt; indicates an EOFv1 packaged contract (starts with the bytes &lt;code&gt;0xef0001&lt;&#x2F;code&gt;) push &lt;code&gt;TYPE_EOF_CONTRACT&lt;&#x2F;code&gt; onto the stack and stop processing the operation&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, push &lt;code&gt;TYPE_LEGACY_CONTRACT&lt;&#x2F;code&gt; onto the stack and stop processing the operation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: if there is not enough gas to deduct for delegation designation the whole message frame will halt, making updating the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; irrelevant.&lt;&#x2F;p&gt;
&lt;p&gt;Note: If &lt;code&gt;target_address&lt;&#x2F;code&gt; or the delegation designator points to an account with a contract mid-creation then the code is empty and returns &lt;code&gt;0&lt;&#x2F;code&gt; (&lt;code&gt;TYPE_NONE&lt;&#x2F;code&gt;). This is aligned with similar behavior of instructions like &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;alternative-solutions&quot;&gt;Alternative solutions&lt;&#x2F;h3&gt;
&lt;p&gt;There have been other solutions proposed to alleviate the problems related to lack of code introspection required for ERC-721 and ERC-1155 standards:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extra status code for &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instruction - allowing to discriminate a result coming from calling an EOA&lt;&#x2F;li&gt;
&lt;li&gt;Extra argument for &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; (a &quot;fail if EOA&quot; flag)&lt;&#x2F;li&gt;
&lt;li&gt;Two return values from &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; (status code + whether it was EOA)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; setting a new &lt;code&gt;callstatus&lt;&#x2F;code&gt; register (+ a new &lt;code&gt;CALLSTATUS&lt;&#x2F;code&gt; instruction)&lt;&#x2F;li&gt;
&lt;li&gt;Re-enable &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; in EOF, keeping its behavior same as in legacy&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; has been chosen as the most elegant and minimal solution satisfying the requirements at hand and still able to be introduced in EOFv1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reuse-the-0x3b-extcodesize-opcode-for-extcodetype&quot;&gt;Reuse the &lt;code&gt;0x3b&lt;&#x2F;code&gt; (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;) opcode for &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode is preferred by a general policy to not reuse opcodes. Also &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; can be rolled out in legacy EVM if desired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keep-code-introspection-banned&quot;&gt;Keep code introspection banned&lt;&#x2F;h3&gt;
&lt;p&gt;Removing code introspection is one of the tenets of EOF and &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; would be an exception from the principle. Without &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;, ERC-721 and ERC-1155 standard implementations have to resort to either:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Leveraging a &quot;booster contract&quot; which would be legacy and would call &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; for them. This has been deemed inelegant and inconvenient from the point of view of library implementers, requiring them to hard code an address of such a contract (with the usual address-related problems arising on different EVM chains)&lt;&#x2F;li&gt;
&lt;li&gt;Continuing to use legacy EVM themselves. This is suboptimal, since EVM compilers are likely to at some point deprecate legacy EVM as compilation target&lt;&#x2F;li&gt;
&lt;li&gt;Updating the standards to not rely on code introspection patterns in &lt;code&gt;safeTransfer&lt;&#x2F;code&gt; safeguards. This can be accomplished for example by leveraging &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt;, leaving out only contracts which do not implement ERC-165, and at the same time have non-throwing fallback functions, as indistinguishable from EOAs. This is not easy to achieve since ERC-721 and ERC-1155 are Final and adopted in practice.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;endgame-account-abstraction-issues&quot;&gt;&quot;Endgame Account Abstraction&quot; issues&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; (and earlier &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; available in legacy EVM) are claimed to slow down AA adoption, because they encourage patterns which discriminate between smart contract and EOA accounts, e.g. not allowing the former to interact. However, there are counterarguments that it is up to other factors which slow down AA adoption (assumption that accounts can produce ECDSA signatures, and the lack of adoption of smart contract signatures).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;including-safeguarding-against-proxy-bricking&quot;&gt;Including safeguarding against proxy bricking&lt;&#x2F;h3&gt;
&lt;p&gt;In parallel to the ERC-721 &#x2F; ERC-1155 problem, another potential risk has been brought to attention. Since EOFv1 prohibits &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; targeting legacy contracts, there exists a scenario where an EOF proxy contract accidentally upgrades its implementation to a legacy EVM one. Since reverting this or upgrading again (using current proxy standards) requires the implementation contract to be called, it would effectively render the contract unusable.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason it was decided to have a generalized &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; instruction instead of a &lt;code&gt;HASCODE&lt;&#x2F;code&gt; instruction. This provides the means to safeguard against such a scenario that a simpler instruction could not.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relation-to-eip-7702-set-eoa-account-code&quot;&gt;Relation to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; &quot;Set EOA account code&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; is activated, the discrimination between EOAs and contract accounts using &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (or &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt;) has an edge case: Whenever an EOA sets its code to a contract account which does not respond as expected to an &lt;code&gt;onERC721Received&lt;&#x2F;code&gt; (&lt;code&gt;onERC1155Received&lt;&#x2F;code&gt;) callback, transfers to it will revert, despite the recipient being able to interact with the token. This has been deemed unlikely to be a problem, as for the intended real-world uses of EIP-7702, those callbacks will be implemented by designator codes.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the requirement that EOF proxy contracts be able to determine if the new target is safe we cannot return a value for indicating that the account itself is delegated without also providing the delegated address. Instead, we return  the code for the account that has the delegated code, applying the delegation. This is because the executable code is what matters for proxy updates.&lt;&#x2F;p&gt;
&lt;p&gt;This differs from &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; behavior which do return a hash and short code indicating the proxy. The behavior of &lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; is closer to a &quot;code executing operation&quot; in purpose as it is meant to describe the execution behavior of the account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;EXTCODETYPE&lt;&#x2F;code&gt; at &lt;code&gt;0xe9&lt;&#x2F;code&gt; can be introduced in a backwards compatible manner into EOFv1 (no bump to version), because &lt;code&gt;0xe9&lt;&#x2F;code&gt; has been rejected by EOF validation before &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; and there are no EOF contracts on-chain with a &lt;code&gt;0xe9&lt;&#x2F;code&gt; which would have their behavior altered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;[Ethereum Execution Layer Spec Constants] :https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;1adcc1bfe774798bcacc685aebc17bd9935078c3&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;gas.py#L65-L66&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase MIN_BASE_FEE_PER_BLOB_GAS</title>
        <published>2024-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Max Resnick</name><uri>https://github.com/MaxResnick</uri>
	</author>
	
	<author>
		<name>Davide Crapis</name><uri>https://github.com/dcrapis</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7762/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7762-increase-min-base-fee-per-blob-gas/20949" />
        

        <id>https://wg-eips.ritovision.com/7762/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7762"
            label="EIP-7762" />
        

        
        

        
        <summary type="html">Adjust the MIN_BASE_FEE_PER_BLOB_GAS to speed up price discovery on blob space</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7762/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes an increase to the MIN_BASE_FEE_PER_BLOB_GAS to speed up price discovery on blob space. It also resets the excess blob gas to 0, to avoid a blob base fee spike.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When scoping 4844, the thinking was that blobs would only enter price discovery once, relatively quickly after the blob rollout; however, this has not been the case. In fact, blobs have entered price discovery several times, and the frequency of price discovery events is likely to increase in the short term as we approach saturation of capacity. Moreover, the roadmap calls for further increases in blob capacity in subsequent hardforks, which may lead to price discovery events happening around those changes in the future.&lt;&#x2F;p&gt;
&lt;p&gt;Increasing the MIN_BASE_FEE_PER_BLOB_GAS will speed up price discovery on blob space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;min-base-fee-per-blob-gas-increase&quot;&gt;&lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt; Increase&lt;&#x2F;h3&gt;
&lt;p&gt;The main specification change introduced by this EIP is setting MIN_BASE_FEE_PER_BLOB_GAS to 2**25:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;diff&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-inserted&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-inserted&quot;&gt; MIN_BASE_FEE_PER_BLOB_GAS  =  2**25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-deleted&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-deleted&quot;&gt; MIN_BASE_FEE_PER_BLOB_GAS = 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;excess-blob-gas-reset&quot;&gt;&lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; Reset&lt;&#x2F;h3&gt;
&lt;p&gt;To avoid a blob base fee spike, the &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; is modified to reset &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; to 0 at the fork. To detect the fork height, the block timestamp needs to be passed into &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; at the fork, set excess_blob_gas to 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; block_timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; otherwise, calculate normally&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;validate_block&lt;&#x2F;code&gt; needs to be updated to pass the block timestamp into &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add timestamp parameter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current MIN_BASE_FEE_PER_BLOB_GAS is 1 wei. This is many orders of magnitude lower than the prevailing price of blobs when blobs enter price discovery. Whenever demand for blobs exceeds supply, blobs enter price discovery, but traversing the 8 orders of magnitude between 1 wei and the point where elasticity of demand starts to decrease takes a long time.&lt;&#x2F;p&gt;
&lt;p&gt;The blob base fee can at most double every $\log_{1.125}(10) = 5.885$ blocks when blocks use all available blob space. When blobs enter price discovery, they must climb many factors of 2 to reach the prevailing price.&lt;&#x2F;p&gt;
&lt;p&gt;To set the parameter appropriately, one approach is to look at the cost of simple transfers when base fees are low. The cost of a simple transfer when the base fee is 1 GWEI  is ~5 cents USD at today&#x27;s prices (2,445.77$ ETH&#x2F;USDC). We can try to peg the minimum price of a blob to that. Today, to reach this price, it requires an excess blob gas of &lt;code&gt;63070646&lt;&#x2F;code&gt;. When you calculate how long this would take to reach from 0 excess blob gas, you get:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;63070646&#x2F;(3 * 2**17) = 160.396947225&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The closest power of 2 to the corresponding reserve price would be &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS = 2**27&lt;&#x2F;code&gt;. Out of an abundance of caution, we will go with &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS = 2**25&lt;&#x2F;code&gt; to ensure that even if the price of ETH rises significantly, the reserve price will not be set too high. This value corresponds to a minimum blob price of ~1 cent at today&#x27;s prices (2,445.77$ ETH&#x2F;USDC). Further, decreasing the &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt; beyond &lt;code&gt;2**25&lt;&#x2F;code&gt; would slow down price discovery without a significant decrease in the price of blobs when the network is unsaturated.&lt;&#x2F;p&gt;
&lt;p&gt;Below you will find a plot provided by @dataalways showing the fraction of type 3 transaction fees that are paid in blob base fees for different values of &lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt;. Note that even after the proposed change, for historical values of l1 gas, the price of blobs would have been dominated by the price of the L1 gas.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7762&#x2F;.&#x2F;assets&#x2F;base_fee_1.png&quot; alt=&quot;Base Fee 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7762&#x2F;.&#x2F;assets&#x2F;base_fee_225.png&quot; alt=&quot;Base Fee 2^25&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not backwards compatible and requires a coordinated upgrade across all clients at a specific block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Rollups that use blobs as a data availability layer will need to update their posting strategies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>GAS2ETH opcode</title>
        <published>2024-08-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>pcaversaccio</name><uri>https://github.com/pcaversaccio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7791/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7791-gas2eth-opcode/21418" />
        

        <id>https://wg-eips.ritovision.com/7791/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:7791"
            label="EIP-7791" />
        

        
        

        
        <summary type="html">Introduces a new opcode, `GAS2ETH`, to convert gas to ETH</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7791/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; opcode that enables the direct conversion of gas into ether (ETH).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is based on the premise that smart contract authors, compiler teams, and public goods projects in general should be compensated for their contributions. Moreover, their compensation should &lt;em&gt;scale&lt;&#x2F;em&gt; with the usage of their contracts. A widely used and popular contract offers significant value to its users through its functionality and to the network by driving demand for blockspace — Ethereum&#x27;s &lt;em&gt;raison d&#x27;être&lt;&#x2F;em&gt;. This increased demand also benefits miners and validators, who are rewarded for executing these contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Monetizing smart contracts in a scalable manner remains challenging at the time of this writing. This difficulty is evident from existence of many different monetization strategies employed across various smart contracts — ranging from fee structures to the issuance of tokens with &quot;tokenomics&quot; of varying levels of complexity. Additionally, many public goods projects struggle to secure funding.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing the &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; opcode offers contract authors, as well as the tools they use, a new way to achieve their monetization objectives. By charging gas, they integrate with an established user experience that is both familiar and understood by users. The proposed instruction ensures that existing transaction creation and processing tools remain unchanged. Moreover, by charging gas, contract authors align economically with network activity; they benefit from higher compensation during periods of intense network usage and receive less when activity is low. This helps align the incentives of smart contract authors, validators, and the broader network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A new opcode, &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; (&lt;code&gt;0xFC&lt;&#x2F;code&gt;), is introduced to enable direct conversion of gas into ETH within the EVM. This opcode operates under a new budgeting mechanism: each transaction maintains a &lt;em&gt;global&lt;&#x2F;em&gt; &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget initialized to the transaction gas limit (&lt;code&gt;tx.gas_limit&lt;&#x2F;code&gt;), and each call frame derives a &lt;em&gt;local&lt;&#x2F;em&gt; allowance from the gas forwarded to it. These budgets cap the total amount of gas that can be converted into ETH, both per call frame and across the entire transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; (&lt;code&gt;0xFC&lt;&#x2F;code&gt;) opcode executes according to the following rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pops two values from the stack: &lt;code&gt;addr&lt;&#x2F;code&gt; then &lt;code&gt;gas_amount&lt;&#x2F;code&gt;. If there are fewer than two values on the stack, the calling context MUST fail with stack underflow.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts &lt;code&gt;gas_amount&lt;&#x2F;code&gt; from both the current call frame&#x27;s local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance and the transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;gas_amount&lt;&#x2F;code&gt; is greater than the current call frame&#x27;s local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance or the remaining transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget, set &lt;code&gt;gas_amount&lt;&#x2F;code&gt; to &lt;code&gt;min(gas_amount, remaining_local_allowance, remaining_global_GAS2ETH_budget)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Computes &lt;code&gt;wei_val&lt;&#x2F;code&gt; by multiplying &lt;code&gt;gas_amount&lt;&#x2F;code&gt; by the current transaction context&#x27;s &lt;code&gt;gas_price&lt;&#x2F;code&gt; (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;98d6ddaaa709a2b7d0cd642f4cfcdadc8c0808e1&#x2F;src&#x2F;ethereum&#x2F;cancun&#x2F;vm&#x2F;instructions&#x2F;environment.py#L325&quot;&gt;EELS&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Endows the address &lt;code&gt;addr&lt;&#x2F;code&gt; with &lt;code&gt;wei_val&lt;&#x2F;code&gt; wei.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes &lt;code&gt;wei_val&lt;&#x2F;code&gt; onto the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On reverts (e.g., through the &lt;code&gt;REVERT&lt;&#x2F;code&gt; opcode or any exceptional halt), any gas paid out via &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; MUST be refunded to both the transaction-global and the parent call frame&#x27;s budgets.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the transfer of &lt;code&gt;wei_val&lt;&#x2F;code&gt; to the target account cannot fail. In particular, the destination account code (if any) is not executed, or, if the account does not exist, the balance is still added to the given address &lt;code&gt;addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Gas consumed by &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; does not affect the base fee, burn, block &lt;code&gt;gasUsed&lt;&#x2F;code&gt;, or the transaction fee. Instead, the ETH transfer represents a direct payment from the transaction signer (i.e. &lt;code&gt;tx.origin&lt;&#x2F;code&gt;) to the recipient address, outside the block reward and fee accounting mechanisms. This ensures no duplication of ETH between the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; reward and the amount transferred via &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas2eth-budgeting-model&quot;&gt;&lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; Budgeting Model&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction maintains a single global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget initialized to the transaction gas limit (&lt;code&gt;tx.gas_limit&lt;&#x2F;code&gt;). Each call frame also maintains a local allowance, derived automatically from the gas forwarded to it:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;On &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;: &lt;code&gt;allowance = min(forwarded_gas, remaining_global_GAS2ETH_budget)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;On &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;: the callee shares the caller&#x27;s allowance.&lt;&#x2F;li&gt;
&lt;li&gt;On revert: all &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; deductions within that call frame are refunded to both the transaction-global and parent frame&#x27;s budgets.&lt;&#x2F;li&gt;
&lt;li&gt;On normal return: any unused local allowance is returned to the transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This model ensures that untrusted callees cannot consume more &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; than the gas explicitly forwarded to them, while keeping total &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; creation bounded by the transaction&#x27;s gas limit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed cost of this opcode is identical to the recently proposed &lt;code&gt;PAY&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L52&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L53&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;gas-calculation&quot;&gt;Gas calculation&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Is &lt;code&gt;addr&lt;&#x2F;code&gt; in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;?
&lt;ul&gt;
&lt;li&gt;If yes, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Does &lt;code&gt;addr&lt;&#x2F;code&gt; exist or is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes to either, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; vs. pro-rata: The pro-rata model incentivizes inflating contract gas usage to artificially increase fees. In contrast, this proposal allows contract authors to charge their desired amount directly, eliminating the need for unnecessary gas consumption.&lt;&#x2F;li&gt;
&lt;li&gt;Target address vs. simply increasing balance of the currently executing contract: Using a target address is more flexible, enabling contract authors to write more modular code and separate the concerns of fee collection from contract functionality. For instance, the contract may want to designate a specific recipient for fees without necessarily granting them direct withdrawal access.&lt;&#x2F;li&gt;
&lt;li&gt;Charging gas instead of ETH: Charging ETH directly complicates the user experience and prevents contract authors from participating in fluctuations in gas demand directly.&lt;&#x2F;li&gt;
&lt;li&gt;For the value of &lt;code&gt;gas_price&lt;&#x2F;code&gt;, use the same gas price as which is used to calculate the tx cost in ETH. This leads to the most consistent computation between &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; and the user&#x27;s experience when creating a transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Separate budget: Having a separate budget prevents certain types of DoS attacks where usage of &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; can interfere with the actual budget needed for execution of the contract. (For example, a target contract can &quot;waste&quot; gas with &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt;, resulting in the caller not having enough gas to finish execution). This also results in &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; usage not affecting the burn rate. The intuition is that, since it doesn&#x27;t actually use computational resources (which gas normally &quot;accounts&quot; for), it shouldn&#x27;t affect blockspace computations or the base fee.&lt;&#x2F;li&gt;
&lt;li&gt;Budget being 100% of the gas limit: 100% of the gas limit is a &quot;natural&quot; bound on the gas used and provides some protection to the user from unbounded &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; spending. In the future, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;-based transaction type could be added which includes an explicitly user-specified &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget.&lt;&#x2F;li&gt;
&lt;li&gt;No exceptional halt when &lt;code&gt;gas_amount&lt;&#x2F;code&gt; exceeds the remaining budgets, both the current call frame&#x27;s local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance and the transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget. Since these budgets are not introspectable, the contract would otherwise have no way to gracefully avoid an exceptional halt.&lt;&#x2F;li&gt;
&lt;li&gt;Bounding by execution gas ensures that untrusted callees cannot consume more &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; than the gas explicitly forwarded to them.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Like the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5920&#x2F;&quot;&gt;&lt;code&gt;PAY&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; opcode and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;beacon withdrawals&lt;&#x2F;a&gt;, &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; enables ETH transfers that occur without code execution in the recipient account. To prevent denial-of-service (DoS) attacks from untrusted callees, each call frame receives a local &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; allowance automatically derived from the gas &lt;em&gt;forwarded&lt;&#x2F;em&gt; to it, while a transaction-global &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget enforces an overall cap equal to the transaction&#x27;s gas limit. This ensures that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Callees cannot deplete the sender&#x27;s &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; budget beyond the gas explicitly forwarded to them.&lt;&#x2F;li&gt;
&lt;li&gt;Contracts calling into untrusted code remain robust, as the callee&#x27;s &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; spending capacity is naturally limited by its gas stipend.&lt;&#x2F;li&gt;
&lt;li&gt;The total ETH that can be created via &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; in a transaction is strictly bounded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s important to note that &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; introduces an economic incentive for malicious contracts to consume as much of their allowance as possible, converting previously non-profitable griefing vectors into potentially profitable ones. Contract authors SHOULD minimize forwarded gas and &lt;code&gt;GAS2ETH&lt;&#x2F;code&gt; exposure when interacting with untrusted code, similar to existing best practices for limiting gas stipends or ETH transfers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State conversion to Verkle Tree</title>
        <published>2024-07-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	<author>
		<name>Jamie Lokier</name><uri>https://github.com/jlokier</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Parithosh Jayanthi</name><uri>https://github.com/parithosh</uri>
	</author>
	
	<author>
		<name>Gabriel Rocheleau</name><uri>https://github.com/gabrocheleau</uri>
	</author>
	
	<author>
		<name>Karim Taam</name><uri>https://github.com/matkt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7748/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7748-state-conversion-to-verkle-tree/20625" />
        

        <id>https://wg-eips.ritovision.com/7748/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7748"
            label="EIP-7748" />
        

        
        

        
        <summary type="html">Describes a state conversion procedure to migrate key-values from the Merkle Patricia Tree to the Verkle Tree.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7748/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a procedure to convert, on each block, a fixed number of key-values from the existing Merkle Patricia Tree (MPT) to the Verkle Tree (VKT).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The accounts state is too large to wait for transactions to organically move all of them to the VKT through the Overlay Tree. Thus, we need a strategy to convert all the state within a reasonable time. The state conversion completion allows removing the Overlay Tree abstraction introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt; and to use directly the VKT for all state access.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONVERSION_START_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Timestamp at which the conversion starts.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of &lt;em&gt;conversion units&lt;&#x2F;em&gt; to be converted per block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;A &lt;em&gt;conversion unit&lt;&#x2F;em&gt; is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A contract storage slot.&lt;&#x2F;li&gt;
&lt;li&gt;An account data (e.g. balance, nonce, code-hash) and code (if any).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;changes-to-the-execution-spec&quot;&gt;Changes to the execution spec&lt;&#x2F;h3&gt;
&lt;p&gt;Include the following code in the existing &lt;code&gt;apply_body(...)&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; apply_body&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Uint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONVERSION_START_TIMESTAMP&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_finished&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state_convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONVERSION_STRIDE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;&#x2F;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;decode_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Before executing txs, it calls &lt;code&gt;state_convert(...)&lt;&#x2F;code&gt; (described below) which performs a state conversion step for this block.&lt;&#x2F;p&gt;
&lt;p&gt;In &lt;code&gt;state.py&lt;&#x2F;code&gt;, add the following code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The account next conversion step continues converting the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    storage-slot with key greater than or equal to next_key. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    If there isn&amp;#39;t such a storage-slot, the account must move to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    AccountDataPhase.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    The account next conversion step continues migrating the account &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    code (if any) and basic data. After processing, the account must &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    move to the next account in the trie (or finish if it was the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    last one).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Contains the state conversion next step.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    phase&lt;&#x2F;span&gt;&lt;span&gt; :&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;These new structures allows &lt;code&gt;State&lt;&#x2F;code&gt; to track where we&#x27;re in the conversion process.&lt;&#x2F;p&gt;
&lt;p&gt;Modify the &lt;code&gt;State&lt;&#x2F;code&gt; class by adding the following attributes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; State&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _conversion_finished&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;&#x2F;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Define a function with the following signature:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;trie&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;K&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; V&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key_seek&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;K&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; V&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns the first (key, value) in the trie-key is &amp;gt;= key_seek.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This method must only be used on Tries with secured=True,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; since key_seek is the keccak256(K).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - K, V: the key and value (e.g: Address&#x2F;Value, StorageSlot&#x2F;Value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; - next_key: The smallest trie-key present in the trie greater &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; than key_seek, or None if there isn&amp;#39;t one.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is up to the implementer to decide the best implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; considering its client architecture.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add or modify the following functions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_conversion_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When starting the conversion, initialize with the first account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; in the MPT.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize with the first account in the account trie.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        first_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accounts conversion starts with storage-slots conversion.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Starts with the lowest storage-slot key.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; CurrentConvertingAccount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;first_account&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; phase&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New function.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; conversion_move_to_next_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_conversion_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_main_trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We finished the conversion&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_finished&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Move to the next account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Modified function: add new only_if_empty optional parameter.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; only_if_empty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; only_if_empty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; &amp;lt;&#x2F;new_code&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As mentioned previously, the next function is called by &lt;code&gt;apply_body(...)&lt;&#x2F;code&gt; to perform the conversion step for a block:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note the following function is optimized for readability, not for performance.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state_convert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stride&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; stride&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_finished&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        curr_account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_conversion_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip translating storage if the account has an empty code hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip storage conversion for accounts with 0 nonce and empty code.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This covers the 28 EIP-7610 accounts, but would also cover all&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; pre-eip161 accounts on other chains.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span&gt; StoragePhase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the storage-slot from _storage_tries which is MPT data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_storage_tries&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                slot_num&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get_next_at_key&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The Overlay Tree will write in the VKT. We use the new&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; only_if_empty parameter to avoid writing stale values.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                set_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot_num&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; only_if_empty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There&amp;#39;re more storage-slots to be converted, continue in this phase.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; next_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; No more storage-slots. Move to the account data migration.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; There&amp;#39;s no storage trie for the account, move directly to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; migrating account&amp;#39;s data and code (if any).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;phase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; AccountDataPhase&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account code and basic data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Getting the code from the Overlay Tree is fine since it promises to return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the Account full code which would come from the MPT or a separate code database.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            chunked_code&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; chunkify_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; chunk_num&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;chunked_code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                state_set_codechunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunk_num&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunked_code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;chunk_num&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If the account data (i.e: nonce, balance, code-size, code-hash) lives in MPT, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get_account will pull from MPT and then we write to the VKT. If the account &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; data already lives in the VKT (i.e: it was indirectly converted by a tx), then &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it will return it from the VKT and write it again (i.e: it&amp;#39;s a noop).&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Thus, this operation is correct under both scenarios. That is, it won&amp;#39;t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; write stale data.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; curr_account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;conversion_move_to_next_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;state-conversion-step-position-in-block-execution&quot;&gt;State conversion step position in block execution&lt;&#x2F;h3&gt;
&lt;p&gt;Performing the conversion step before the block txs execution has some benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the state conversion step is done after txs execution, there&#x27;s a possibility that txs execution writes overlap with converted key-values, having to care about them becoming stale in the same block. With the proposed ordering, they can only become stale by writes of previous blocks.&lt;&#x2F;li&gt;
&lt;li&gt;It can reduce the complexity of optimizations, such as frontrunning the state conversion for the next block before it arrives.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;conversion-stride-proposed-value&quot;&gt;&lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; proposed value&lt;&#x2F;h3&gt;
&lt;p&gt;Performance benchmarks were done to achieve the right balance between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Don&#x27;t overload the clients with too much extra work per block.&lt;&#x2F;li&gt;
&lt;li&gt;Don&#x27;t create an unmanageable load in clients during feasible long reorgs.&lt;&#x2F;li&gt;
&lt;li&gt;Finish the conversion as fast as possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;account-code-chunking-done-in-a-single-step&quot;&gt;Account code chunking done in a single step&lt;&#x2F;h3&gt;
&lt;p&gt;If an account has code, this is chunked and inserted in the VKT in one go. An alternative is including a &lt;code&gt;CodePhase&lt;&#x2F;code&gt; and let each inserted chunk consume one unit of &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We decided to not do this to reduce the algorithm complexity. Considering the current maximum code size, the worst case scenario for a block could overflow the &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; limit by 24k&#x2F;31~=793 units.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deletion-of-eip-7610-accounts&quot;&gt;Deletion of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7610&#x2F;&quot;&gt;EIP-7610&lt;&#x2F;a&gt; accounts&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-7610 mentions the existence of 28 accounts that have:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a nonce of 0,&lt;&#x2F;li&gt;
&lt;li&gt;no code&lt;&#x2F;li&gt;
&lt;li&gt;a non-empty storage tree&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These storage slots are to be omitted from the conversion process, as they can not be accessed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expected-time-for-the-conversion-to-finish&quot;&gt;Expected time for the conversion to finish&lt;&#x2F;h3&gt;
&lt;p&gt;TODO: We have an estimation, but it might be worth recalculating it closer to the proposed fork having a more up to date state size estimate.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;missed-slots&quot;&gt;Missed slots&lt;&#x2F;h3&gt;
&lt;p&gt;The conversion logic runs at the start of each block, so missed slots don&#x27;t create special situations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accounts-storage-account-data-order&quot;&gt;Accounts storage-&amp;gt;account-data order&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed order synergizes with many EL client flat-db architectures, minimizing random disk-IO.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-counting-eip-161-accounts-for-conversion-stride-limit&quot;&gt;Not counting &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; accounts for &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; limit&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt; parameter tries to limit the load of effective writes. These special accounts are skipped since we try to perform a bulk &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;158&#x2F;&quot;&gt;EIP-158&lt;&#x2F;a&gt; deletion of the remaining accounts.&lt;&#x2F;p&gt;
&lt;p&gt;This might sound dangerous since if there were 1k of these accounts and all corresponded to be converted in the same block, we&#x27;d be forcing the clients to iterate 1k accounts without counting any quota from &lt;code&gt;CONVERSION_STRIDE&lt;&#x2F;code&gt;. The number of remaining accounts to delete is very low (i.e.: dozen) and also not contiguous, so this shouldn&#x27;t be a concern.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mpt-preimage-resolving&quot;&gt;MPT preimage resolving&lt;&#x2F;h3&gt;
&lt;p&gt;EL clients are expected to satisfy at least one of these conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;They have a proper flat-db design, which doesn&#x27;t require preimage resolving.&lt;&#x2F;li&gt;
&lt;li&gt;They have a full preimage database which can resolve &lt;em&gt;trie_key&lt;&#x2F;em&gt;-&amp;gt;&lt;em&gt;preimage&lt;&#x2F;em&gt; (but this can have poor performance).&lt;&#x2F;li&gt;
&lt;li&gt;They have downloaded the preimage database image that will be distributed before the conversion starts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: currently described in an external document.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transition-post-genesis&lt;&#x2F;code&gt; branch in &lt;code&gt;github.com&#x2F;gballet&#x2F;go-ethereum&lt;&#x2F;code&gt; implements this when setting &lt;code&gt;--override.overlay-stride&lt;&#x2F;code&gt; to a non-zero value on the command line.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trustless log and transaction index</title>
        <published>2024-07-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zsolt Felföldi</name><uri>https://github.com/zsfelfoldi</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7745/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7745-two-dimensional-log-filter-data-structure/20580" />
        

        <id>https://wg-eips.ritovision.com/7745/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7745"
            label="EIP-7745" />
        

        
        

        
        <summary type="html">An efficient, light client and DHT friendly replacement for block header bloom filters</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7745/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Replace the fixed 2048 bit log event bloom filters with a new lookup index data structure that can adapt to the changing number of events per block and consistently guarantee a sufficiently low false positive ratio, allowing efficient trustless proofs of log event queries, canonical block hash and transaction hash lookups.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed structure maps all index entries (log events, transaction and block markers) onto a global linear index space and hashes them into a binary Merkle tree based on that index. It also contains a &lt;em&gt;filter map&lt;&#x2F;em&gt; for every fixed length section of the index space. These are two dimensional sparse bit maps that provide an efficient probabilistic method for looking up indexed values or query patterns of values, yielding potential matches in the form of exact positions in the linear index space. Unlike the per-block bloom filters, they allow searching for specific events by accessing only a small portion of the entire dataset which can also be proven with a Merkle proof, making the search both efficient and light client friendly.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed structure can be efficiently used both for local search and for remote proof generation&#x2F;verification, thereby simplifying implementation of provers and verifiers. It also allows validators that are not interested in either searching or proving logs to generate the index root hash by maintaining a minimal index state with a relatively small (hard capped) size.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Adding logs has a significantly lower gas cost and should accordingly be less resource consuming than writing to the state. The original design of bloom filters in each block achieves this goal as there is no complex data structure like the state to update, the set of logs emitted in each block is all contained within the header and receipts belonging to that block. Logs mostly just have long term storage costs. On the other hand, searching logs in a long range of blocks is very expensive and the current bloom filters do not really help.&lt;&#x2F;p&gt;
&lt;p&gt;Bloom filters are only useful as long as they are sufficiently sparse. False positive ratio rises rapidly with the number of events per filter and the density of &lt;code&gt;1&lt;&#x2F;code&gt; bits in the filter bit vector. In the currently existing bloom filter each log address and topic sets 3 out of a fixed length of 2048 bits which resulted in sufficiently sparse filters in the beginning but with the increase of the block gas limits the false positive ratio soon made the filter practically useless. Mainnet blocks currently add over 1000 log addresses and topics in average and therefore the bloom filter size would need to increase about tenfold in order to achieve acceptable false positive rates again. This would raise block header size to about 3 kilobytes. Even if the size of the per-block bloom filters would be raised to a sufficient level, log search would still require accessing the entire header chain. Searching in just the most recent one year history would cost over 6 gigabytes of data, not counting the access of actual logs where the bloom filters have a match. The current situation is even worse, requiring a large portion of the full block receipt sets to be accessed due to the high false positive rate of the bloom filters. Transaction inclusion lookup is also very expensive, requiring all block bodies in the searched range.&lt;&#x2F;p&gt;
&lt;p&gt;While full nodes and RPC servers can and usually do build additional index structures to aid certain lookups, these structures cannot be verified remotely. While it is important to improve the transaction processing capabilities of Ethereum, trustless provability is required throughout the entire stack, from end user applications signing transactions, to the same or other end user applications getting the results they need. Scaling transaction processing only makes sense as long as there is also a trustless and scalable way to access the relevant results of those transactions. Users relying on trusted servers and indexers kind of beats the whole point of Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;terms-and-definitions&quot;&gt;Terms and definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;index entry&lt;&#x2F;em&gt;: a single entry in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree associated with an indexed event. It is either a &lt;em&gt;log entry&lt;&#x2F;em&gt;, a &lt;em&gt;transaction entry&lt;&#x2F;em&gt; or a &lt;em&gt;block entry&lt;&#x2F;em&gt;. An &lt;em&gt;index entry&lt;&#x2F;em&gt; generates one or more &lt;em&gt;map values&lt;&#x2F;em&gt;. Each &lt;em&gt;log entry&lt;&#x2F;em&gt; adds one &lt;em&gt;address value&lt;&#x2F;em&gt; and 0..4 &lt;em&gt;topic values&lt;&#x2F;em&gt; (in this order). Each &lt;em&gt;transaction entry&lt;&#x2F;em&gt; adds one &lt;em&gt;transaction value&lt;&#x2F;em&gt; and each &lt;em&gt;block entry&lt;&#x2F;em&gt; adds one &lt;em&gt;block value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;map value&lt;&#x2F;em&gt;: a searchable value associated with an &lt;em&gt;index entry&lt;&#x2F;em&gt;. It is either an &lt;em&gt;address value&lt;&#x2F;em&gt;, a &lt;em&gt;topic value&lt;&#x2F;em&gt;, a &lt;em&gt;transaction value&lt;&#x2F;em&gt; or a &lt;em&gt;block value&lt;&#x2F;em&gt;. Each &lt;em&gt;map value&lt;&#x2F;em&gt; is represented by a 32 byte hash (the &lt;em&gt;map value hash&lt;&#x2F;em&gt;) which is calculated as &lt;code&gt;sha2(address)&lt;&#x2F;code&gt;, &lt;code&gt;sha2(topic)&lt;&#x2F;code&gt;, &lt;code&gt;sha2(tx_hash + b&quot;\x01&quot;)&lt;&#x2F;code&gt; or &lt;code&gt;sha2(block_hash + b&quot;\x02&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;map value index&lt;&#x2F;em&gt;: a single position in the global linear index space. A new &lt;em&gt;map value index&lt;&#x2F;em&gt; is assigned to each indexed &lt;em&gt;map value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;map entry index&lt;&#x2F;em&gt;: the position where an &lt;em&gt;index entry&lt;&#x2F;em&gt; is located in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree. Each &lt;em&gt;index entry&lt;&#x2F;em&gt; is located at the position corresponding to the &lt;em&gt;map value index&lt;&#x2F;em&gt; of the first &lt;em&gt;map value&lt;&#x2F;em&gt; it generates.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;filter map&lt;&#x2F;em&gt;: a &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; by &lt;code&gt;MAP_HEIGHT&lt;&#x2F;code&gt; sized sparse bit map assigned to a &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; length section of the &lt;em&gt;map value index&lt;&#x2F;em&gt; space. Each &lt;em&gt;map value&lt;&#x2F;em&gt; assigned to this range is marked on the map at a row and column that depends on the &lt;em&gt;map value index&lt;&#x2F;em&gt;, &lt;em&gt;mapping layer&lt;&#x2F;em&gt; and the &lt;em&gt;map value hash&lt;&#x2F;em&gt;. Rows are sparsely encoded as a list of marked column indices (in strictly ascending order, which also coincides with the order of occurence). Each map contains at most &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; marks and therefore the chance of false positives is kept at a constant low level.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;mapping layer&lt;&#x2F;em&gt;: each layer defines a (&lt;em&gt;map index&lt;&#x2F;em&gt;, &lt;em&gt;map value hash&lt;&#x2F;em&gt;) =&amp;gt; &lt;em&gt;row index&lt;&#x2F;em&gt; mapping and imposes a limit on the number of &lt;em&gt;map values&lt;&#x2F;em&gt; mapped into each row using that particular mapping. Multiple &lt;em&gt;mapping layers&lt;&#x2F;em&gt; can be applied simultaneously on the same &lt;em&gt;filter map&lt;&#x2F;em&gt;. Each &lt;em&gt;map value&lt;&#x2F;em&gt; is mapped using the lowest possible &lt;em&gt;mapping layer&lt;&#x2F;em&gt; where the number of marks in the assigned row is lower than the limit. On layer 0 the &lt;em&gt;row index&lt;&#x2F;em&gt; mapping only changes once per &lt;em&gt;index epoch&lt;&#x2F;em&gt;. On higher layers the mapping changes more frequently and also the row size limit is higher.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;index epoch&lt;&#x2F;em&gt;: a &lt;code&gt;MAPS_PER_EPOCH&lt;&#x2F;code&gt; sized group of consecutive &lt;em&gt;filter maps&lt;&#x2F;em&gt; stored in the hash tree in a way so that multiple rows of adjacent &lt;em&gt;filter maps&lt;&#x2F;em&gt; with the same &lt;em&gt;row index&lt;&#x2F;em&gt; can be efficiently retrieved in a single Merkle multiproof.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;consensus-data-format&quot;&gt;Consensus data format&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;block-headers&quot;&gt;Block headers&lt;&#x2F;h4&gt;
&lt;p&gt;Beginning at the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients MUST replace the &lt;code&gt;logs_bloom&lt;&#x2F;code&gt; field of the header schema with &lt;code&gt;log_index_root&lt;&#x2F;code&gt; which is the root hash of the &lt;code&gt;LogIndex&lt;&#x2F;code&gt; structure after adding the logs emitted in the given block.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_index_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;container-types&quot;&gt;Container types&lt;&#x2F;h4&gt;
&lt;p&gt;These definitions use the &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; and &lt;code&gt;ProgressiveByteList&lt;&#x2F;code&gt; SSZ types as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;EIP-7916&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the &lt;code&gt;LogIndex&lt;&#x2F;code&gt; and &lt;code&gt;IndexEpoch&lt;&#x2F;code&gt; container definitions below are &quot;naive&quot; definitions suitable to define SSZ merkleization. The entire log index is typically too big to be represented in memory as a whole. A more efficient implementation can be found here: &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;.&#x2F;assets&#x2F;log_index.py&quot;&gt;log_index.py&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;.&#x2F;assets&#x2F;binary_tree.py&quot;&gt;binary_tree.py&lt;&#x2F;a&gt;  (taken from the EELS implementation). This code keeps only the currently processed parts of the tree in memory, expanding untouched empty subtrees on demand and collapsing finalized subtrees.&lt;&#x2F;p&gt;
&lt;p&gt;Also note that the containers defined here (including &lt;code&gt;FilterRow&lt;&#x2F;code&gt;) have a non-initialized default value, represented as a null leaf in the Merkle tree. Initialization of these containers is explicit and happens at a well defined point. &lt;code&gt;IndexEpoch&lt;&#x2F;code&gt; is initialized when the first &lt;em&gt;index entry&lt;&#x2F;em&gt; is added to the epoch. All rows of a map are initialized when the first &lt;em&gt;index entry&lt;&#x2F;em&gt; is added to the map. &lt;code&gt;IndexEntry&lt;&#x2F;code&gt; is initialized when added; entry positions belonging to unused &lt;em&gt;map entry indices&lt;&#x2F;em&gt; are left uninitialized. The &lt;code&gt;Log&lt;&#x2F;code&gt; container is only initialized in case of &lt;em&gt;log entries&lt;&#x2F;em&gt;. If it is initialized then &lt;code&gt;topics&lt;&#x2F;code&gt; and &lt;code&gt;data&lt;&#x2F;code&gt; lists in the &lt;code&gt;Log&lt;&#x2F;code&gt; container are always initialized.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class LogIndex(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    epochs: Vector[IndexEpoch, MAX_EPOCH_HISTORY]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class IndexEpoch(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    filter_maps: Vector[Vector[FilterRow, MAPS_PER_EPOCH], MAP_HEIGHT]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index_entries: Vector[IndexEntry, MAPS_PER_EPOCH * VALUES_PER_MAP]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type FilterRow = ProgressiveList[uint32]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class IndexEntry(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_entry: Log&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entry_meta: Vector[Bytes32, 4] # LogMeta &#x2F; TransactionMeta &#x2F; BlockMeta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class Log(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address: ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics: List[Bytes32, 4]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;entry_meta&lt;&#x2F;code&gt; vector has a fixed format but its interpretation depends on the type of &lt;em&gt;index entry&lt;&#x2F;em&gt; and the type of entry can also be determined based on its contents (and based on whether &lt;code&gt;log_entry&lt;&#x2F;code&gt; is initialized or not). Whenever &lt;code&gt;IndexEntry&lt;&#x2F;code&gt; is initialized, &lt;code&gt;entry_meta&lt;&#x2F;code&gt; contains either one of these containers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class LogMeta(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_number: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    log_in_tx_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class TransactionMeta(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_number: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transaction_index: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipt_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class BlockMeta(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_number: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_hash: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    zero: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;index-entry-types-and-corresponding-map-values&quot;&gt;Index entry types and corresponding map values&lt;&#x2F;h4&gt;
&lt;p&gt;Three types of &lt;em&gt;index entries&lt;&#x2F;em&gt; are added during state transition: log, transaction and block. For each processed transaction, a &lt;em&gt;transaction entry&lt;&#x2F;em&gt; is added first, then &lt;em&gt;log entries&lt;&#x2F;em&gt; are added in the order of EVM execution. The &lt;em&gt;block entry&lt;&#x2F;em&gt; referring to the processed block is not added during the state transition because it is supposed to reference the block hash which is not known yet. It can be added either after block building&#x2F;validaton or are the beginning of the next state transition. In either case, the &lt;code&gt;block entry&lt;&#x2F;code&gt; of block N first appears in the log index state of block N+1 as the first new &lt;code&gt;index entry&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The following table shows an example of mapping all index entry types onto the &lt;em&gt;map value index&lt;&#x2F;em&gt; space:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Index entry&lt;&#x2F;th&gt;&lt;th&gt;Map entry index&lt;&#x2F;th&gt;&lt;th&gt;Map values&lt;&#x2F;th&gt;&lt;th&gt;Map value indices&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Block #0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;Block&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tx    #1&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Transaction&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;0&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Addr, 3x Topic&lt;&#x2F;td&gt;&lt;td&gt;2, 3, 4, 5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;0&#x2F;1&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;Addr, 3x Topic&lt;&#x2F;td&gt;&lt;td&gt;6, 7, 8, 9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tx    #1&#x2F;1&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;Transaction&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;1&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;11&lt;&#x2F;td&gt;&lt;td&gt;Addr, 2x Topic&lt;&#x2F;td&gt;&lt;td&gt;11, 12, 13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;1&#x2F;1&lt;&#x2F;td&gt;&lt;td&gt;14&lt;&#x2F;td&gt;&lt;td&gt;Addr, Topic&lt;&#x2F;td&gt;&lt;td&gt;14, 15&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #1&#x2F;1&#x2F;2&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;Addr, 2x Topic&lt;&#x2F;td&gt;&lt;td&gt;16, 17, 18&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Block #1&lt;&#x2F;td&gt;&lt;td&gt;19&lt;&#x2F;td&gt;&lt;td&gt;Block&lt;&#x2F;td&gt;&lt;td&gt;19&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Tx    #2&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;td&gt;Transaction&lt;&#x2F;td&gt;&lt;td&gt;20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Log   #2&#x2F;0&#x2F;0&lt;&#x2F;td&gt;&lt;td&gt;21&lt;&#x2F;td&gt;&lt;td&gt;Addr, 4x Topic&lt;&#x2F;td&gt;&lt;td&gt;21, 22, 23, 24, 25&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that the missing &lt;em&gt;map entry indices&lt;&#x2F;em&gt; are represented in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree with uninitialized &lt;code&gt;IndexEntry&lt;&#x2F;code&gt; containers (zero value leaves in the &lt;code&gt;index_entries&lt;&#x2F;code&gt; vector). Most of these empty entries correspond to the &lt;em&gt;topic value&lt;&#x2F;em&gt; indices. Also, the last few entries of each map might be emtpy because the &lt;em&gt;map values&lt;&#x2F;em&gt; generated by a single &lt;em&gt;index entry&lt;&#x2F;em&gt; never cross a filter map boundary. So, for example, when &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; is 0x10000 and &lt;code&gt;next_index&lt;&#x2F;code&gt; is &lt;code&gt;0x2FFFE&lt;&#x2F;code&gt; and a &lt;em&gt;log entry&lt;&#x2F;em&gt; with on address and two topics is added, the last two positions of the map are left empty and the new &lt;em&gt;log entry&lt;&#x2F;em&gt; is added starting from position 0x30000.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;filter-map-row-encoding&quot;&gt;Filter map row encoding&lt;&#x2F;h4&gt;
&lt;p&gt;Each row of the &lt;em&gt;filter map&lt;&#x2F;em&gt; is encoded as a series of little endian binary encoded column indices. For encoding simplicity the column indices are always encoded as 32 bit values, regardless of the fact that &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; is less than 32. This only applies to consensus encoding and hashing though while local storage and proof encoding can use a more tightly packed format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;proposed-constants&quot;&gt;Proposed constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;MAP_WIDTH&lt;&#x2F;td&gt;&lt;td&gt;2**24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAP_HEIGHT&lt;&#x2F;td&gt;&lt;td&gt;2**16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;VALUES_PER_MAP&lt;&#x2F;td&gt;&lt;td&gt;2**16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAPS_PER_EPOCH&lt;&#x2F;td&gt;&lt;td&gt;2**10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAX_EPOCH_HISTORY&lt;&#x2F;td&gt;&lt;td&gt;2**24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAX_ROW_LENGTH&lt;&#x2F;td&gt;&lt;td&gt;[8, 168, 2728, 10920]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAPPING_FREQUENCY&lt;&#x2F;td&gt;&lt;td&gt;[2**10, 2**6, 2**2, 1]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Note that &lt;code&gt;MAX_ROW_LENGTH&lt;&#x2F;code&gt; and &lt;code&gt;MAPPING_FREQUENCY&lt;&#x2F;code&gt; parameters are specified as lists because the applicable values depend on the used &lt;em&gt;mapping layer&lt;&#x2F;em&gt;. For layers higher than the index of the last elements of these lists the last element is applicable. Also note that the &lt;code&gt;MAX_ROW_LENGTH&lt;&#x2F;code&gt; values correspond to the cumulative capacity of &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; tree levels; a layer 0 row fits into the first level, a layer 1 row fits into the first three levels and so on.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constructing-the-filter-map&quot;&gt;Constructing the filter map&lt;&#x2F;h3&gt;
&lt;p&gt;For each &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt; long section of the &lt;em&gt;map value index&lt;&#x2F;em&gt; space a &lt;em&gt;filter map&lt;&#x2F;em&gt; is generated. These are fixed size &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; by &lt;code&gt;MAP_HEIGHT&lt;&#x2F;code&gt; sparse bit maps and each &lt;em&gt;map value&lt;&#x2F;em&gt; is marked on the map with a single bit being set to one. The number of marks in a row (the length of the sparse encoded row) is referred to as &quot;row length&quot;, not to be confused with the constant &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;epochs-and-mapping-layers&quot;&gt;Epochs and mapping layers&lt;&#x2F;h4&gt;
&lt;p&gt;In order to allow efficient search of a certain &lt;em&gt;map value&lt;&#x2F;em&gt; in a long historical range, &lt;em&gt;filter maps&lt;&#x2F;em&gt; are organized into &lt;em&gt;index epochs&lt;&#x2F;em&gt;, each consisting of a fixed &lt;code&gt;MAPS_PER_EPOCH&lt;&#x2F;code&gt; number of maps. In the most usual case (when row density is around average or below) row mapping stays the same  during an entire epoch. The hash tree is organized in a way that instead of putting all rows of a single map close to each other, rows of the same &lt;em&gt;row index&lt;&#x2F;em&gt; throughout an entire epoch are close to each other and therefore are cheap to access and&#x2F;or prove with a Merkle proof.&lt;&#x2F;p&gt;
&lt;p&gt;In order to mitigate collisions in densely populated rows, the concept of &lt;em&gt;mapping layers&lt;&#x2F;em&gt; is introduced, meaning that if a certain row already has a certain number of entries then the row mapping is changed and very frequent &lt;em&gt;map values&lt;&#x2F;em&gt; are mapped into multiple rows. Initially, when a map is empty, every &lt;em&gt;map value&lt;&#x2F;em&gt; is mapped using &lt;em&gt;mapping layer&lt;&#x2F;em&gt; 0 or the &quot;base layer&quot;. If a row reaches &lt;code&gt;MAX_ROW_LENGTH[0]&lt;&#x2F;code&gt; then any further &lt;em&gt;map values&lt;&#x2F;em&gt; mapped onto that row in the base layer mapping will use layer 1 mapping instead. On layer 1 a different row is assigned to the same &lt;em&gt;map value&lt;&#x2F;em&gt; and the row length limit in increased to &lt;code&gt;MAX_ROW_LENGTH[1]&lt;&#x2F;code&gt;. If this row also reaches its limit, layer 2 mapping is used and so on. Note that a row filled at a certain &lt;em&gt;mapping layer&lt;&#x2F;em&gt; can be grown further on a higher layer. Different &lt;em&gt;map values&lt;&#x2F;em&gt; colliding in the same row on a certain layer are probably mapped in different rows on the next layer, which means that a very popular value might populate multiple rows (also very long ones) but an unlucky less popular one colliding with it on base layer will probably just have to move one layer up. The search process is similar, if the searcher finds that the row belonging to the searched value is full according to the base layer limit then it also has to check the next layer and so on, until it finds a non-full row.&lt;&#x2F;p&gt;
&lt;p&gt;If a row is longer than the limit according to the layer the searcher is looking at then it can safely ignore the extra entries assuming that they were added by another value on a higher layer. The &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; container makes it efficient to prove row data belonging to the lower layer even if there is much more data in the same row added on a higher layer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;row-mapping&quot;&gt;Row mapping&lt;&#x2F;h4&gt;
&lt;p&gt;While base layer row mapping stays the same for an entire epoch, higher layer mappings are changed more frequently. Each mapping change has a cost in terms of database access overhead and Merkle proof size overhead and epoch size is determined in a way that these overheads stay sufficiently low compared to the cost of accessing the actual useful data. On higher layers where the rows are longer, a more frequent remapping is possible because the useful data size per map is also higher. It is also desirable so that a less frequent &lt;em&gt;map value&lt;&#x2F;em&gt; will only suffer from colliding with a more popular one for a shorter time.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;row index&lt;&#x2F;em&gt; is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_row_index(map_index, layer_index: Uint, map_value_hash: Hash32) -&amp;gt; Uint:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Returns the row index where the given map value hash is mapped on the given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    map and mapping layer.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mf_index = min(layer_index, len(MAPPING_FREQUENCY) - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mapping_frequency = MAPPING_FREQUENCY[mf_index]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    masked_map_index = map_index - (map_index % mapping_frequency)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    row_hash = sha256(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        map_value_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        + masked_map_index.to_le_bytes4()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        + layer_index.to_le_bytes4()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ).digest()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return Uint.from_le_bytes(row_hash[0:4]) % MAP_HEIGHT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following figure shows how &lt;em&gt;map values&lt;&#x2F;em&gt; are mapped to rows on different &lt;em&gt;mapping layers&lt;&#x2F;em&gt;. Each dot represents a map row and the numbers indicate the &lt;em&gt;mapping layer&lt;&#x2F;em&gt; on which the row has been assigned to the given &lt;em&gt;map value&lt;&#x2F;em&gt;. Note that it might happen that a higher layer mapping coincides with a lower layer mapping for the same value; this does not cause any problem though as the row is simply grown further on the higher layer. The search algorithm can also simply revisit the same row in a higher layer iteration if necessary and process the rest of the row that it first ignored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;map index        111111 1111222222222233 3333333344444444 4455555555556666&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       0123456789012345 6789012345678901 2345678901234567 8901234567890123&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +----------------+----------------+----------------+----------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 0 |2........2......|2...............|...2............|........2.......|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 1 |........1111.2..|.....2..1111....|1111.....2...2..|2111..2......2..|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 2 |0000000000000000|.2..2....2..2...|....2111....2...|..2.....11112...|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 3 |....2..22...1111|..........2.1111|2.......2.2.1111|.......2...2....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 4 |.2..1111..2....2|1112..2.2....2..|0000000011110020|...21111.2....2.|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 5 |...2........2...|...............2|.2...2.........2|.2...2..........|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 6 |1111.22....2..2.|0020000000020000|.......2...2....|..........2.1112|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 7 |..2.............|....1112......2.|..2...2.........|0000200000000000|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +----------------+----------------+----------------+----------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            epoch 0          epoch 1          epoch 2          epoch 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fig 2. Row mapping of a single log value on different mapping layers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAP_HEIGHT = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAPS_PER_EPOCH = 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAPPING_FREQUENCY = [16, 4, 1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;column-mapping&quot;&gt;Column mapping&lt;&#x2F;h4&gt;
&lt;p&gt;Column mapping assumes that &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt; is a multiple of &lt;code&gt;VALUES_PER_MAP&lt;&#x2F;code&gt;. &lt;em&gt;column index&lt;&#x2F;em&gt; is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_column_index(map_value_index: Uint, map_value_hash: Hash32) -&amp;gt; Uint:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Returns the column index where the given entry hash is mapped at the given&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    entry index.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    col_hash = fnv1a_64(map_value_index.to_le_bytes8() + map_value_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    folded_hash = (col_hash &amp;gt;&amp;gt; 32) ^ (col_hash &amp;amp; 0xFFFFFFFF)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hash_bits = LOG2_MAP_WIDTH - LOG2_VALUES_PER_MAP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (map_value_index % VALUES_PER_MAP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;lt;&amp;lt; hash_bits + folded_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;gt;&amp;gt; (32 - hash_bits)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As shown on the figure below, this mapping practically assigns a &lt;code&gt;MAP_WIDTH &#x2F;&#x2F; VALUES_PER_MAP&lt;&#x2F;code&gt; by &lt;code&gt;MAP_HEIGHT&lt;&#x2F;code&gt; rectangle to each &lt;em&gt;map value index&lt;&#x2F;em&gt; and ensures that each &lt;em&gt;map value&lt;&#x2F;em&gt; places exactly one mark in its own rectangle (the letters A-D represent different &lt;em&gt;map values&lt;&#x2F;em&gt;). This property also ensures that &lt;em&gt;map value index&lt;&#x2F;em&gt; can be restored from &lt;em&gt;map index&lt;&#x2F;em&gt; and &lt;em&gt;column index&lt;&#x2F;em&gt;, column indices never collide and keep the original order of &lt;em&gt;map value&lt;&#x2F;em&gt; indices, allowing efficient Merkle exclusion proofs of certain &lt;em&gt;column indices&lt;&#x2F;em&gt; in long rows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;column             11 1111 1111 2222 2222 2233&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       0123 4567 8901 2345 6789 0123 4567 8901&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +---------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 0 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 1 |.... .... .... .... .... .C.. .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 2 |.A.. .... ...A .... A... .... ...A ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 3 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 4 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 5 |.... .B.. .... ...B .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 6 |.... .... .... .... .... .... .... ..D.|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;row 7 |.... .... .... .... .... .... .... ....|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      +---------------------------------------+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fig 3. A single filter map with 8 entries of 4 different log values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAP_WIDTH = 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAP_HEIGHT = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VALUES_PER_MAP = 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;updating-the-log-index-and-calculating-the-root-hash&quot;&gt;Updating the log index and calculating the root hash&lt;&#x2F;h3&gt;
&lt;p&gt;See the following functions in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;.&#x2F;assets&#x2F;log_index.py&quot;&gt;log_index.py&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;log_index_add_log_entries&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;log_index_add_transaction_entry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;log_index_add_block_entry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;log_index_root&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the &lt;em&gt;block entry&lt;&#x2F;em&gt; may be added either after building&#x2F;verifying the given block or before processing the next one, but &lt;code&gt;log_index_root&lt;&#x2F;code&gt; should always be calculated after adding transaction and log entries and before adding the block entry for the some block (block building would not even be possible otherwise as the log index root is referenced in the block header).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;finding-potential-matches&quot;&gt;Finding potential matches&lt;&#x2F;h3&gt;
&lt;p&gt;Determining whether a &lt;em&gt;column index&lt;&#x2F;em&gt; found in the appropriate row is relevant for the searched &lt;em&gt;map value&lt;&#x2F;em&gt; is possible by restoring the &lt;em&gt;map value index&lt;&#x2F;em&gt; and then calculating the &lt;em&gt;column index&lt;&#x2F;em&gt; from it again in order to check whether the quasi-random collision filter part matches the expected value for the given &lt;em&gt;map value&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_map_value_index(map_index, column_index: Uint) -&amp;gt; Uint:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    map_value_width = MAP_WIDTH &#x2F;&#x2F; VALUES_PER_MAP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return map_index * VALUES_PER_MAP + column_index &#x2F;&#x2F; map_value_width&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def is_potential_match(map_index, column_index: Uint, map_value: Hash32) -&amp;gt; bool:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_column_index(get_map_value_index(map_index, column_index), map_value) == column_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Iterating through all relevant &lt;em&gt;mapping layers&lt;&#x2F;em&gt; and corresponding rows is similar to how new &lt;em&gt;map values&lt;&#x2F;em&gt; are added. Filtering all potential matches from all relevant rows can be done with the following function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_potential_matches((log_index: LogIndexReader, map_index: Uint, map_value: Hash) -&amp;gt; List[Uint]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    matches = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    layer_index = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    while True:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mr_index = min(layer_index, len(MAX_ROW_LENGTH) - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_row_length = MAX_ROW_LENGTH[mr_index]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        row_index = get_row_index(map_index, layer_index, map_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        row = get_filter_row(log_index, map_index, row_index)[:max_row_length]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for column_index in row:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if is_potential_match(map_index, column_index, log_value):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                matches.append(get_log_value_index(map_index, column_index))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if len(row) &amp;lt; max_row_length:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        layer_index += 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return matches&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;initialization-minimal-state-and-wire-protocol-extension&quot;&gt;Initialization, minimal state and wire protocol extension&lt;&#x2F;h3&gt;
&lt;p&gt;It is a property of the log index tree that over time most of the tree nodes get finalized, which means that in a minimal log index state representation finalized subtrees can be collapsed into a single tree node as their descendants are no longer needed for adding new entries. At every single moment there is one &lt;em&gt;filter map&lt;&#x2F;em&gt; being updated, maybe the few most recently completed maps might still be affected by a reorg, but if the chain finalizes properly then all but the few most recent maps are also finalized. Internal tree nodes with all finalized children are also finalized and can be collapsed into the lowest finalized ancestor. Similarly, internal nodes covering a range that has not been touched yet can be stored without having their children in memory, and they can be expanded on demand.&lt;&#x2F;p&gt;
&lt;p&gt;Certain types of clients (those only interested in validation and not in using&#x2F;serving log index data) have the option to just maintain this minimal log index state. Those who are interested in event history should probably also only keep the minimal state in memory and store the finalized and collapsed subtrees on disk. Clients can also initialize their log index with such a minimal state and then optionally regenerate the older parts from blocks and receipts locally. When the log index state of a finalized block is represented and no room for rollback is needed, the minimal tree representation simplifies into a set of Merkle branches leading to the map rows and to the &lt;em&gt;index entry&lt;&#x2F;em&gt; corresponding to &lt;code&gt;next_index&lt;&#x2F;code&gt; (with everything on the left side of these branches collapsed and nothing on their right sides expanded yet). Assuming an efficient encoding of the current &lt;code&gt;filter_map_rows&lt;&#x2F;code&gt; where the variable length of each filter row is encoded in two bytes and the column indices tightly packed into 3 bytes each, the minimal log index state can be serialized into 21300808 bytes. This number can be considered as an estimate of the amount of data required to initialize the log index data structure at any point.&lt;&#x2F;p&gt;
&lt;p&gt;Note that initialization is also possible on an epoch boundary, in which case the log index is very cheap to initialize (only requires the last &lt;em&gt;block entry&lt;&#x2F;em&gt; branch before the epoch boundary and the first one after) but in this case all blocks and receipts between the boundary and the current head are required to generate the last unfinished epoch. Epoch boundary initialization can also be used to index further historical epochs after the initialization of the head state.&lt;&#x2F;p&gt;
&lt;p&gt;Both head state initialization and epoch boundary initialization requires the extension of the Ethereum Wire Protocol through which clients can request Merkle multiproofs to initialize the required parts of the log index tree, using a recently finalized block as the starting point. Note that since the total amount of initialization data is too big to fit in a single devp2p response, the protocol splits the data into multiple subsets, each obtainable in the form of a separately verifiable log index Merkle proof. See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;assets&#x2F;wire_protocol_extension&#x2F;&quot;&gt;wire protocol extension&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7745&#x2F;assets&#x2F;log_index_proof_format&#x2F;&quot;&gt;log index proof format&lt;&#x2F;a&gt; specs for further details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;design-goals&quot;&gt;Design goals&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed data structure is intended to realize a balance between the cost of adding items and accessing old ones. In a search structure of a constantly growing dataset there is typically a tradeoff between the cost of adding new data and the cost of searcing the existing dataset. One extreme is just linearly storing the data, which is practically the case now with logs, with the bloom filters being mostly useless. The other extreme is one big Merkle tree with all &lt;em&gt;map values&lt;&#x2F;em&gt; ever used as keys and the list of all occurences (possibly in a further merkleized format) as values. With billions of unique &lt;em&gt;map values&lt;&#x2F;em&gt;, adding new entries here is expected to have costs similar to that of the state, with multiple lookups and modifications&#x2F;insertions at random places in a database on the order of magnitude of hundreds of gigabytes. Another issue where this is similar to the state is that removing old entries is hard and expensive. Adding logs is supposed to be cheaper than writing the state so solutions between these two extremes were considered as potentially practical, with multiple smaller structures generated periodically.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;filter maps&lt;&#x2F;em&gt; have a fixed tree size and an efficient tree hashing scheme. Filter entries are sorted into rows based on content and position in a way that allows quick linear database access and size efficient Merkle proofs. The difficulties arising from certain types of events being much more frequent than others are also mitigated. Update and maintenance costs are also limited as tree nodes are eventually finalized and the number of non-finalized non-empty nodes is always hard capped, ensuring moderate memory requirements. Initialization costs of the data structure at any point of the chain are also capped. Additional database storage costs of &lt;em&gt;filter maps&lt;&#x2F;em&gt; is about 15-20% of the size of the actual logs, depending on certain implementation tradeoffs. The Merkle tree structure also makes it easy to discard entire epochs along with the corresponding Merkle subtrees, making the implementation of history expiry of the log index simple.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;map-value-index-space&quot;&gt;Map value index space&lt;&#x2F;h3&gt;
&lt;p&gt;In each block a varying number of &lt;em&gt;map values&lt;&#x2F;em&gt; are emitted. In addition to inefficient search, another drawback of per-block fixed size bloom filters is the varying filter utilization leading to over-utilized filters giving many false positives in some blocks and&#x2F;or wastefully under-utilized filters in some blocks. Block gas limits also tend to change significantly over the long term so any future-proof solution has to be able to adapt to the varying number of &lt;em&gt;map values&lt;&#x2F;em&gt; per block.&lt;&#x2F;p&gt;
&lt;p&gt;Mapping &lt;em&gt;map values&lt;&#x2F;em&gt; on their own linear index space ensures uniform filter utilization of identically structured &lt;em&gt;filter maps&lt;&#x2F;em&gt;. Compared to the alternative of constantly changing adaptive filter size, this approach greatly improves the efficiency of database access and Merkle proofs. It also allows efficient search pattern filtering as each potential match provides exact position information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;index-entries-tree&quot;&gt;Index entries tree&lt;&#x2F;h3&gt;
&lt;p&gt;Hashing every event into the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree keyed by &lt;em&gt;map entry index&lt;&#x2F;em&gt; is additional work and complexity but it simplifies the proving process significantly. Proving the events based only on &lt;em&gt;map value indices&lt;&#x2F;em&gt; would be possible if receipts had a &lt;em&gt;map value index&lt;&#x2F;em&gt; pointer hashed into them (so the client could also verify that the received receipt actually covers the &lt;em&gt;map value index&lt;&#x2F;em&gt; derived from the &lt;em&gt;filter map&lt;&#x2F;em&gt;; in this case though an extra mechanism would be necessary to prove that the receipt is referenced in a block that is part of the same canonical chain where the log index root was referenced. Proving old canonical blocks is currently theoretically possible through the beacon chain but painful and also would require extra infrastructure. On the other hand, the &lt;code&gt;index_entries&lt;&#x2F;code&gt; tree not only solves the problem of proving the matching canonical receipts, with the &lt;em&gt;block entries&lt;&#x2F;em&gt; it also provides a convenient way to prove canonical EL blocks through EL data structures only, and even provides provable canonical block hash to block number lookups.&lt;&#x2F;p&gt;
&lt;p&gt;Note though that storing the entire&lt;code&gt;index_entries&lt;&#x2F;code&gt; trees directly in their proposed merkleized format on disk is not really efficient. This is not an issue for validators that want to maintain a minimal state; for them, updating the &lt;code&gt;index_entries&lt;&#x2F;code&gt; subtrees is really cheap as they only need to maintain a single Merkle branch pointing to the next &lt;em&gt;map value index&lt;&#x2F;em&gt;. Provers can implement &lt;code&gt;index_entries&lt;&#x2F;code&gt; efficiently by storing a subset of the Merkle tree nodes (the ones at least a few levels below leaf level in order to save space) and generate the rest on demand based on the receipts that encode the same data in a more compact form.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-filter-structures-considered&quot;&gt;Alternative filter structures considered&lt;&#x2F;h3&gt;
&lt;p&gt;One question considered was whether to periodically build lookup trees of events with each unique &lt;em&gt;map value&lt;&#x2F;em&gt; emitted in a given period being a separate key under which only the occurences of that specific event are listed, or to use a more compressed fixed size tree format where different &lt;em&gt;map values&lt;&#x2F;em&gt; might collide (though preferably not too many of them). This decision mostly boiled down to data access efficiency, both in terms of local disk access and remote Merkle proof size. Identically structured trees can be efficiently arranged in larger units (called &lt;em&gt;index epochs&lt;&#x2F;em&gt; here), with values belonging to the same key in subsequent trees of an epoch located close to each other. This improves database access speed. It also allows smaller Merkle proofs with a series of leaves encoded together in an efficient format and internal nodes on only two boundary branches. Database writes are also efficient as the order of adding tree entries is not random and all the non-finalized parts of the tree can be kept in memory with a hard capped memory requirement.&lt;&#x2F;p&gt;
&lt;p&gt;The other design decision considered here was whether to hash entire index entries into the list of &lt;em&gt;map value&lt;&#x2F;em&gt; occurences or just store position info and have a separate tree of log entries. Though the separate &lt;code&gt;filter_maps&lt;&#x2F;code&gt; and &lt;code&gt;index_entries&lt;&#x2F;code&gt; structures do present some additional complexity, the second option was chosen because of the size of Merkle proofs. Looking up a rarely used &lt;em&gt;map value&lt;&#x2F;em&gt; means encountering more irrelevant entries than relevant ones. By adding probabilistic filter information to position information, the vast majority of the irrelevant entries can be filtered out after accessing&#x2F;proving 3 bytes of data instead of an entire &lt;em&gt;map value&lt;&#x2F;em&gt; (32 bytes). When proving matches of multiple &lt;em&gt;map value&lt;&#x2F;em&gt; patterns this 10x advantage exists even with more frequent individual lookup values. Tests have shown that realistic log searches often yield a lot more matches for the individual &lt;em&gt;map values&lt;&#x2F;em&gt; themselves that the pattern itself. Pattern matching can be performed on the position information of individual potential matches and actual &lt;em&gt;index entries&lt;&#x2F;em&gt; only need to be proven at the potential pattern matches.&lt;&#x2F;p&gt;
&lt;p&gt;In conclusion, for the given application the fixed tree size approach with separate position info plus probabilistic collision filter approach seemed to be the most appropriate.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;false-positive-rate&quot;&gt;False positive rate&lt;&#x2F;h3&gt;
&lt;p&gt;From the &lt;em&gt;filter maps&lt;&#x2F;em&gt; a set of potential matches can be derived for any block range and &lt;em&gt;map value&lt;&#x2F;em&gt; or pattern of &lt;em&gt;map values&lt;&#x2F;em&gt;. These matches can then be looked up in the corresponding &lt;code&gt;index_entries&lt;&#x2F;code&gt; trees and actually matching events can be added to the set of results. The design guarantees that the set of potential matches includes all actual matches but and also has a consistently low false positive rate.&lt;&#x2F;p&gt;
&lt;p&gt;False positives can happen when the quasi-random collision filter part of a &lt;em&gt;column index&lt;&#x2F;em&gt; accidentally matches the expected value even though it was generated by a &lt;em&gt;map value&lt;&#x2F;em&gt; other than the searched one. The chance of this happening is &lt;code&gt;VALUES_PER_MAP &#x2F; MAP_WIDTH&lt;&#x2F;code&gt; per colliding enrty in a row that is relevant for the search. Assuming that most entries in a map are different from the searched one, assuming uniform random distribution of entries, the average number of colliding entries found in a relevant row is &lt;code&gt;VALUES_PER_MAP &#x2F; MAP_HEIGHT&lt;&#x2F;code&gt; giving an average false positive rate of &lt;code&gt;VALUES_PER_MAP ** 2 &#x2F; MAP_WIDTH &#x2F; MAP_HEIGHT&lt;&#x2F;code&gt; per &lt;em&gt;filter map&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Though certain &lt;em&gt;map values&lt;&#x2F;em&gt; might be emitted a lot more than others and therefore the &lt;em&gt;row index&lt;&#x2F;em&gt; distribution might not be entirely uniform, periodical remapping of rows and using multiple &lt;em&gt;mapping layers&lt;&#x2F;em&gt; ensures that over a long enough search period random collisions with more frequent &lt;em&gt;map values&lt;&#x2F;em&gt; do even out. &lt;em&gt;Mapping layers&lt;&#x2F;em&gt; do have another consequence though; if any row has at least &lt;code&gt;MAX_ROW_LENGTH[0]&lt;&#x2F;code&gt; entries then the search logic requires looking into another row that is mapped to the searched &lt;em&gt;map value&lt;&#x2F;em&gt; on the next &lt;em&gt;mapping layer&lt;&#x2F;em&gt;. The maximum possible number of such rows is &lt;code&gt;VALUES_PER_MAP &#x2F; MAX_ROW_LENGTH[0]&lt;&#x2F;code&gt; and therefore the chance of randomly hitting one is &lt;code&gt;VALUES_PER_MAP &#x2F; MAX_ROW_LENGTH[0] &#x2F; MAP_HEIGHT&lt;&#x2F;code&gt; in the worst case. In this case an extra row has to be processed, with extra chance of finding false positives. A collision with a frequent value at a certain &lt;em&gt;mapping layer&lt;&#x2F;em&gt; does not indicate a collision on the next layer though, therefore the expected number of entries in that row is no different from the first one. Having to process a third row would presume that the second one had at least &lt;code&gt;MAX_ROW_LENGTH[1]&lt;&#x2F;code&gt; entries. The chance of this happening after the first coincidence is practically negligible in the context of expected false positives.&lt;&#x2F;p&gt;
&lt;p&gt;The expected number of false positives for a single &lt;em&gt;map value&lt;&#x2F;em&gt; search can be estimated as &lt;code&gt;VALUES_PER_MAP ** 2 &#x2F; MAP_WIDTH &#x2F; MAP_HEIGHT * (1 + VALUES_PER_MAP &#x2F; MAX_ROW_LENGTH[0] &#x2F; MAP_HEIGHT)&lt;&#x2F;code&gt; per &lt;em&gt;filter map&lt;&#x2F;em&gt;. With the proposed constants this roughly equals 0.0044 false positives per map. As of March 2025 the average number of &lt;em&gt;map values&lt;&#x2F;em&gt; emitted in a mainnet block is slightly over 1000 while a &lt;em&gt;filter map&lt;&#x2F;em&gt; consists of 65536 &lt;em&gt;map values&lt;&#x2F;em&gt;. This gives a rough estimate of one false positive per 14000 blocks, which costs the searcher an extra lookup in a &lt;code&gt;log_entries&lt;&#x2F;code&gt; tree. The expected number of false positives in the entire chain history is around 1200.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this is only true for a single value search while a typical pattern search requiring certain values on multiple positions has an exponentially lower false positive rate. For example if the pattern is [Addr, Topic1, Topic2] then three &lt;em&gt;map value&lt;&#x2F;em&gt; searches are performed and an actual log lookup is only necessary if the first search yields &lt;code&gt;N&lt;&#x2F;code&gt;, the second &lt;code&gt;N+1&lt;&#x2F;code&gt; and the third &lt;code&gt;N+2&lt;&#x2F;code&gt; simultaneously. If necessary, the rate can be easily reduced by using a higher &lt;code&gt;MAP_WIDTH&lt;&#x2F;code&gt;, at the cost of growing the size of encoded rows.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The existing log filter API (&lt;code&gt;eth_getLogs&lt;&#x2F;code&gt;, &lt;code&gt;eth_newFilter&lt;&#x2F;code&gt;, &lt;code&gt;eth_getFilterLogs&lt;&#x2F;code&gt;, &lt;code&gt;eth_getFilterChanges&lt;&#x2F;code&gt;) can be implemented with the new filter data structure. Applications relying on this API can operate without any change, benefiting from a higher search performance. Repricing the &lt;code&gt;LOG&lt;&#x2F;code&gt; opcode might be considered after performing benchmarks but the extra processing cost is not significant while the extra storage cost is around 15%. Other than that the EVM is not affected in any way as it only emits logs but does not directly access them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;safe-access-with-a-remote-prover&quot;&gt;Safe access with a remote prover&lt;&#x2F;h3&gt;
&lt;p&gt;In order to prove a complete set of matches matching a given search pattern in a given block range, the prover needs to&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;prove the &lt;em&gt;map value index&lt;&#x2F;em&gt; range that corresponds to the searched block number range by proving the &lt;em&gt;block entries&lt;&#x2F;em&gt; of &lt;code&gt;first_block - 1&lt;&#x2F;code&gt; and &lt;code&gt;last_block&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;prove the relevant rows of &lt;em&gt;filter maps&lt;&#x2F;em&gt; based on &lt;em&gt;map index&lt;&#x2F;em&gt; and &lt;em&gt;row index&lt;&#x2F;em&gt; (verifier can determine the relevant rows in advance based on the &lt;em&gt;map values&lt;&#x2F;em&gt; in the search pattern and the relevant &lt;em&gt;map value index&lt;&#x2F;em&gt; range)&lt;&#x2F;li&gt;
&lt;li&gt;prove the actual &lt;em&gt;index entry&lt;&#x2F;em&gt; belonging to any potentially matching &lt;em&gt;map value index&lt;&#x2F;em&gt; and also the &lt;em&gt;block entry&lt;&#x2F;em&gt; with the same block number if the &lt;code&gt;blockHash&lt;&#x2F;code&gt; of the log position info is needed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since all three steps can be realized with Merkle proofs of the same &lt;code&gt;LogIndex&lt;&#x2F;code&gt; structure referenced in the block headers, any search with a remove prover is as safe as the client&#x27;s knowledge about the chain head.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deliberate-false-positive-attacks&quot;&gt;Deliberate false positive attacks&lt;&#x2F;h3&gt;
&lt;p&gt;The design guarantees that false positive rates do even out statistically over several epochs, even in case of random collisions with very frequent values, ensuring that an excessive amount false positives will not make the bandwidth and processing costs of the search prohibitively high. All of this is true for random collisions only though, not deliberately created collisions. A deliberate attack on a certain important &lt;em&gt;map value&lt;&#x2F;em&gt; in order to raise its false positive rate can not be ruled out entirely since with a low amount of filter data generated per &lt;em&gt;map value&lt;&#x2F;em&gt; it is always possible to &quot;mine&quot; another value that generates colliding filter data. The column mapping used here makes this attack a lot harder though, since the &lt;em&gt;column index&lt;&#x2F;em&gt; depends on both the &lt;em&gt;map value&lt;&#x2F;em&gt; and the exact &lt;em&gt;map value index&lt;&#x2F;em&gt;, making this attack only possible for block builders who are probably offered MEV rewards for much more lucrative manipulations of the transaction set than making the search of certain events slightly more expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uncouple blob count between CL and EL</title>
        <published>2024-07-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7742/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7742-uncouple-blob-count-between-cl-and-el/20550" />
        

        <id>https://wg-eips.ritovision.com/7742/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7742"
            label="EIP-7742" />
        

        
        

        
        <summary type="html">Have CL verify blob maximum and have EL get target value from CL</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7742/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Update blob maximum and target verification from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The execution layer no longer verifies the blob maximum and receives the target dynamically from the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Following EIP-4844, the execution layer (EL) maintains a hard-coded blob target value and blob maximum value. Given the relationship
of the EL and the consensus layer (CL) node software, the verification of the blob maximum is redundant so it can be removed
entirely without any change in security. The blob maximum is still provided during block construction via the Engine API.
This EIP also changes how the EL sources the current blob target value for two reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Gain more flexibility over the value, rather than the static &lt;code&gt;TARGET == MAX &#x2F;&#x2F; 2&lt;&#x2F;code&gt; relation in EIP-4844.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Uncouple development and deployment of the CL and EL layers in the event it is desirable to change the blob target value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;The data facility introduced via EIP-4844 adds blobs to Ethereum blocks, which are simply fixed sets of data that can be
included in the canonical chain but have no execution semantics (cf. &lt;code&gt;calldata&lt;&#x2F;code&gt; in an Ethereum transaction).&lt;&#x2F;p&gt;
&lt;p&gt;The protocol specifies a maximum allowed blob count per block to prevent DoS vectors via the abuse of this data facility.
The protocol also maintains an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;-like &quot;target&quot; value for an intended running average amount of blob throughput per
unit time. Blob usage is compared against this target to influence a &quot;blob base fee&quot; to administer allocation of this
resource to users of the Ethereum protocol.&lt;&#x2F;p&gt;
&lt;p&gt;Both of these values are currently hard-coded in the EL after EIP-4844 and the blob maximum is separately hard-coded in
the CL following EIP-4844. This EIP proposes a set of changes to uncouple these values across the CL and EL to make development
and deployment of changes to the blob count easier.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;maximum-blobs-per-block&quot;&gt;Maximum blobs per block&lt;&#x2F;h4&gt;
&lt;p&gt;The blob maximum is verified in the CL node and the EL inherits this verification during the consistency check of the
versioned hashes corresponding to each blob as specified by the Engine API. Because of this, the strict check specified
by EIP-4844 is unnecessary.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;target-amount-of-blobs-per-block&quot;&gt;Target amount of blobs per block&lt;&#x2F;h4&gt;
&lt;p&gt;The target is currently specified as a fixed value in relation to the blob count. The Ethereum community intends to increase
the blob parameters as part of its scaling strategy and the ability to have a more flexible target value in relation to
the blob max is desirable to reduce rigidity in this protocol parameter.&lt;&#x2F;p&gt;
&lt;p&gt;Even if the EL keeps a fixed target value based on the max, removing the max implies the EL would not know what the target
value should be. To address this lack of information, this EIP proposes the CL sends the current target value to the EL
with each provided payload over the Engine API. The EL block header will also need to be extended with this target value
to preserve the security of optimistic sync.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;block-structure-and-validity&quot;&gt;Block structure and validity&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activation of this EIP, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; extend the header schema with an
additional 64-bit field: the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt;. This value is set to the current target blob count. The Engine API
is modified along with this EIP to provide the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt; with each payload and implementations can use this
value to correctly set the block header field.&lt;&#x2F;p&gt;
&lt;p&gt;Validity of the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt; is guaranteed from the consensus layer, much like how withdrawals are handled.&lt;&#x2F;p&gt;
&lt;p&gt;When verifying a block, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure the target blob count in the block header matches the one
provided by the consensus client.&lt;&#x2F;p&gt;
&lt;p&gt;For a genesis block with no existing parent, the value should be set according to the agreed specification for the
target blob count given by that genesis block&#x27;s protocol rule set.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h3&gt;
&lt;p&gt;Upon activating this EIP (i.e. before processing any transactions),
the verification of the blob maximum as given in EIP-4844 can be skipped. Concretely, this means any logic relating
to &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; as given in EIP-4844 can be deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; is updated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;target_blobs_per_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; target_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Otherwise, the specification of EIP-4844 is not changed. For example, blob base fee accounting and excess blob gas tracking occur in the exact same way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-construction&quot;&gt;Block construction&lt;&#x2F;h3&gt;
&lt;p&gt;The Engine API is extended to provide both the &lt;code&gt;target_blobs_per_block&lt;&#x2F;code&gt; and the &lt;code&gt;max_blobs_per_block&lt;&#x2F;code&gt; when the CL requests the EL to construct a payload for proposal.&lt;&#x2F;p&gt;
&lt;p&gt;These values should be used to ensure the correct number of blobs are included in any constructed payload, and to ensure that the blob base fee accounting is correctly computed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-have-the-cl-also-compute-the-blob-base-fee-and-remove-any-notion-of-blob-counts-from-el-processing&quot;&gt;Why not have the CL also compute the blob base fee and remove any notion of blob counts from EL processing?&lt;&#x2F;h3&gt;
&lt;p&gt;Hoisting the full computation into the CL is possible, but it does violate the separation of concerns between these two layers of the protocol stack.
The CL maintains a maximum value to address e.g. DoS risks, and the EL maintains knowledge of the target value to address fee accounting.
Putting the target computation in the CL violates the respective responsibilities of each layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Leaf-level state expiry in verkle trees</title>
        <published>2024-07-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Wei Han Ng</name><uri>https://github.com/weiihann</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7736/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7736-leaf-level-state-expiry-in-verkle-trees/20474" />
        

        <id>https://wg-eips.ritovision.com/7736/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7736"
            label="EIP-7736" />
        

        
        

        
        <summary type="html">Simple state expiry scheme in which only &quot;extension-and-suffix trees&quot; are expired.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7736/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds an &quot;update epoch&quot; to the verkle tree extension node. When it is time for an epoch to expire, the extension node and its suffix nodes can be deleted.&lt;&#x2F;p&gt;
&lt;p&gt;A new transaction type with a simple verkle proof pays for the costs of reactivating the extension and suffix nodes, and updating the epoch counter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Previous attempts at implementing state expiry have been stalled by the quickly-increasing complexity, require heavy change in the structure of ethereum (address space extension, oil, multiple trees, ...). This proposal is offering a simpler albeit non-exhaustive approach to state expiry: only removing the leaf nodes and leaving the rest of the tree intact. This removes the need for methods that would be detrimental to the user and developer experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIME&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fork activation time&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Duration of an epoch, in s&lt;&#x2F;td&gt;&lt;td&gt;15778800 (6 months)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INITIAL_EPOCH_COUNTER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The epoch that ends at timestamp &lt;code&gt;FORK_TIME&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NUM_ACTIVE_EPOCHS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of concurrently unexpired epochs&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RESURRECT_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Type ID for resurrection transactions&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;change-to-the-verkle-tree&quot;&gt;Change to the verkle tree&lt;&#x2F;h3&gt;
&lt;p&gt;Add an integral variable called &lt;code&gt;current_epoch&lt;&#x2F;code&gt;. It is initialized to &lt;code&gt;INITIAL_EPOCH_COUNTER&lt;&#x2F;code&gt; before the fork, and contains the current epoch number.&lt;&#x2F;p&gt;
&lt;p&gt;Add a new &lt;code&gt;last_epoch&lt;&#x2F;code&gt; field to the extension node:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extension_and_suffix_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes31&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; last_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_leaves&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; suffix&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;items&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; suffix&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; suffix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_commitment_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_commitment_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sub_leaves&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; compute_commitment_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Extension marker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;                                    int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;C1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;C2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    last_epoch&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Added in this EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 251&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The following rules are added to tree update operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For a read or write event to the tree, check that &lt;code&gt;current_epoch &amp;lt; last_epoch + NUM_ACTIVE_EPOCHS&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;If this is &lt;code&gt;true&lt;&#x2F;code&gt;, proceed with the write&#x2F;read&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;last_epoch&lt;&#x2F;code&gt; is updated with the value of &lt;code&gt;current_epoch&lt;&#x2F;code&gt; each time that a &lt;em&gt;write&lt;&#x2F;em&gt; event is processed for this extension node.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;expiry&quot;&gt;Expiry&lt;&#x2F;h3&gt;
&lt;p&gt;At the start of block processing, before transactions are executed, run &lt;code&gt;check_epoch_end&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check_epoch_end&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCH_LENGTH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        schedule_expiry&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NUM_ACTIVE_EPOCHS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It is left to client implementers to decide on the behavior of the &lt;code&gt;schedule_expiry&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;p&gt;Data that needs to be kept for the expiry:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;stem&lt;&#x2F;code&gt; value, so that siblings can be inserted&lt;&#x2F;li&gt;
&lt;li&gt;The commitment &lt;code&gt;C&lt;&#x2F;code&gt; to the node&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That data is referred to as the &lt;em&gt;keepsake&lt;&#x2F;em&gt; for this extension-and-suffix node.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: that actual deletion may not happen before the first block in the epoch has finalized, unless there is a way for the client to recover the block in case of a reorg.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resurrection&quot;&gt;Resurrection&lt;&#x2F;h3&gt;
&lt;p&gt;The resurrection transaction is defined as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RESURRECT_TX_TYPE|ssz(Vector[stem,last_epoch,values])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;stem&lt;&#x2F;code&gt; is used to find the location in the tree, so that the node can be recreated;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;last_epoch&lt;&#x2F;code&gt; and &lt;code&gt;values&lt;&#x2F;code&gt; are the items that were deleted;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At the start of the validation, charge the costs using constants defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resurrect_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITNESS_BRANCH_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;            SUBTREE_EDIT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITNESS_CHUNK_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHUNK_EDIT_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CHUNK_FILL_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Once the gas cost has been paid, the validation process begins:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_subtrees&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The tx is a SSZ payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subtrees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deserialize_ssz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; subtrees&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Process all subtrees in the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; subtrees&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ok&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; validate_subtree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; subtree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; ok&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_subtree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; last_epoch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compute the commitment to the expired&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; tree, get the &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expired_C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extension_and_suffix_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; last_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expired&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_keepsake&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; keepsake&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; expired_C&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Replace the keepsake with the resurrected&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; extension-and-suffix tree.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; extension_and_suffix_tree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;resurrect_subtree&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stem&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_C&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; values&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; current_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;resurrect_subtree&lt;&#x2F;code&gt; will return &lt;code&gt;None&lt;&#x2F;code&gt; upon success, and an error otherwise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This approach has the benefit of simplicity, over previous proposals for state expiry:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;no Address Space Extension (ASE) required&lt;&#x2F;li&gt;
&lt;li&gt;it only uses a single tree instead of multiple, per-epoch trees&lt;&#x2F;li&gt;
&lt;li&gt;smaller resurrection proofs, as only providing the data is necessary to resurrect.&lt;&#x2F;li&gt;
&lt;li&gt;clear gas costs&lt;&#x2F;li&gt;
&lt;li&gt;only expire &quot;cold&quot; data, the &quot;hot&quot; data set remains active&lt;&#x2F;li&gt;
&lt;li&gt;it is forward-compatible, as ASE or multiple trees are still possible.&lt;&#x2F;li&gt;
&lt;li&gt;the exponentiation&#x2F;addition computation for &lt;code&gt;current_epoch&lt;&#x2F;code&gt; need only be paid once per epoch, which is quickly amortized.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;While it&#x27;s not deleting &lt;em&gt;all&lt;&#x2F;em&gt; the data, it deletes &lt;em&gt;most&lt;&#x2F;em&gt; of it, namely the values and subcommitments, while retaining the ability to easily insert siblings.&lt;&#x2F;p&gt;
&lt;p&gt;It is also more expensive than resurrecting a single leaf, which is the cost paid for simplification.&lt;&#x2F;p&gt;
&lt;p&gt;The reason why only writes update the resurrection counter, is that any update to the resurrection counter has the effect of a write. Doing so would mean either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increasing the cost of a read to that of a write. This would increase the gas costs even more than they did in EIP-4762.&lt;&#x2F;li&gt;
&lt;li&gt;Effectively doing a write for the cost of a read. This would both neuter state expiry and possibly add a DOS vector.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is backwards-compatible with verkle, as by default the value for the 4th (index starting at 0) evaluation point is set to &lt;code&gt;0&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt;, which is the value of &lt;code&gt;INITIAL_EPOCH_COUNTER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Enshrined Proposer-Builder Separation</title>
        <published>2024-06-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Francesco D&#x27;Amato</name><email>francesco.damato@ethereum.org</email>
	</author>
	
	<author>
		<name>Barnabé Monnot</name><email>barnabe.monnot@ethereum.org</email>
	</author>
	
	<author>
		<name>Michael Neuder</name><email>michael.neuder@ethereum.org</email>
	</author>
	
	<author>
		<name>Potuz</name><uri>https://github.com/potuz</uri>
	</author>
	
	<author>
		<name>Justin Traglia</name><email>jtraglia@ethereum.org</email>
	</author>
	
	<author>
		<name>Terence Tsao</name><email>ttsao@offchainlabs.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7732/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7732-enshrined-proposer-builder-separation-epbs/19634" />
        

        <id>https://wg-eips.ritovision.com/7732/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7732"
            label="EIP-7732" />
        

        
        

        
        <summary type="html">Separates the ethereum block in consensus and execution parts, adds a mechanism for the consensus proposer to choose the execution proposer.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7732/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP fundamentally changes the way an Ethereum block is validated by decoupling the execution validation from the consensus validation both logically as well as temporally. It does so by introducing a new in-protocol entity called &lt;em&gt;builders&lt;&#x2F;em&gt; and adding a new duty (submitting &lt;em&gt;payload timeliness attestations&lt;&#x2F;em&gt;) to Ethereum validators. The &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; field of the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; is removed and instead it is replaced by a signed commitment (a &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; object) from a builder to later reveal the corresponding execution payload. This commitment specifies in particular the blockhash of the execution block and a &lt;em&gt;value&lt;&#x2F;em&gt; to be paid to the beacon block proposer. When processing the &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt;, the committed value is deducted from the builder&#x27;s beacon chain balance and later a withdrawal is placed to an address, of the proposer&#x27;s choosing, in the execution layer. A subset of validators in the beacon committee is assigned to the &lt;em&gt;Payload Timeliness Committee&lt;&#x2F;em&gt; (PTC), these validators are tasked to attest (by broadcasting a &lt;code&gt;PayloadAttestationMessage&lt;&#x2F;code&gt;) to whether the corresponding builder has revealed the committed execution payload (with the right blockhash) in a timely fashion and whether the correspoding blob data was available according to their view. PTC members are not required to validate the execution payload, execution validation is thus deferred until the next beacon block validation. While builder&#x27;s are staked entities, their stake is not actively validating the beacon chain, they are not subject to the usual deposit and exit churn&#x2F;queues and can be staked for as little as 1ETH. While the in-protocol payment via withdrawals is trustlessly deducted from this stake, the protocol also accomodates for trusted payments in the form of &lt;em&gt;promises&lt;&#x2F;em&gt; to be fulfiled elsewhere.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP solves a different set of unrelated important problems.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An overwhelming majority of beacon block proposers outsource the construction of the execution payload within their blocks to a third party (henceforth called a &lt;em&gt;builder&lt;&#x2F;em&gt;). In order to do so, they request the hash tree root (HTR) of a promised execution payload and submit a &lt;code&gt;SignedBlindedBeaconBlock&lt;&#x2F;code&gt; to a trusted party that is tasked with replacing the HTR with the full execution payload (received from the builder) before broadcasting. This EIP allows for a trust-free fair exchange between the beacon block proposer and the builder, guaranteeing that an honest beacon block proposer will receive payment from the builder regardless of the latter&#x27;s actions and that the honest builder&#x27;s payload will be the canonical head of the chain regardless of the proposer&#x27;s action.&lt;&#x2F;li&gt;
&lt;li&gt;Currently, validators have the time between receiving the full beacon block (including an execution payload) and the attesting deadline (4 seconds in Ethereum mainnet) to perform both consensus and execution state transition functions, check blob data availability and evaluate the new head of the blockchain. The remainder of the slot time is spent doing less CPU-intense and critical task. By separating the validation of the execution and consensus part of the block, validators are only tasked to perform the consensus state transition function in this critical time before attesting, while execution and data availability validation is deferred for most of the remainder of the slot (between the builder&#x27;s reveal time and the next attestation deadline).&lt;&#x2F;li&gt;
&lt;li&gt;By removing the full execution payload size from the consensus block, it allows for faster network propagation on the critical path.&lt;&#x2F;li&gt;
&lt;li&gt;It removes the increased reorg likeliness of including blob transactions in blocks given the natural increase in timelines for data availability checks and the fact that the builder may broadcast the blob sidecars even before attestations for the beacon block have been released.&lt;&#x2F;li&gt;
&lt;li&gt;It prevents validators from missing attestations and strengthens the weight properties of fork choice in the event that builders produce invalid payloads.&lt;&#x2F;li&gt;
&lt;li&gt;It removes the need to use trusted middleware in order to delegate block construction to a builder.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;No changes are required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The full consensus changes can be found in the consensus-specs Github repository. They are split between:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;beacon-chain.md&quot;&gt;Beacon Chain&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;fork-choice.md&quot;&gt;Fork choice&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;p2p-interface.md&quot;&gt;P2P&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;validator.md&quot;&gt;Honest validator guide&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;builder.md&quot;&gt;honest builder&lt;&#x2F;a&gt; guide.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;c94138e73e0e70eb4b27f9be4d4e9325fa1aebf7&#x2F;specs&#x2F;gloas&#x2F;fork.md&quot;&gt;Fork logic&lt;&#x2F;a&gt; changes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A summary of the main changes is included below, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7732&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section contains explanation for most of the design decisions around these changes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;beacon-chain-changes&quot;&gt;Beacon chain changes&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;types&quot;&gt;Types&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BuilderIndex&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Builder registry index&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;index-flags&quot;&gt;Index flags&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_INDEX_FLAG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**40)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Bitwise flag which indicates that a &lt;code&gt;ValidatorIndex&lt;&#x2F;code&gt; should be treated as a &lt;code&gt;BuilderIndex&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;domains&quot;&gt;Domains&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_BEACON_BUILDER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0B000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_PTC_ATTESTER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0C000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_PROPOSER_PREFERENCES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x0D000000&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;misc&quot;&gt;Misc&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_INDEX_SELF_BUILD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;BuilderIndex(UINT64_MAX)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Value which indicates the proposer built the payload&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_PAYMENT_THRESHOLD_NUMERATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(6)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_PAYMENT_THRESHOLD_DENOMINATOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(10)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;withdrawal-prefixes&quot;&gt;Withdrawal prefixes&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(&#x27;0x03&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Withdrawal credential prefix for a builder&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;preset&quot;&gt;Preset&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;misc-1&quot;&gt;Misc&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PTC_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**9)&lt;&#x2F;code&gt; (= 512)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h6 id=&quot;max-operations-per-block&quot;&gt;Max operations per block&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PAYLOAD_ATTESTATIONS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h6 id=&quot;state-list-lengths&quot;&gt;State list lengths&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Unit&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_REGISTRY_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**40)&lt;&#x2F;code&gt; (= 1,099,511,627,776)&lt;&#x2F;td&gt;&lt;td&gt;Builders&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BUILDER_PENDING_WITHDRAWALS_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**20)&lt;&#x2F;code&gt; (= 1,048,576)&lt;&#x2F;td&gt;&lt;td&gt;Builder pending withdrawals&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h6 id=&quot;withdrawals-processing&quot;&gt;Withdrawals processing&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BUILDERS_PER_WITHDRAWALS_SWEEP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**14&lt;&#x2F;code&gt; (= 16,384)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;time-parameters&quot;&gt;Time parameters&lt;&#x2F;h6&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Unit&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_BUILDER_WITHDRAWABILITY_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(2**6)&lt;&#x2F;code&gt; (= 64)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;epochs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;containers&quot;&gt;Containers&lt;&#x2F;h5&gt;
&lt;h6 id=&quot;new-containers&quot;&gt;New containers&lt;&#x2F;h6&gt;
&lt;h6 id=&quot;builder&quot;&gt;&lt;code&gt;Builder&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Builder&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSPubkey&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawable_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;builderpendingpayment&quot;&gt;&lt;code&gt;BuilderPendingPayment&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BuilderPendingPayment&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    weight&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderPendingWithdrawal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;builderpendingwithdrawal&quot;&gt;&lt;code&gt;BuilderPendingWithdrawal&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BuilderPendingWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee_recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;payloadattestationdata&quot;&gt;&lt;code&gt;PayloadAttestationData&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_present&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_data_available&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;payloadattestation&quot;&gt;&lt;code&gt;PayloadAttestation&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    aggregation_bits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;PTC_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;payloadattestationmessage&quot;&gt;&lt;code&gt;PayloadAttestationMessage&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; PayloadAttestationMessage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;indexedpayloadattestation&quot;&gt;&lt;code&gt;IndexedPayloadAttestation&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; IndexedPayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attesting_indices&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PTC_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; PayloadAttestationData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;executionpayloadbid&quot;&gt;&lt;code&gt;ExecutionPayloadBid&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadBid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee_recipient&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_payment&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_kzg_commitments&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLOB_COMMITMENTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;signedexecutionpayloadbid&quot;&gt;&lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedExecutionPayloadBid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadBid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;executionpayloadenvelope&quot;&gt;&lt;code&gt;ExecutionPayloadEnvelope&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadEnvelope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionRequests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;signedexecutionpayloadenvelope&quot;&gt;&lt;code&gt;SignedExecutionPayloadEnvelope&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SignedExecutionPayloadEnvelope&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadEnvelope&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;modified-containers&quot;&gt;Modified containers&lt;&#x2F;h6&gt;
&lt;h6 id=&quot;beaconblockbody&quot;&gt;&lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: The removed fields (&lt;code&gt;execution_payload&lt;&#x2F;code&gt;, &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt;, and
&lt;code&gt;execution_requests&lt;&#x2F;code&gt;) now exist in &lt;code&gt;ExecutionPayloadEnvelope&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconBlockBody&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    randao_reveal&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Eth1Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    graffiti&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ProposerSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PROPOSER_SLASHINGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attester_slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AttesterSlashing&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Attestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_ATTESTATIONS_ELECTRA&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Deposit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_DEPOSITS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    voluntary_exits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedVoluntaryExit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_VOLUNTARY_EXITS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `execution_payload`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bls_to_execution_changes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SignedBLSToExecutionChange&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLS_TO_EXECUTION_CHANGES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `blob_kzg_commitments`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `execution_requests`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signed_execution_payload_bid&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SignedExecutionPayloadBid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_attestations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PayloadAttestation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_PAYLOAD_ATTESTATIONS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h6&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    genesis_time&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fork&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Fork&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latest_block_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_roots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_roots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    historical_roots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Eth1Data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_data_votes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Eth1Data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_ETH1_VOTING_PERIOD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    eth1_deposit_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validators&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Validator&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balances&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Gwei&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    randao_mixes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_HISTORICAL_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slashings&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Gwei&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_SLASHINGS_VECTOR&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_epoch_participation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ParticipationFlags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch_participation&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ParticipationFlags&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    justification_bits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;JUSTIFICATION_BITS_LENGTH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_justified_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inactivity_scores&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VALIDATOR_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [Modified in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Removed `latest_execution_payload_header`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latest_execution_payload_bid&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionPayloadBid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_withdrawal_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WithdrawalIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_withdrawal_validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    historical_summaries&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;HistoricalSummary&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_requests_start_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    exit_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_exit_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    consolidation_balance_to_consume&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    earliest_consolidation_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_deposits&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PendingDeposit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_DEPOSITS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_partial_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PendingPartialWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_PARTIAL_WITHDRAWALS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pending_consolidations&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PendingConsolidation&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PENDING_CONSOLIDATIONS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_lookahead&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builders&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Builder&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BUILDER_REGISTRY_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_withdrawal_builder_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BuilderIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    execution_payload_availability&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_pending_payments&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BuilderPendingPayment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    builder_pending_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BuilderPendingWithdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BUILDER_PENDING_WITHDRAWALS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    latest_block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in Gloas:EIP7732]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload_expected_withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_WITHDRAWALS_PER_PAYLOAD&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;BeaconState&lt;&#x2F;code&gt; container is modified with the addition of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;builders&lt;&#x2F;code&gt;, of type &lt;code&gt;List[Builder, BUILDER_REGISTRY_LIMIT]&lt;&#x2F;code&gt; to track the new in-protocol staked builders.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;next_withdrawal_builder_index&lt;&#x2F;code&gt; of type &lt;code&gt;BuilderIndex&lt;&#x2F;code&gt; to help tracking builder withdrawals.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;execution_payload_availability&lt;&#x2F;code&gt;, of type &lt;code&gt;Bitvector[SLOTS_PER_HISTORICAL_ROOT]&lt;&#x2F;code&gt; to track the presence of execution payloads on the canonical chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;builder_pending_payments&lt;&#x2F;code&gt;, of type &lt;code&gt;Vector[BuilderPendingPayment, 2 * SLOTS_PER_EPOCH]&lt;&#x2F;code&gt; to track pending payments from builders to proposers before the execution payload has been processed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;builder_pending_withdrawals&lt;&#x2F;code&gt;, of type &lt;code&gt;List[BuilderPendingWithdrawal, BUILDER_PENDING_WITHDRAWALS_LIMIT]&lt;&#x2F;code&gt; to track pending withdrawals to the execution layer with the builders&#x27; payments.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;latest_block_hash&lt;&#x2F;code&gt;, of type &lt;code&gt;Hash32&lt;&#x2F;code&gt;, to track the blockhash of the last execution payload in the blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;payload_expected_withdrawals&lt;&#x2F;code&gt; of type &lt;code&gt;List[Withdrawal, MAX_WITHDRAWALS_PER_PAYLOAD]&lt;&#x2F;code&gt; to track the latest withdrawals that were deducted in the consensus layer and need to still be honored in the Execution Layer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; is modified with the addition of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;signed_execution_payload_bid&lt;&#x2F;code&gt; of type &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; with the builder&#x27;s commitment.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;payload_attestations&lt;&#x2F;code&gt; of type &lt;code&gt;List[PayloadAttestation, MAX_PAYLOAD_ATTESTATIONS]&lt;&#x2F;code&gt; a list of PTC attestations from the previous slot.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; object is changed (and renamed to &lt;code&gt;ExecutionPayloadBid&lt;&#x2F;code&gt;) to only track the minimum information needed to commit to a builder&#x27;s payload.&lt;&#x2F;p&gt;
&lt;p&gt;State transition logic is modified by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A new beacon state getter &lt;code&gt;get_ptc&lt;&#x2F;code&gt; returns the PTC members for a given slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_withdrawals&lt;&#x2F;code&gt; is modified as follows. Withdrawals are obtained directly from the beacon state instead of the execution payload. They are deducted from the beacon chain. The beacon state &lt;code&gt;latest_withdrawals_root&lt;&#x2F;code&gt; is updated with the HTR of this list. The next execution payload MUST include withdrawals matching the &lt;code&gt;state.latest_withdrawals_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_block&lt;&#x2F;code&gt;. Instead a new function &lt;code&gt;process_execution_payload_bid&lt;&#x2F;code&gt; is included, this function validates the &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; included in the &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;, ensures the payment from the builder&#x27;s balance can be deducted and adds a &lt;code&gt;BuilderPendingPayment&lt;&#x2F;code&gt; object to the beacon state.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_deposit_request&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_operations&lt;&#x2F;code&gt; and deferred until &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;. Special care is added for deposit requests from new validator pubkeys, with withdrawal credentials starting with the prefix &lt;code&gt;BUILDER_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt;. These deposits are immediately added to the beacon chain and processed as new builders.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_withdrawal_request&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_operations&lt;&#x2F;code&gt; and deferred until &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_consolidation_request&lt;&#x2F;code&gt; is removed from &lt;code&gt;process_operations&lt;&#x2F;code&gt; and deferred until &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;code&gt;process_payload_attestation&lt;&#x2F;code&gt; is added to &lt;code&gt;process_operations&lt;&#x2F;code&gt;, this function validates the payload timeliness attestations broadcast by the PTC members.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; is now called as a separate helper when receiving a &lt;code&gt;SignedExecutionPayloadEnvelope&lt;&#x2F;code&gt; on the P2P layer. This function in particular checks that the HTR of the resulting beacon state coincides with the committed one in the payload envelope. On sucessful processing of the execution payload, the corresponding &lt;code&gt;BuilderPendingPayment&lt;&#x2F;code&gt; is removed from the beacon state and a &lt;code&gt;BuilderPendingWithdrawal&lt;&#x2F;code&gt; is queued.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Epoch processing is modified by addition of a new helper function &lt;code&gt;process_builder_pending_payments&lt;&#x2F;code&gt;, that processes the builder pending payments from those payloads that were not included in the canonical chain.
Although there is no change in the &lt;code&gt;AttestationData&lt;&#x2F;code&gt; object, the &lt;code&gt;index&lt;&#x2F;code&gt; field which is unused since the Electra fork, is now repurposed to signal payload availability. The value of &lt;code&gt;0&lt;&#x2F;code&gt; is used when attesting to the current beacon block or a past beacon block without a payload present, and the value of &lt;code&gt;1&lt;&#x2F;code&gt; is used to attest to a past beacon block with a payload present.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fork-choice-changes&quot;&gt;Fork-Choice changes&lt;&#x2F;h4&gt;
&lt;p&gt;Forkchoice is changed substantially to deal with the fact that forkchoice nodes can have different payload content.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;p2p-changes&quot;&gt;P2P changes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt; messages (builder bids).&lt;&#x2F;li&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;PayloadAttestationMessage&lt;&#x2F;code&gt; objects.&lt;&#x2F;li&gt;
&lt;li&gt;A new global topic for broadcasting &lt;code&gt;ProposerPreferences&lt;&#x2F;code&gt; objects.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;No changes needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;staked-builders&quot;&gt;Staked builders&lt;&#x2F;h3&gt;
&lt;p&gt;Being a builder is a new type of entity tracked in the beacon state. As such builders are staked in the beacon chain and they have their own withdrawal credential prefix. This allows for in-protocol trustless enforcement of the builder&#x27;s payment to the proposer. Alternatively, payment could be enforced in the Execution Layer (EL) at the cost of adding the corresponding EL consensus-changing logic. Payments in the EL have the advantage of not requiring the builder to periodically submit deposit transactions to replenish their validator balance. Both systems require availability of funds before the payload is revealed: in the Consensus Layer (CL) this is done by getting builders to stake. In the EL this is done with a balance check and a payment transaction. This transaction can be checked without executing the payload only if it the first transaction of the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delayed-validation&quot;&gt;Delayed validation&lt;&#x2F;h3&gt;
&lt;p&gt;The Payload Timeliness Committee members do not need to validate the execution payload before attesting to it. They perform basic checks such as verifying the builder&#x27;s signature, and the correct blockhash is included. This takes away the full execution payload validation from the hot path of validation of an Ethereum block, giving the next proposer 6 seconds (&lt;code&gt;SECONDS_PER_SLOT * 2 &#x2F;&#x2F; INTERVALS_PER_SLOT&lt;&#x2F;code&gt;) to validate the payload and every other validator 9 seconds (&lt;code&gt;SECONDS_PER_SLOT * 3 &#x2F;&#x2F; INTERVALS_PER_SLOT&lt;&#x2F;code&gt;). From a user UX perspective, a transaction included in slot &lt;code&gt;N&lt;&#x2F;code&gt; by the builder is not widely validated until the proposer of slot &lt;code&gt;N+1&lt;&#x2F;code&gt; releases their beacon block on top of block &lt;code&gt;N&lt;&#x2F;code&gt; first and the attesters of slot &lt;code&gt;N+1&lt;&#x2F;code&gt; vote on this beacon block as the head of the chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fork-choice&quot;&gt;Fork choice&lt;&#x2F;h3&gt;
&lt;p&gt;The following features of fork choice are guaranteed under specified margins of security:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Proposer unconditional payment.&lt;&#x2F;li&gt;
&lt;li&gt;Builder reveal safety.&lt;&#x2F;li&gt;
&lt;li&gt;Builder withhold safety.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Proposer unconditional payment refers to the following. An Ethereum slot can be either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Full&lt;&#x2F;em&gt;: both the beacon block and the execution payload have been revealed and included on-chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Skipped&lt;&#x2F;em&gt;: No beacon block (and therefore no execution payload) has been included on-chain for this slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Empty&lt;&#x2F;em&gt;: The beacon block has been included on-chain, but the committed execution payload has not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Proposer unconditional payment refers to the fact that in the third scenario the beacon block proposer received payment from the corresponding builder.&lt;&#x2F;p&gt;
&lt;p&gt;Builder reveal safety refers to the fact that if the builder acted honestly and revealed a payload in a timely fashion (as attested by the PTC) then the revealed payload will be included on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;Builder withhold safety refers to the fact that if some beacon block containing a builder&#x27;s commitment is withheld and revealed late, the builder will not be charged the value of the bid. In particular, the payload does not even need to be revealed in this case.&lt;&#x2F;p&gt;
&lt;p&gt;The precise method by which these safety mechanisms are enforced is by allowing attestations to also signal their view of the slot as in either of the above options &lt;em&gt;Full&lt;&#x2F;em&gt;, &lt;em&gt;Skipped&lt;&#x2F;em&gt; or &lt;em&gt;Empty&lt;&#x2F;em&gt;. For this, the &lt;code&gt;index&lt;&#x2F;code&gt; field in the &lt;code&gt;AttestationData&lt;&#x2F;code&gt; is used as explained above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ptc-equivocations&quot;&gt;PTC equivocations&lt;&#x2F;h3&gt;
&lt;p&gt;There is no penalty for PTC nor payload equivocation (that is revealing the right payload and also a withheld message at the same time). A collusion of a builder controlling network partition with a single malicious PTC member could cause a split view by achieving consensus both on payload withheld and a payload present. This could be mitigated by setting &lt;code&gt;PAYLOAD_TIMELY_THRESHOLD&lt;&#x2F;code&gt; to be 2&#x2F;3 of the PTC, in which case the malicious operator would have to control at least 33% of the PTC.&lt;&#x2F;p&gt;
&lt;p&gt;Another mitigation mechanism is to add new slashing conditions for payload equivocation or PTC equivocations (both are signed messages by validators).&lt;&#x2F;p&gt;
&lt;p&gt;Since this attack results in a split view at a cost for the builder (the payload is revealed and may not be included) this EIP opted for simplicity of implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;withdrawals&quot;&gt;Withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;Withdrawals from the beacon chain are complex in nature, they involve removing funds from one layer and crediting them on another, with different trigger mechanisms that can start from either layer. Before applying the consensus layer state transition function to a given beacon state &lt;code&gt;pre_state&lt;&#x2F;code&gt; and processing a given signed beacon block &lt;code&gt;block&lt;&#x2F;code&gt;, the set of withdrawals that are expected to be deducted from the beacon chain are completely determined by &lt;code&gt;pre_state&lt;&#x2F;code&gt;. Previous to this EIP the set of withdrawals that are credited on the execution layer are included in &lt;code&gt;block&lt;&#x2F;code&gt;. The block is deemed invalid if these withdrawals do not match. With the separation included in this EIP, these operations of deducting and crediting become asynchronous:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When processing the beacon block, the withdrawals are deducted from the beacon chain.&lt;&#x2F;li&gt;
&lt;li&gt;The set of withdrawals just deducted is committed to the beacon state &lt;code&gt;post_state&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When processing any execution payload whose parent beacon state is &lt;code&gt;post_state&lt;&#x2F;code&gt;, the payload is deemed invalid if it doesn&#x27;t include precisely the list of withdrawals committed to &lt;code&gt;post_state&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This asynchronous mechanism has some consequences as slots may be &lt;em&gt;empty&lt;&#x2F;em&gt; as defined above. In these cases, the consensus layer does not process any more withdrawals until an execution payload has fulfilled the outstanding ones. An alternative design would be to defer all of withdrawal processing to the execution payload validation phase (ie. &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt;). This has the advantage of not needing to track the fulfilled withdrawals on the beacon chain. The logic changes when several payloads are missing, in which case balances on the beacon chain change and therefore a withdrawal that would be possible with the former mechanism may be different, or even impossible with the latter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;three-state-transition-functions&quot;&gt;Three state transition functions&lt;&#x2F;h3&gt;
&lt;p&gt;The current EIP adds an extra state transition function to the block processing in Ethereum. Processing a &lt;code&gt;SignedBeaconBlock&lt;&#x2F;code&gt; changes the consensus layer &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. A &lt;code&gt;SignedExecutionPayloadEnvelope&lt;&#x2F;code&gt; changes both the execution layer state and the consensus layer one. As such, the envelope commits to the consensus layer post-state-transition beacon state root.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;compatible-designs&quot;&gt;Compatible designs&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;inclusion-lists&quot;&gt;Inclusion lists&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP is fully compatible with forkchoice enforced inclusion lists as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7805&#x2F;&quot;&gt;EIP-7805&lt;&#x2F;a&gt; or similar.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;slot-auctions&quot;&gt;Slot auctions&lt;&#x2F;h4&gt;
&lt;p&gt;A simple change to this EIP is to remove the blockhash commitment from the &lt;code&gt;SignedExecutionPayloadBid&lt;&#x2F;code&gt;. This allows the builder to commit any payload to the slot. A preliminary security analysis shows that payload equivocation does not weaken fork choice&#x27;s FFG. Some advantages of Slot auctions include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Better user experience as any submitted transaction can be included in the next block (with block auctions a transaction sent in the first half of the slot can only be included in the following block).&lt;&#x2F;li&gt;
&lt;li&gt;Longer continuous time to build blocks.&lt;&#x2F;li&gt;
&lt;li&gt;Better compatibility designs with fork choice enforced inclusion list proposals.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;free-option-problem&quot;&gt;Free option problem&lt;&#x2F;h3&gt;
&lt;p&gt;Economically rational but malicious (as defined by the honest builder guide) builders may chose to withhold their payload in the event that it would be profitable for them. This could result in missed slots and degradation of user experience of Ethereum. Some preliminary data in the form of simulation suggests that the number of these occurrences may be noticeable. Some mitigations were proposed in the form of variable penalties for builders that fail to include their payload envelopes in the canonical chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;builder-safety&quot;&gt;Builder safety&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;A colluding set of proposers and attesters controlling consecutive blocks and more than 20% of the total stake can reorg a builder&#x27;s payload and force it to pay the bid&#x27;s value.&lt;&#x2F;li&gt;
&lt;li&gt;There is no possible &lt;em&gt;unbundling&lt;&#x2F;em&gt; of the builder&#x27;s payload in the same slot, that is, if the builder reveals a payload for the head of the chain, no other payload is possible for the current slot.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;malicious-ptc&quot;&gt;Malicious PTC&lt;&#x2F;h3&gt;
&lt;p&gt;The expected time for a malicious attacker, controlling 35% of the total stake, to have a majority control on the PTC is 205 000 years.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM Transaction Bundles</title>
        <published>2024-06-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lily Johnson</name><uri>https://github.com/lilyjjo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7727/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7727-evm-transaction-bundles/20322" />
        

        <id>https://wg-eips.ritovision.com/7727/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7727"
            label="EIP-7727" />
        

        
        

        
        <summary type="html">Enable meta transactions to order other transactions without revert protections.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7727/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces two new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction types and one new opcode, enabling smart contracts and transactions to delegate their local sequencing rights to an off-chain entity. These new transaction types work together to create EVM-native &#x27;bundles&#x27;, which are similar to but weaker than the Proposer-Builder Separation (PBS) bundles offered by builders to searchers.&lt;&#x2F;p&gt;
&lt;p&gt;One of the EIP-2718 transactions is an extended normal transaction that supports:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Specifying the entity who can place the transaction in a bundle.&lt;&#x2F;li&gt;
&lt;li&gt;An optional block number that the transaction is valid in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The other EIP-2718 transaction is a &#x27;meta&#x27; transaction that does not enter into execution, but rather orders transactions of its own type and the other new type. The &#x27;meta&#x27; transaction can also specify an entity allowed to include it in a bundle and a valid block number.&lt;&#x2F;p&gt;
&lt;p&gt;The new opcode reveals to the EVM the entity that placed the transaction in a bundle if the transaction was in a bundle.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, a single block builder has unrestricted control over the final sequencing of a block’s transactions. This poses a problem, as sequencing—the choice of who gets to interact with specific pieces of state and in what order—significantly influences value flow. The objective of this EIP is to allow more parties to participate in the construction of single blocks by exposing sequencing concepts inside of the EVM. This change would enable EVM applications to reclaim some of the sequencing value that is currently monopolized by block builders, redirecting it back to the applications themselves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;DELEGATED_TX_TYPE&lt;&#x2F;td&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BUNDLE_TX_TYPE&lt;&#x2F;td&gt;&lt;td&gt;0x06&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BUNDLE_BASE_GAS_COST&lt;&#x2F;td&gt;&lt;td&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BUNDLE_SIGNER_OPCODE_NUMBER&lt;&#x2F;td&gt;&lt;td&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-payload-types&quot;&gt;New Transaction Payload Types&lt;&#x2F;h3&gt;
&lt;p&gt;Two new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transactions with types &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; and &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt;, the transaction payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureYParity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;signatureYParity&lt;&#x2F;code&gt;, &lt;code&gt;signatureR&lt;&#x2F;code&gt;, &lt;code&gt;signatureS&lt;&#x2F;code&gt; elements of the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; represent a secp256k1 signature over:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chain_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasLimit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; data&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;, the transaction payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	transactionList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureYParity&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	signatureS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;transactionList&lt;&#x2F;code&gt; element is a list of syntactically valid transactions of either type &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; or &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;. At least one transaction must be in the list.&lt;&#x2F;p&gt;
&lt;p&gt;An example would of the &lt;code&gt;transactionList&lt;&#x2F;code&gt; would be:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	DELEGATED_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	BUNDLE_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	DELEGATED_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;payload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;signatureYParity&lt;&#x2F;code&gt;, &lt;code&gt;signatureR&lt;&#x2F;code&gt;, &lt;code&gt;signatureS&lt;&#x2F;code&gt; elements of the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; represent a secp256k1 signature over:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;bundleSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockNumber&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; chainId&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; gasPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transactionList&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We’ll refer to address resolved by this signature the bundle transaction’s signer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bundle-signer-opcode&quot;&gt;&lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; is a new opcode identified by &lt;code&gt;BUNDLE_SIGNER_OPCODE_NUMBER&lt;&#x2F;code&gt; that requires zero stack arguments.&lt;&#x2F;p&gt;
&lt;p&gt;When the transaction type is &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt;, this opcode pushes the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; from the transaction payload onto the stack as an address. If the transaction is of a different type, it returns the zero address.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for this opcode is the &lt;code&gt;GAS_VERY_LOW&lt;&#x2F;code&gt; gas constant.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-validity-rules&quot;&gt;Transaction Validity Rules&lt;&#x2F;h3&gt;
&lt;p&gt;For a &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; to be valid, the following must be true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The transaction must be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt; to be valid.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction’s specified &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; must be equal to the address who signed over the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; that included the transaction in a &lt;code&gt;transactionList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The payload variable &lt;code&gt;blockNumber&lt;&#x2F;code&gt;, if not zero, must be the block number that the transaction is executed in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; to be valid, the following MUST be true:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All transactions in the &lt;code&gt;transactionList&lt;&#x2F;code&gt; must specify the signer of the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; as the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction must be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt; if the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; payload variable is not the zero address.&lt;&#x2F;li&gt;
&lt;li&gt;The payload variable &lt;code&gt;blockNumber&lt;&#x2F;code&gt;, if not zero, must be the block number that the transaction is executed in.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; has a new gas cost formula that changes based on whether the transactions in the &lt;code&gt;transactionList&lt;&#x2F;code&gt; are valid at the time of execution.&lt;&#x2F;p&gt;
&lt;p&gt;If a transaction in the &lt;code&gt;transactionList&lt;&#x2F;code&gt; is invalid, the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction is charged as if the invalid transaction&#x27;s bytes were part of a typical transaction&#x27;s &lt;code&gt;CALL_DATA&lt;&#x2F;code&gt;. If an inner transaction is valid, there is no cost for its inclusion in the list.&lt;&#x2F;p&gt;
&lt;p&gt;The formula is calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;BUNDLE_BASE_GAS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;CALL_DATA_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; transaction_list_invalid_tx_byte_length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the start of processing, the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s signer is charged as if all inner transactions were invalid and is refunded the gas for the valid transactions as each valid transaction finishes execution.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; follows typical gas costing rules.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; execute normally with the &lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; opcode returning the &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; payload variable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; do not start execution contexts. The&lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;NONCE&lt;&#x2F;code&gt; must be incremented before the start of any &lt;code&gt;transactionList&lt;&#x2F;code&gt; execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receiptpayload-definitions&quot;&gt;ReceiptPayload Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transaction that are able to begin execution, their &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; receipt payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;status&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; logsBloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; logs&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transactions that are invalid do not get transaction receipts.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction’s  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; receipt payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;statusArray&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cumulativeGasUsed&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the &lt;code&gt;statusArray&lt;&#x2F;code&gt; is a list of status results for the inner &lt;code&gt;transactionList&lt;&#x2F;code&gt;&#x27;s transactions. The list must be the same length as the &lt;code&gt;transactionList&lt;&#x2F;code&gt; and report the statuses in the same order. The status type &lt;code&gt;0x3&lt;&#x2F;code&gt; should be used to report invalid transactions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;cumulateGasUsed&lt;&#x2F;code&gt; is the amount of gas spent by the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s signer on the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction costs post &lt;code&gt;CALLDATA&lt;&#x2F;code&gt; refund.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;allowing-invalid-transactions-to-be-included-in-a-bundle-tx-type-s-transactionlist&quot;&gt;Allowing invalid transactions to be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Knowing how a transaction will execute is challenging without knowing the state root to which the transaction is applied. Creators of &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transactions can only access the previous block’s state root and cannot predict which transactions will precede the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction in the upcoming block&#x27;s total order. If only valid transactions were permitted, &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction lists could be easily invalidated by a single inner transaction attempting to grief the bundle through nonce or gas invalidations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;charging-the-bundle-tx-type-s-signer-calldata-gas-costs-for-invalid-transactions&quot;&gt;Charging the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s signer &lt;code&gt;CALLDATA&lt;&#x2F;code&gt; gas costs for invalid transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Blockchains must charge for the work that nodes perform to prevent DoS attacks. Even though invalid transactions in &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction lists do not execute, they still occupy block space as bytes and must be paid for by some entity. It is assumed that &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; creators will be sophisticated entities capable of simulating the previous block’s state with relative accuracy and able to generate enough profit to offset any invalidation costs incurred.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_BASE_GAS_COST&lt;&#x2F;code&gt; should be set to make the cost of attempting to grief the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; signer more expensive than the cost of the bytes to cover the invalid transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;requiring-delegated-tx-type-typed-transactions-to-be-included-in-a-bundle-tx-type-s-transactionlist&quot;&gt;Requiring &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; typed transactions to be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transactions were able to be executed outside of a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction list, then there would be competition between the &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; signer and the total block builder for the right to choose how to locally sequence the transaction. If the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transaction signer wished to allow the total block builder to choose the local ordering, then the &lt;code&gt;DELEGATED_TX_TYPE&lt;&#x2F;code&gt; transaction type should not be used.&lt;&#x2F;p&gt;
&lt;p&gt;The same principle applies to &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transactions. Those that specify a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; must only be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; list, while those that do not specify a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; must not be included in such a list.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-allowing-other-transactions-types-to-be-included-in-a-bundle-tx-type-s-transactionlist&quot;&gt;Not allowing other transactions types to be included in a &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;transactionList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This restriction was implemented as a precautionary measure and could be reconsidered in the future. Allowing the inclusion of other transaction types that do not specify a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; into the &lt;code&gt;transactionList&lt;&#x2F;code&gt; could result in multiple searchers attempting to include the same transaction in a bundle. This could potentially create spam within a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;differences-from-pbs-searcher-bundles&quot;&gt;Differences from PBS Searcher Bundles&lt;&#x2F;h3&gt;
&lt;p&gt;PBS block builders currently offer &#x27;bundles&#x27; as a service to searchers in the form of transaction lists that either all execute without reversion or are not included in a block. Searchers typically use these bundles to bid for the right to be the first to interact with a piece of state or to place logic before or after transactions created by non-searcher entities, with back-running and sandwiching being examples. PBS block builders provide this service as a way to gain order flow and increase their block&#x27;s value.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BUNDLE_TX_TYPE&lt;&#x2F;code&gt; transaction differ in two key ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There is no revert protection.&lt;&#x2F;li&gt;
&lt;li&gt;Only transactions explicitly delegating to a &lt;code&gt;bundleSigner&lt;&#x2F;code&gt; can be bundled.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These choices were made to prevent DoS attacks on builders and to be compatible with non-PBS block builders running other algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Block builders are problematic today partly due to their ability to perform censorship and enforce malicious orderings. These concerns persist even when sequencing rights are delegated to a specific entity. The code that generates the off-chain ordering should be public and executed in a trust-minimized manner, such as in a TEE (Trusted Execution Environment) or on a blockchain with faster block times.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly, smart contracts that restrict functionality to transactions signed by a specific &lt;code&gt;BUNDLE_SIGNER&lt;&#x2F;code&gt; should provide mechanisms for users to withdraw funds without relying on the delegated sequencing entity to be online or non-malicious. A two-step fund removal process could be implemented to allow safe interaction with bundle construction and simulation logic.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Anti-correlation attestation penalties</title>
        <published>2024-05-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7716/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7716-anti-correlation-attestation-penalties/20137" />
        

        <id>https://wg-eips.ritovision.com/7716/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7716"
            label="EIP-7716" />
        

        
        

        
        <summary type="html">Adjust penalties for missed attestations based on in-slot correlation of missed attestation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7716/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The decentralization of the validator set is one of the most important properties of Ethereum for credible neutrality and censorship resistance. By adjusting penalties to foster decentralization, diversification and fault-tolerance, this EIP proposes to adjust penalties in a way that more diversified entities get lower penalties while entities with high correlations in their setup face more severe ones.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As of now, during times of usual network operation, there are no economic incentives to diversify node operations through using multiple different nodes, geographical locations, clients, ISP providers, etc., except for reducing the risk of penalties affecting all validators simultaneously, thereby limiting the impact to only a fraction of them.&lt;&#x2F;p&gt;
&lt;p&gt;Attestation penalties are currently agnostic to other participation actions. This proposal scales attestation penalties as a function of other participants&#x27; actions. The goal is to decrease the profitability of participants that exhibit correlated behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PENALTY_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Add a variable &lt;code&gt;NET_EXCESS_PENALTIES&lt;&#x2F;code&gt; to the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; be determined through&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;min(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (non_attesting_balance * PENALTY_ADJUSTMENT_FACTOR) &#x2F;&#x2F; (NET_EXCESS_PENALTIES * total_active_balance + 1), &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    MAX_PENALTY_FACTOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Let &lt;code&gt;NET_EXCESS_PENALTIES&lt;&#x2F;code&gt; be &lt;code&gt;max(1, NET_EXCESS_PENALTIES + penalty_factor) - 1&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;penalty-adjustment-factor&quot;&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;h3&gt;
&lt;p&gt;This variable impacts the sensitivity of the &lt;code&gt;NET_EXCESS_PENALTIES&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given stable participation, the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; is one.
If participation decreases, the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; will temporarily increase above one until &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; catches up.
If participation increases, the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; will temporarily be zero until &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; catches up.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; regulates how fast &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; catches up.
In other words, the &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; determines the frequency that the penalty_factor is not one.&lt;&#x2F;p&gt;
&lt;p&gt;A high &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; causes the &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; to adjust slower.
A low &lt;code&gt;PENALTY_ADJUSTMENT_FACTOR&lt;&#x2F;code&gt; causes the &lt;code&gt;net_excess_penalties&lt;&#x2F;code&gt; to react more sensitively to changes in participation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-penalty-factor&quot;&gt;&lt;code&gt;MAX_PENALTY_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;MAX_PENALTY_FACTOR&lt;&#x2F;code&gt; puts a ceiling onto the maximum factor with which the penalty for missed attestations is scaled to prevent overly harsh punishments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible adjustment of attestations rewards and penalties that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;We acknowledge that splitting validator views can be leveraged as an attack to increase the &lt;code&gt;penalty_factor&lt;&#x2F;code&gt; for validators of consecutive slots with little risk for the proposer.
TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Read BLOCKHASH from storage and update cost</title>
        <published>2024-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Tomasz Stanczak</name><uri>https://github.com/tkstanczak</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Gabriel Rocheleau</name><uri>https://github.com/gabrocheleau</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7709/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7709-read-blockhash-opcode-from-storage-and-adjust-gas-cost/20052" />
        

        <id>https://wg-eips.ritovision.com/7709/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7709"
            label="EIP-7709" />
        

        
        

        
        <summary type="html">Read the `BLOCKHASH (0x40)` opcode from the EIP-2935 system contract storage and adjust its gas cost to reflect storage access.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7709/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Update the &lt;code&gt;BLOCKHASH (0x40)&lt;&#x2F;code&gt; opcode to read and serve from the system contract storage and charge the &lt;strong&gt;additional&lt;&#x2F;strong&gt; (cold or warm) storage costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH (0x40)&lt;&#x2F;code&gt; opcode currently assumes that the client has knowledge of the previous blocks, which in Verkle &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; would prevent stateless execution. However with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; blockhashes can be retrieved and served from its system contract storage which allows Verkle blocks to include a storage access witness for stateless execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode semantics remains the same as before. From the &lt;code&gt;fork_block&lt;&#x2F;code&gt; (defined as &lt;code&gt;fork_block.timestamp &amp;gt;= FORK_TIMESTAMP and fork_block.parent.timestamp &amp;lt; FORK_TIMESTAMP&lt;&#x2F;code&gt;), the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; instruction should be updated to resolve block hash in the following manner:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; resolve_blockhash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; arg&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; note that outside the BLOCKHASH_SERVE_WINDOW we continue to return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; despite the 2935 history contract being able to serve more hashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;arg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCKHASH_SERVE_WINDOW&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; performs an sload on arg % HISTORY_SERVE_WINDOW including gas charges,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; warming effects as well as execution accesses&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; note that the `BLOCKHASH_SERVE_WINDOW` and the 2935 ring buffer window&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `HISTORY_SERVE_WINDOW` for slot calculation are different&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;load_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; arg&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_SERVE_WINDOW&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ONLY if the &lt;code&gt;arg&lt;&#x2F;code&gt; is within the correct &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; window, clients can choose to either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;do a direct &lt;code&gt;SLOAD&lt;&#x2F;code&gt; from state, or&lt;&#x2F;li&gt;
&lt;li&gt;do a system call to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract via its &lt;code&gt;get&lt;&#x2F;code&gt; mechanism (caller other than &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;) or&lt;&#x2F;li&gt;
&lt;li&gt;serve from memory or as per current designs if maintaining requisite history (full clients for e.g.)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However the entire semantics and after effects of the &lt;code&gt;SLOAD&lt;&#x2F;code&gt; operation needs to be applied as per the current fork if the &lt;code&gt;arg&lt;&#x2F;code&gt; is within the correct &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; window:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; gas costs (cold or warm) for the &lt;code&gt;arg % HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; after effects on the slot (warming the slot)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; accesses added to execution witnesses if Verkle (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;) is activated&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;activation&quot;&gt;Activation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP specifies the transition to the new logic assuming that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; has been activated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sufficiently ahead of this EIP&#x27;s activation (&amp;gt;= &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;) or&lt;&#x2F;li&gt;
&lt;li&gt;at genesis for testnets&#x2F;devnets where this EIP could also be activated at genesis&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The current proposal is to activate this EIP with Verkle to allow for stateless execution of the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;As described above, if the &lt;code&gt;arg&lt;&#x2F;code&gt; to be resolved is within the correct window, the corresponding &lt;code&gt;SLOAD&lt;&#x2F;code&gt; charges and accesses are to be applied for the slot &lt;code&gt;arg % HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt;. Note that the &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; and &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; are different.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reading-from-the-system-contract&quot;&gt;Reading from the System contract&lt;&#x2F;h3&gt;
&lt;p&gt;Even if the clients choose to resolve &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; through system call to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract, the gas cost for the system code execution (and also the code witnesses if Verkle activated) is not applied. Only the effect of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; is applied as described above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The reason behind the updated gas cost is to match the real operation, which is equivalent to an &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system contract execution charges (and accesses) are not applied to keep the gas low and to keep things simple for clients which choose to resolve &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; in other ways (directly or though memory&#x2F;maintained history)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode only serves a limited &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; to be backward compatible (and to not extend the above exemptions). For deeper accesses one will need to directly call &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system contract which will lead to a normal contract execution (as well as charges and accesses)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a significant increase in the cost of &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;, which could break use-cases that rely on the previous gas cost. Also, this EIP introduces a breaking change in the case where less than &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; elapse between the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; fork and this EIP&#x27;s fork (unless &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;  is activated in genesis for e.g. in testnets&#x2F;devnets) as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system contract would not have saved the required history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; is not called or there is no &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract call by any transaction, only the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; system update of the parent hash shows up in witnesses if Verkle is activated.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; is called, there MUST be a storage access gas charge (and corresponding access witness if Verkle is activated) for the storage slot but ONLY if the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; query is for the last &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; ancestors. This is irrespective of how the client chooses to resolve the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; (directly, via system contract or via memory)&lt;&#x2F;li&gt;
&lt;li&gt;The gas cost for each &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; operation should still be charged, in addition to the &lt;code&gt;SLOAD&lt;&#x2F;code&gt; cost of each lookup (if performed)&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; contract is called directly (i.e. not through &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;), then the witness and gas costs (including those related to contract code) are applied as per normal contract execution of the current fork.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; should be consistently resolved if this EIP is activated correctly &lt;code&gt;&amp;gt;= BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; after &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations other than the ones contained in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt; are determined as of now.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ETH transfers emit a log</title>
        <published>2024-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Carson</name><uri>https://github.com/carsons-eels</uri>
	</author>
	
	<author>
		<name>Jared Wasinger</name><uri>https://github.com/jwasinger</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7708/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7708-eth-transfers-emit-a-log/20034" />
        

        <id>https://wg-eips.ritovision.com/7708/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7708"
            label="EIP-7708" />
        

        
        

        
        <summary type="html">All ETH transfers emit a log</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7708/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;All ETH-transfers, including transactions, &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; emit a log.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Logs are often used to track when balance changes of assets on Ethereum. Logs work for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens, but they do not work for ETH. ETH transfers from EOAs can be read from the transaction list in the block, but ETH transfers from smart contract wallets are not automatically logged anywhere. This has already led to problems in the past, eg. early exchanges would often not properly support deposits from smart contract wallets, or only support them with a much longer delay. This EIP proposes that we automatically generate a log every time a value-transferring &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; happens. We also add a similar log for transfers in transactions, so that all ETH transfers can be tracked using one mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eth-transfer-logs&quot;&gt;ETH transfer logs&lt;&#x2F;h3&gt;
&lt;p&gt;A log, identical to a LOG3, is issued for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any nonzero-value-transferring transaction to a different account, before any other logs created by EVM execution&lt;&#x2F;li&gt;
&lt;li&gt;Any nonzero-value-transferring &lt;code&gt;CALL&lt;&#x2F;code&gt; to a different account, at the time that the value transfer executes&lt;&#x2F;li&gt;
&lt;li&gt;Any nonzero-value-transferring &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to a different account, at the time that the value transfer executes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt; emitting log&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Transfer(address,address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;from&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[2]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;to&lt;&#x2F;code&gt; address (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This matches the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; Transfer event definition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfdestruct-processing&quot;&gt;Selfdestruct processing&lt;&#x2F;h3&gt;
&lt;p&gt;A log, identical to a LOG2, is issued for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any non-zero balance removal which occurs when a contract created in the same transaction invokes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with itself as a target, at the time that the opcode is invoked.&lt;&#x2F;li&gt;
&lt;li&gt;Each account which has been marked for deletion and holds a balance at the time of removal during transaction finalization.  Burn logs are emitted after any other logs created by EVM execution and the payment of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; priority fee to the coinbase, in lexicographical order of account address&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt; emitting log&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[0]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083&lt;&#x2F;code&gt; (&lt;code&gt;keccak256(&#x27;Selfdestruct(address,uint256)&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;topics[1]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Closed &lt;code&gt;contract_address&lt;&#x2F;code&gt; (zero prefixed to fill uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;amount&lt;&#x2F;code&gt; in Wei (big endian uint256)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The Selfdestruct log is emitted when (1) a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to self is triggered, or when (2) a smart contract is closed after receiving more ETH after already flagged for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is the simplest possible implementation that ensures that all ETH transfers are implemented in some kind of record that can be easily accessed through making RPC calls into a node, or through asking for a Merkle branch that is hashed into the block root. The log type is compatible with the ERC-20 token standard, but does not introduce any overly-specific ERC-20 features (eg. ABI encodings) into the specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;open-questions&quot;&gt;Open questions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Magic value used for &lt;code&gt;address&lt;&#x2F;code&gt;? For address: (a) &lt;code&gt;0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&lt;&#x2F;code&gt; (same as &lt;code&gt;eth_simulateV1&lt;&#x2F;code&gt;), (b) &lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;), (c) zero address&lt;&#x2F;li&gt;
&lt;li&gt;Should fee payments trigger a log? It would ensure &quot;completeness&quot;, in the sense that you can compute the exact current balance table by watching logs, but it would greatly increase the number of logs, perhaps to an unacceptably high amount.&lt;&#x2F;li&gt;
&lt;li&gt;Should withdrawals also trigger a log? They are not associated with transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;ETH transfers already cost a minimum of 6700 gas, which is much more expensive than the LOG3 opcode (1500 gas). Hence, this EIP does not increase the worst-case number of logs that can be put into a block. It will somewhat increase the average number of logs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Separate gas type for calldata</title>
        <published>2024-05-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7706/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7706-create-a-separate-basefee-and-gaslimit-for-calldata/19998" />
        

        <id>https://wg-eips.ritovision.com/7706/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7706"
            label="EIP-7706" />
        

        
        

        
        <summary type="html">Create a separate basefee and gaslimit for calldata</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7706/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new type of gas for transaction calldata. Add a new transaction type that provides &lt;code&gt;max_basefee&lt;&#x2F;code&gt; and &lt;code&gt;priority_fee&lt;&#x2F;code&gt; as a vector, providing values for execution gas, blob gas and calldata gas. Modify the basefee adjustment to use the same mechanism for the three types of gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A major argument against raising the Ethereum gas limit, making calldata cheaper, or increasing the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob count before technologies like PeerDAS become available, is that the theoretical maximum size of an Ethereum block is already too large, and we cannot afford to increase it further. However, there is an inefficiency here: the current average size of a block (not including blobs) is ~100 kB, and the theoretical max is &lt;code&gt;30,000,000 &#x2F; 16 = 1,875,000&lt;&#x2F;code&gt; bytes (one could make larger blocks using zero bytes, but in practice zero-byte-heavy blocks would be compressed to less than 1.87 million bytes due to snappy compression). Ideally, we would have a way to bound the maximum, without making calldata more scarce &lt;em&gt;on average&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does exactly this, by adopting the same technique that was applied for blob data in EIP-4844: we introduce a separate fee market for calldata, with a separate basefee and a separate per-block gas limit. The theoretical max calldata size of a block would be greatly reduced, while basic economic analysis suggests that &lt;em&gt;on average&lt;&#x2F;em&gt;, calldata would become considerably cheaper.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP also introduces a new transaction type which includes the three types of max-basefees and priority fees as a vector, allowing the same code paths to handle all three types of gas. We also make the basefee adjustment, which currently uses separate mechanisms for execution gas (introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;) and blobs (introduced in EIP-4844), use the same approach for all three types of gas. This simplifies the basefee adjustment rules, and ensures that the stronger mathematical properties of the newer EIP-4844 basefee adjustment algorithm cover all three types of gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NEW_TX_TYPE&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLDATA_GAS_PER_TOKEN&lt;&#x2F;code&gt; = &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TOKENS_PER_NONZERO_BYTE&lt;&#x2F;code&gt; = &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt; = &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LIMIT_TARGET_RATIOS = [2, 2, 4]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MIN_BASE_FEE_PER_GAS = 1&lt;&#x2F;code&gt; # Rename of EIP-4844 MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE_UPDATE_FRACTION = 8&lt;&#x2F;code&gt; # Roughly matches EIP-4844 parameters&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;TX_TYPE(NEW_TX_TYPE)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, gas_limit, to, value, data, access_list, blob_versioned_hashes, max_fees_per_gas, priority_fees_per_gas, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We require &lt;code&gt;max_fees_per_gas&lt;&#x2F;code&gt; and &lt;code&gt;priority_fees_per_gas&lt;&#x2F;code&gt; to be length-3 vectors, each of which contain integers from &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;2**64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from EIP-4844, except that the calldata gas cost (16 per nonzero byte, 4 per zero byte) is removed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing-and-transaction-fees&quot;&gt;Block processing and transaction fees&lt;&#x2F;h3&gt;
&lt;p&gt;We add the functions &lt;code&gt;get_max_fees&lt;&#x2F;code&gt; and &lt;code&gt;get_priority_fees&lt;&#x2F;code&gt;, to compute these length-3 vectors for previous transaction types:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_max_fees(tx: Transaction) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.type == NEW_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return tx.max_fees_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif tx.type == BLOB_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_fee_per_gas, tx.max_fee_per_blob_gas, tx.max_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif is_eip_1559(tx.type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_fee_per_gas, 0, tx.max_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gasprice, 0, tx.gasprice]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_priority_fees(tx: Transaction) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.type == NEW_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return tx.priority_fees_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif tx.type == BLOB_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_priority_fee_per_gas, 0, tx.max_priority_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif is_eip_1559(tx.type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.max_priority_fee_per_gas, 0, tx.max_priority_fee_per_gas]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gasprice, 0, tx.gasprice]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We also add some helpers:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def all_less_or_equal(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; bool:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return all(x &amp;lt;= y for x, y in zip(v1, v2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_add(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x+y for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_subtract(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x-y for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_subtract_clamp_at_zero(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [uint, uint, uint]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x-y if x &amp;gt;= y else 0 for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def vector_mul(v1: [int, int, int], v2: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [x*y for x, y in zip(v1, v2)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Same rules as current calldata pricing, but rephrased (similar language to EIP-7623)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_calldata_gas(calldata: bytes) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tokens = calldata.count(0) + (len(calldata) - calldata.count(0)) * TOKENS_PER_NONZERO_BYTE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return tokens * CALLDATA_GAS_PER_TOKEN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_gaslimits(tx: Transaction) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.type == NEW_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, len(tx.blob_versioned_hashes) * GAS_PER_BLOB, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif tx.type == BLOB_TX_TYPE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, len(tx.blob_versioned_hashes) * GAS_PER_BLOB, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif is_eip_1559(tx.type):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, 0, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return [tx.gaslimit, 0, get_calldata_gas(tx.data)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_fees_per_gas(tx: Transaction, block_basefees: [int, int, int]) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees = get_max_fees(tx)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    priority_fees = get_priority_fees(tx)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Fee sufficiency check, similar to EIP-1559 and 4844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(all_less_or_equal(block_basefees, max_fees))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Similar logic to EIP-1559 and 4844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        min(basefee + priority_fee, max_fee)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for block_basefee, max_fee, priority_fee in zip(block_basefees, max_fees, priority_fees)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;get_block_gaslimits(block: Block) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [block.gaslimit, MAX_BLOB_GAS_PER_BLOCK, block.gaslimit &#x2F;&#x2F; CALLDATA_GAS_LIMIT_RATIO]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;At the start of block processing&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We initialize a vector &lt;code&gt;gas_used_so_far&lt;&#x2F;code&gt; to &lt;code&gt;[0, 0, 0]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the start of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compute &lt;code&gt;fees_per_gas = get_fees_per_gas(tx, get_block_basefees(block))&lt;&#x2F;code&gt; and &lt;code&gt;tx_gaslimits = get_gaslimits(tx)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Check that &lt;code&gt;all_less_or_equal(vector_add(gas_used_so_far, tx_gaslimits), block.gas_limits)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Deduct &lt;code&gt;sum(vector_mul(fees_per_gas, tx_gaslimits))&lt;&#x2F;code&gt; wei from the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that &lt;code&gt;get_block_basefees(block)&lt;&#x2F;code&gt; is not yet defined, we will define it in the section below. The &lt;code&gt;block.gas_limits&lt;&#x2F;code&gt; field is also defined in the section below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a transaction&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compute &lt;code&gt;tx_gas_consumed&lt;&#x2F;code&gt; as a three item vector, where the first item is the amount of gas actually consumed by the transaction execution, and the second and third match the values in &lt;code&gt;get_gaslimits(tx)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Refund &lt;code&gt;sum(vector_mul(fees_per_gas, vector_sub(tx_gaslimits, tx_gas_consumed)))&lt;&#x2F;code&gt; to the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; account (in practice, only the first term will be nonzero for now)&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;gas_used_so_far = vector_add(gas_used_so_far, tx_gas_consumed)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;At the end of processing a block&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Require &lt;code&gt;block.gas_used = gas_used_so_far&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;block.gas_used&lt;&#x2F;code&gt; field will be defined in the section below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure:&lt;&#x2F;h3&gt;
&lt;p&gt;We update &lt;code&gt;BlockHeader&lt;&#x2F;code&gt; field, to remove the &lt;code&gt;blob_gas_used&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; fields, and we add new fields, all of the &lt;code&gt;[int, int, int]&lt;&#x2F;code&gt; type: &lt;code&gt;gas_limits&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;, &lt;code&gt;excess_gas&lt;&#x2F;code&gt;. The resulting RLP encoding becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limits,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We define:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;get_block_gas_targets(parent: Header) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [limit &#x2F;&#x2F; target_ratio for limit, target_ratio in zip(parent.gas_limits, LIMIT_TARGET_RATIOS)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We calculate the required &lt;code&gt;excess_gas&lt;&#x2F;code&gt; values as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calc_excess_gas(parent: Header) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return vector_subtract_clamp_at_zero(vector_add(parent_excess, parent_used), get_block_gas_targets(parent))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We calculate the required &lt;code&gt;gas_limits&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_limits[0]&lt;&#x2F;code&gt; must follow the existing adjustment formula&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[1]&lt;&#x2F;code&gt; must equal &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limits[2]&lt;&#x2F;code&gt; must equal &lt;code&gt;gas_limits[0] &#x2F;&#x2F; CALLDATA_GAS_LIMIT_RATIO&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Now, we define &lt;code&gt;get_block_basefees&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_block_basefees(parent: Header) -&amp;gt; [int, int, int]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fake_exponential(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            MIN_BASE_FEE_PER_GAS,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            excess_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            target * BASE_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (excess_gas, target) in zip(parent.excess_gas, get_block_gas_targets(parent))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conversion-of-all-gas-related-mechanics-into-vectors&quot;&gt;Conversion of all gas-related mechanics into vectors&lt;&#x2F;h3&gt;
&lt;p&gt;This allows the same logic that is used for handling gas to handle all three types of gas. As a result, it&#x27;s arguably a net simplification of protocol gas handling logic, despite the fact that the total number of gas types increases from 2 to 3&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-ratios&quot;&gt;Target ratios&lt;&#x2F;h3&gt;
&lt;p&gt;The target ratios for execution gas and blobs are set to 2; the target ratio for calldata is set to 4. This greatly decreases the number of scenarios in which calldata actually hits the limit, which mitigates economic impact of the EIP, because analysis of EIP-1559-style fee markets is much simpler in &quot;under-the-limit&quot; conditions than in &quot;at-the-limit&quot; conditions. Additionally, it reduces the risk that applications requiring large calldata will outright stop working.&lt;&#x2F;p&gt;
&lt;p&gt;The current parameters set the target calldata per block to 187,500 bytes, about 2x the current average. Using basic supply-and-demand reasoning, this implies that calldata is likely to become significantly cheaper as a result of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Previous transaction types set the calldata basefee and priority fee to equal each other. The calldata gas costs were intentionally set to be identical to today, and the gas target similar to present-day usage, so that setting the two fees to be equal each other is a reasonable approximation to optimal behavior. In practice, the new transaction type would be superior, so we expect users to switch to it over time. However, the loss suffered by old-style transaction users would not be that high, because priority fees are generally small compared to basefees, and the amount that a user pays is proportional to the basefee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Optimal block building behavior becomes more complex as a result of this EIP, particularly under the boundary conditions when blocks are full of one or both types of gas. We argue that the effects of this are not too large, because in practice over 90% of blocks are under-full, and naive &quot;greedy algorithms&quot; can get a close-enough-to-optimal outcome. The centralization risks of proprietary block-building algorithms are thus likely to be much smaller than other existing risks with eg. MEV extraction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Incentivize Access List Provisioning</title>
        <published>2024-05-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Oleg Iakushkin</name><uri>https://github.com/OlegJakushkin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7707/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7707-align-incentives-for-access-list-provisioning/20025" />
        

        <id>https://wg-eips.ritovision.com/7707/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7707"
            label="EIP-7707" />
        

        
        

        
        <summary type="html">This EIP proposes updating gas cost parameters for access lists to incentivise their use and improve transaction execution efficiency.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7707/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP reduces the gas cost of access list data, incentivizing the inclusion of complete and valid access lists in transactions to improve data load efficiency for execution layer clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; introduced &lt;code&gt;accessLists&lt;&#x2F;code&gt; as a mechanism for &lt;code&gt;SLOAD&lt;&#x2F;code&gt;
pre-warming  to reduce gas costs by informing the EVM upfront about which storage slots a transaction will access,
the practical use is limited and uncommon due to the savings versus penalties involved. In order to break even for
each address included &lt;code&gt;24 storage keys&lt;&#x2F;code&gt; are required per address, and there is a &lt;code&gt;100 gas&lt;&#x2F;code&gt; saving per key at &lt;code&gt;25+&lt;&#x2F;code&gt;;
in contrast the penalty for including an unused key is &lt;code&gt;1900 gas&lt;&#x2F;code&gt;, so break-even where one key is unused is &lt;code&gt;43 keys&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This situation makes the break-even and risk-reward ratio of  &lt;code&gt;accessLists&lt;&#x2F;code&gt; rarely appealing in practice for regular
transactions, where a prior transaction could lead to a different branch being taken and a slightly different set of
storage slots being accessed. Furthermore, a very high number of SLOADs is required to start breaking even.&lt;&#x2F;p&gt;
&lt;p&gt;For some clients, data loading takes &lt;code&gt;&amp;gt;70%&lt;&#x2F;code&gt; of block execution time. This
happens in part due to sequential transaction execution and iterative
search of effectively random access data.&lt;&#x2F;p&gt;
&lt;p&gt;While NVMe drives have massive throughput and IOPS; this is their
concurrent throughput operated through multiple queues and they do not
have this performance if data is accessed completely sequentially with
one request waiting for the prior to complete i.e. stacking individual
IOPS latency end to end will not give anything close to maximal
throughput that these drives can deliver (which is different from the
HDD world where heads needed to seek to different physical locations for
each read). This is a similar situation with network attached storage or
cloud data disks; however the latency here is even more amplified than a
local direct CPU attached NVMe drive (i.e. via network card).&lt;&#x2F;p&gt;
&lt;p&gt;If nodes had a somewhat clearer picture of what data to pre-load for the
block&#x27;s execution; that can be done in parallel, hiding much of the
latency from accessing that data when discovered from executing the
transaction. Very much in a similar way to instruction pipelining on a
CPU hiding memory access latencies; the data access for transactions
could be pipelined. This can lead to faster&#x2F;cheaper block execution and
would facilitate data dependency hints for parallel Tx execution in the
future, like on other emerging chains that were developed with more
modern hardware in mind.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We shall update &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;
parameters:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As stated in the introduction the gas cost benefit analysis does not
encourage the users of the chain to provide accessList hints, even
though the mechanism is already in protocol (and a call to
&lt;code&gt;eth_createAccessList&lt;&#x2F;code&gt; will give them, or a wallet the correct list
to include). So we propose a reduction in the pricing of those data
access lists to make them more inline with calldata.&lt;&#x2F;p&gt;
&lt;p&gt;Levelling the playing field between small &lt;code&gt;call_data&lt;&#x2F;code&gt; and &lt;code&gt;access_lists&lt;&#x2F;code&gt;
costs, (and incentivise &lt;code&gt;access_lists&lt;&#x2F;code&gt; provisioning from transaction
senders as they are needed for transaction execution in a faster
manner), the price model updates would look as follows:&lt;&#x2F;p&gt;
&lt;p&gt;Use &lt;code&gt;STANDARD_TOKEN_COST * tokens_in_access_lists&lt;&#x2F;code&gt;, where
&lt;code&gt;tokens_in_access_lists = bytes_in_access_lists * 4&lt;&#x2F;code&gt;, making it as
expensive to send as plain small call data. So we will get:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;32*4*4  = 512&lt;&#x2F;code&gt; for addresses (instead of 2400, 4.6 times less)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;20*4*4  = 320&lt;&#x2F;code&gt; for storage keys (instead of 1900, 5.9 times less)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This means users pay for on-chain data inclusion as usual &lt;code&gt;call_data&lt;&#x2F;code&gt;. It
changes the original
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; logic
of &quot;covering the bandwidth costs&quot;, which was not described in detail and
is potentially outdated.&lt;&#x2F;p&gt;
&lt;p&gt;It should be noted that this is not the first time &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; additions have been proposed. In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3521&#x2F;&quot;&gt;EIP-3521&lt;&#x2F;a&gt;, a reduction was already proposed, but it focused only on &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;Current&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Inst&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Access List&lt;&#x2F;th&gt;&lt;th&gt;Keys for address&lt;&#x2F;th&gt;&lt;th&gt;OP Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Key Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Address Price&lt;&#x2F;th&gt;&lt;th&gt;Total gas per OP&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;2400&lt;&#x2F;td&gt;&lt;td&gt;4400&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;2400&lt;&#x2F;td&gt;&lt;td&gt;4300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;240&lt;&#x2F;td&gt;&lt;td&gt;2240&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;240&lt;&#x2F;td&gt;&lt;td&gt;2140&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;td&gt;2048&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;td&gt;1948&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Proposed&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Inst&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Access List&lt;&#x2F;th&gt;&lt;th&gt;Keys for address&lt;&#x2F;th&gt;&lt;th&gt;OP Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Key Price&lt;&#x2F;th&gt;&lt;th&gt;AccessList Address Price&lt;&#x2F;th&gt;&lt;th&gt;Total gas per OP&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Not included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Warm&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;-&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;932&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;832&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;51.2&lt;&#x2F;td&gt;&lt;td&gt;471&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;51.2&lt;&#x2F;td&gt;&lt;td&gt;371&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cold&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;10.24&lt;&#x2F;td&gt;&lt;td&gt;430&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;None&lt;&#x2F;td&gt;&lt;td&gt;Included&lt;&#x2F;td&gt;&lt;td&gt;50&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;10.24&lt;&#x2F;td&gt;&lt;td&gt;330&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;Already paid on making warm&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP makes a minor update to
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; with
respect to modern execution challenges and capabilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Same as per
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>NONREENTRANT and REENTRANT opcodes</title>
        <published>2024-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7705/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7705-nonreentrant-opcodes/19957" />
        

        <id>https://wg-eips.ritovision.com/7705/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7705"
            label="EIP-7705" />
        

        
        

        
        <summary type="html">Opcodes to mark a contract as nonreentrant</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7705/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add two opcodes, &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt;, which set and clear a contract&#x27;s reentrancy status. After invoking &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt;, a contract cannot be &lt;code&gt;CALL&lt;&#x2F;code&gt;ed (or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;ed, or &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;ed) until &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; is invoked.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Reentrancy attacks account for a substantial portion of user funds stolen on EVM chains, including the famous &quot;DAO hack&quot;. However, due to the cost of preventing reentrancy attacks in application code, developers often opt-out of reentrancy protection. This cost has come down with the advent of transient storage (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;), but it is still not cheap enough where it is a &quot;no-brainer&quot; to use it by default. This EIP proposes opcodes which make it cheaper to protect against reentrancy in application code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Two new opcodes are introduced, &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; (0xF6) and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; (0xF7), which set and clear a contract&#x27;s nonreentrancy flag. The effect of invoking &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; is that a contract can no longer have execution context transferred to it (via any of the &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes), until &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; is invoked. &lt;code&gt;CALL&lt;&#x2F;code&gt;ing a contract which has the nonreentrancy flag set is equivalent to executing a single &lt;code&gt;REVERT&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;p&gt;Both &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; are idempotent; that is, invoking &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; when a contract already has nonreentrant status is a no-op, and likewise for &lt;code&gt;REENTRANT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The scope of the nonreentrant flag is limited to the current transaction. That is, nonreentrant flags are cleared at the end of every transaction. In the presence of reversion (&lt;code&gt;REVERT&lt;&#x2F;code&gt; or exceptional halt), the contract&#x27;s nonreentrancy flag reverts to whatever its value was before the call.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt; and &lt;code&gt;REENTRANT&lt;&#x2F;code&gt; are both set at 5 (&lt;code&gt;G_mid&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The computational cost of pushing the current value to the call stack (for handling reverts) is accounted for in the overhead cost of the &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative design could be considered which only introduces one opcode. This opcode, &lt;code&gt;NONREENTRANT&lt;&#x2F;code&gt;, would take a single stack item and set the nonreentrancy flag based on its value. This alternative design can be considered based on feedback.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Set Code for EOAs</title>
        <published>2024-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7702/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-set-eoa-account-code-for-one-transaction/19923" />
        

        <id>https://wg-eips.ritovision.com/7702/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7702"
            label="EIP-7702" />
        

        
        

        
        <summary type="html">Add a new tx type that permanently sets the code for an EOA</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7702/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type that allows Externally
Owned Accounts (EOAs) to set the code in their account. This is done by
attaching a list of authorization tuples -- individually formatted as &lt;code&gt;[chain_id, address, nonce, y_parity, r, s]&lt;&#x2F;code&gt; -- to the transaction. For each tuple, a
delegation indicator &lt;code&gt;(0xef0100 || address)&lt;&#x2F;code&gt; is written to the authorizing
account&#x27;s code. All code executing operations must load and execute the code
pointed to by the delegation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Despite great advances in the smart contract wallet ecosystem, EOAs have held
back broad adoption of UX improvements across applications. This EIP therefore
focuses on adding short-term functionality improvements to EOAs which will allow
UX improvements to permeate through the entire application stack. Three
particular features this EIP is designed around are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Batching&lt;&#x2F;strong&gt;: allowing multiple operations from the same user in one atomic
transaction. One common example is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approval followed by
spending that approval. This is a common workflow in DEXes that requires two
transactions today. Advanced use cases of batching occasionally involve
dependencies: the output of the first operation is part of the input to the
second operation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Sponsorship&lt;&#x2F;strong&gt;: account X pays for a transaction on behalf of account Y.
Account X could be paid in some other ERC-20 for this service, or it could be an
application operator including the transactions of its users for free.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Privilege de-escalation&lt;&#x2F;strong&gt;: users can sign sub-keys and give them specific
permissions that are much weaker than global access to the account. For example,
a permission to spend ERC-20 tokens but not ETH, or to spend up to 1% of the
total balance per day, or to interact only with a specific application.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SET_CODE_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAGIC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x05&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;12500&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PER_EMPTY_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;25000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;set-code-transaction&quot;&gt;Set code transaction&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction known as the &quot;set code transaction&quot;
is introduced, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;SET_CODE_TX_TYPE&lt;&#x2F;code&gt; and the
&lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;destination, value, data, access_list, authorization_list, signature_y_parity,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The fields &lt;code&gt;chain_id&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;,
&lt;code&gt;gas_limit&lt;&#x2F;code&gt;, &lt;code&gt;destination&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and &lt;code&gt;access_list&lt;&#x2F;code&gt; of the outer
transaction follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;. &lt;em&gt;Note, this
implies a null destination is not valid.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction
represent a secp256k1 signature over &lt;code&gt;keccak256(SET_CODE_TX_TYPE || TransactionPayload)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;authorization_list&lt;&#x2F;code&gt; is a list of tuples that indicate what code the signer
of each tuple desires to execute in the context of their EOA. The transaction is
considered invalid if the length of &lt;code&gt;authorization_list&lt;&#x2F;code&gt; is zero.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction is also considered invalid when any field in an authorization
tuple cannot fit within the following bounds:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;y_parity&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is
&lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;The authorization list is processed before the execution portion of the
transaction begins, but after the sender&#x27;s nonce is incremented.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;[chain_id, address, nonce, y_parity, r, s]&lt;&#x2F;code&gt; tuple, perform the
following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Verify the chain ID is 0 or the ID of the current chain.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the &lt;code&gt;nonce&lt;&#x2F;code&gt; is less than &lt;code&gt;2**64 - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;authority = ecrecover(msg, y_parity, r, s)&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;Where &lt;code&gt;msg = keccak(MAGIC || rlp([chain_id, address, nonce]))&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Verify &lt;code&gt;s&lt;&#x2F;code&gt; is less than or equal to &lt;code&gt;secp256k1n&#x2F;2&lt;&#x2F;code&gt;, as specified in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;EIP-2&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;authority&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the code of &lt;code&gt;authority&lt;&#x2F;code&gt; is empty or already delegated.&lt;&#x2F;li&gt;
&lt;li&gt;Verify the nonce of &lt;code&gt;authority&lt;&#x2F;code&gt; is equal to &lt;code&gt;nonce&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST&lt;&#x2F;code&gt; gas to the global refund
counter if &lt;code&gt;authority&lt;&#x2F;code&gt; is not empty.&lt;&#x2F;li&gt;
&lt;li&gt;Set the code of &lt;code&gt;authority&lt;&#x2F;code&gt; to be &lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;. This is a delegation
indicator.
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;address&lt;&#x2F;code&gt; is &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;, do not write
the delegation indicator. Clear the account&#x27;s code by resetting the account&#x27;s
code hash to the empty code hash
&lt;code&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Increase the nonce of &lt;code&gt;authority&lt;&#x2F;code&gt; by one.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If any step above fails, immediately stop processing the tuple and continue to
the next tuple in the list. When multiple tuples from the same authority are
present, set the code using the address in the last valid occurrence.&lt;&#x2F;p&gt;
&lt;p&gt;Note, if transaction execution results in failure (e.g. any exceptional
condition or code reverting), the processed delegation indicators is &lt;em&gt;not rolled
back&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;delegation-indicator&quot;&gt;Delegation indicator&lt;&#x2F;h5&gt;
&lt;p&gt;Delegation indicators use the banned opcode &lt;code&gt;0xef&lt;&#x2F;code&gt;, defined in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;, to indicate that the code must be handled differently
than regular code. The delegation forces all code executing operations to follow
the address pointer to obtain the code to execute. For example, &lt;code&gt;CALL&lt;&#x2F;code&gt; loads the
code at &lt;code&gt;address&lt;&#x2F;code&gt; and executes it in the context of &lt;code&gt;authority&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The affected executing operations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;any transaction where &lt;code&gt;destination&lt;&#x2F;code&gt; points to an address with a delegation
indicator present&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For code reading, only &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; instructions are affected. They
operate directly on the executing code instead of the delegation. For example,
when executing a delegated account &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; returns &lt;code&gt;23&lt;&#x2F;code&gt; (the size of
&lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;) whereas &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; returns the size of the code residing
at &lt;code&gt;address&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note, this means during delegated execution &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; produce a
different result compared to calling &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; on the
authority.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h6 id=&quot;precompiles&quot;&gt;Precompiles&lt;&#x2F;h6&gt;
&lt;p&gt;When a precompile address is the target of a delegation, the retrieved code is
considered empty and &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;
instructions targeting this account will execute empty code, and therefore
succeed with no execution when given enough gas to initiate the call.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;loops&quot;&gt;Loops&lt;&#x2F;h6&gt;
&lt;p&gt;In case a delegation indicator points to another delegation, creating a
potential chain or loop of delegations, clients must retrieve only the first
code and then stop following the delegation chain.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-costs&quot;&gt;Gas Costs&lt;&#x2F;h4&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;. Additionally, add a cost of &lt;code&gt;PER_EMPTY_ACCOUNT_COST * authorization list length&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction sender will pay for all authorization tuples, regardless of
validity or duplication.&lt;&#x2F;p&gt;
&lt;p&gt;If a code executing instruction accesses a cold account during the resolution of
delegated code, add an additional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;
&lt;code&gt;COLD_ACCOUNT_READ_COST&lt;&#x2F;code&gt; cost of &lt;code&gt;2600&lt;&#x2F;code&gt; gas to the normal cost and add the
account to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. Otherwise, assess a &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;
cost of &lt;code&gt;100&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-origination&quot;&gt;Transaction origination&lt;&#x2F;h4&gt;
&lt;p&gt;Modify the restriction put in place by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt; to allow EOAs
whose code is a valid delegation indicator, i.e. &lt;code&gt;0xef0100 || address&lt;&#x2F;code&gt;, to
originate transactions. Accounts with any other code values may not originate
transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, if a transaction&#x27;s &lt;code&gt;destination&lt;&#x2F;code&gt; has a delegation indicator, add
the target of the delegation to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Below is the rationale for both general design directions of the EIP, as well as
specific technical choices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;general-design-philosophy&quot;&gt;General design philosophy&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;persistence-of-code-delegation&quot;&gt;Persistence of code delegation&lt;&#x2F;h4&gt;
&lt;p&gt;The first draft of this proposal had a clever idea to avoid disagreement on
whether in-protocol revocation was needed or not. The idea was to temporarily
set code in the account with the authorization. After the transaction finished,
the code would be completely cleared. This was a new design space for enriching
EOA functionality.&lt;&#x2F;p&gt;
&lt;p&gt;Even this approach was not without its flaws. Fundamentally, there was not much
friction for users including set code authorizations. This meant that some users
and applications would opt to treat the extension as more of a scripting
facility, rather than a full-fledged upgrade to a smart contract wallet. The
outcome of this would be two somewhat competing workstreams for UX improvements:
smart contract wallets and EOA scripts.&lt;&#x2F;p&gt;
&lt;p&gt;Previous proposals had been met with similar criticisms. To counteract this,
persistent delegations were introduced. They create enough friction in
deployment that users will not deploy new, unique ones regularly. This will
hopefully unify the workstreams and minimize fragmentation in UX developments.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;no-initcode&quot;&gt;No initcode&lt;&#x2F;h4&gt;
&lt;p&gt;Running initcode is not desirable for many reasons. It creates a new mode of
execution that needs extensive testing, and may be used for purposes not
possible with standard smart contract wallets. It also forces developers to
perform initialization as a standard call to the EOA after delegation. The lack
of atomicity in these operations is another factor that will push users to
complete smart contract wallet solutions, instead of EOA scripts.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, initcode tends to be propagated inside the transaction calldata.
This means it would need to be included in the authorization tuple and signed
over. The minimum initcode is around 15 bytes -- it would simply copy the
contract code from an external address. The total cost would be &lt;code&gt;16 * 15 = 240&lt;&#x2F;code&gt;
calldata cost, plus the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; cost of &lt;code&gt;2 * 15 = 30&lt;&#x2F;code&gt;, plus
the runtime costs of around &lt;code&gt;150&lt;&#x2F;code&gt;. So nearly &lt;code&gt;500&lt;&#x2F;code&gt; additional gas would be spent
preparing the account. Even more likely, 1200+ gas if not copying from an
external account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;creation-by-template&quot;&gt;Creation by template&lt;&#x2F;h4&gt;
&lt;p&gt;Initcode or not, there is a question of how users should specify the code they
intend to run in their account. The two main options are to specify the bytecode
directly in the transaction or to specify a pointer to the code. The simplest
pointer would just be the address of code deployed on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;The cost analysis makes the answer clear. The smallest proxy would be around 50
bytes and an address is 20 bytes. The 30 byte difference provides no useful
additional functionality and will be inefficiently replicated billions of times.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, specifying code directly would again make it possible for EOAs to
have a new, unique ability to execute arbitrary code specified in the
transaction calldata. It is for these reasons that creation by template is
chosen.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;interaction-with-applications-and-wallets&quot;&gt;Interaction with applications and wallets&lt;&#x2F;h4&gt;
&lt;p&gt;While this EIP provides a lot of flexibility to applications and EOAs, there are
incorrect ways of using it. Applications &lt;strong&gt;must not&lt;&#x2F;strong&gt; expect that they can
suggest the user sign an authorization, and therefore it is the duty of the
wallet to not provide an interface to do so.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;There is no safe way to provide this interface&lt;&#x2F;strong&gt;. The code specified by an
authorization has unrestricted access to the account and must always be closely
audited by the wallet. Few users have the level of sophistication to reasonably
verify the code they are delegating to.&lt;&#x2F;p&gt;
&lt;p&gt;It is also not possible to implement a system of permissions at this level to
minimize the risk. If applications require custom wallet functionality, they
must use standardized extension &#x2F; module systems built on top of the delegated
code that correctly implements permissions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;forward-compatibility-with-future-account-abstraction&quot;&gt;Forward-compatibility with future account abstraction&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP is designed to be forward-compatible with endgame account abstraction,
without over-enshrining any fine-grained details of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; or
RIP-7560.&lt;&#x2F;p&gt;
&lt;p&gt;To start, the &lt;code&gt;address&lt;&#x2F;code&gt; that users sign could directly point to existing
ERC-4337 wallet code. This essentially requires the &quot;code pathways&quot; that are
used are code pathways that would, in most cases, continue to make sense in a
pure-smart-contract-wallet world. Hence, it avoids the problem of creating two
separate UX workstreams because, to a large extent, they would be the same
ecosystem.&lt;&#x2F;p&gt;
&lt;p&gt;There will be some workflows that require kludges under this solution that would
be better done in some different &quot;more native&quot; under &quot;endgame AA&quot;, but this is
relatively a small subset. The EIP does not require adding any opcodes, that
would become dangling and useless in a post-EOA world, and it allows EOAs to
masquerade as contracts to be included in ERC-4337 bundles, in a way that&#x27;s
compatible with the existing &lt;code&gt;EntryPoint&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;self-sponsoring-allowing-tx-origin-to-set-code&quot;&gt;Self-sponsoring: allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to set code&lt;&#x2F;h4&gt;
&lt;p&gt;Allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to set code and execute its own delegated code enables what
is called self-sponsoring. It allows users to take advantage of EIP-7702 without
relying on any third party infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;However, that means the EIP breaks the invariant that &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt;
only happens in the topmost execution frame of a transaction. This will affect
smart contracts containing &lt;code&gt;require(msg.sender == tx.origin)&lt;&#x2F;code&gt; style checks. This
check is used for at least three purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensuring that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA (given that &lt;code&gt;tx.origin&lt;&#x2F;code&gt; always has to be
an EOA). This invariant does not depend on the execution layer depth and,
therefore, is not affected.&lt;&#x2F;li&gt;
&lt;li&gt;Protecting against atomic sandwich attacks like flash loans, which rely on
the ability to modify state before and after the execution of the target
contract as part of the same atomic transaction. This protection would be broken
by this EIP. However, relying on &lt;code&gt;tx.origin&lt;&#x2F;code&gt; in this way is considered bad
practice, and can already be circumvented by miners conditionally including
transactions in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Preventing reentrancy.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Examples of (1) and (2) can be found in contracts deployed on Ethereum mainnet,
with (1) being more common (and unaffected by this proposal). On the other hand,
use case (3) is more severely affected by this proposal, but the authors of this
EIP did not find any examples of this form of reentrancy protection, though the
search was non-exhaustive.&lt;&#x2F;p&gt;
&lt;p&gt;This distribution of occurrences—many (1), some (2), and no (3)—is exactly what
the authors of this EIP expect because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Determining if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA without &lt;code&gt;tx.origin&lt;&#x2F;code&gt; is difficult, if not
impossible.&lt;&#x2F;li&gt;
&lt;li&gt;The only execution context which is safe from atomic sandwich attacks is the
topmost context, and &lt;code&gt;tx.origin == msg.sender&lt;&#x2F;code&gt; is the only way to detect that
context.&lt;&#x2F;li&gt;
&lt;li&gt;In contrast, there are many direct and flexible ways of preventing reentrancy
(e.g., using a transient storage variable). Since &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt; is
only true in the topmost context, it would make an obscure tool for preventing
reentrancy, rather than other more common approaches.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are other approaches to mitigate this restriction which do not break the
invariant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a constant &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt; address when using the &lt;code&gt;CALL*&lt;&#x2F;code&gt;
instruction in the context of an EOA.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a special address derived from the sender or signer
addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Disallow &lt;code&gt;tx.origin&lt;&#x2F;code&gt; from setting code. This would make the simple batching
use cases impossible, but could be relaxed in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale-for-technical-details&quot;&gt;Rationale for technical details&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;cost-of-delegation&quot;&gt;Cost of delegation&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;PER_AUTH_BASE_COST&lt;&#x2F;code&gt; is the cost to process the authorization tuple and set
the delegation destination. To compute a fair cost for this operation, the
authors review its impact on the system:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ferry 101 bytes of calldata = &lt;code&gt;101 * non-zero cost (16) = 1616&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;recovering the &lt;code&gt;authority&lt;&#x2F;code&gt; address = &lt;code&gt;3000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;reading the nonce and code of &lt;code&gt;authority&lt;&#x2F;code&gt; = &lt;code&gt;2600&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;storing values in already warm account = &lt;code&gt;200&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;cost to deploy code = &lt;code&gt;200 * 23 = 4600&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The impact-based assessment identifies &lt;code&gt;12016&lt;&#x2F;code&gt; gas of comparable computation for
the operation. It is rounded up to &lt;code&gt;12500&lt;&#x2F;code&gt; to account for miscellaneous costs
associated with shuttling data around the state transition.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;clearing-delegation-indicators&quot;&gt;Clearing delegation indicators&lt;&#x2F;h4&gt;
&lt;p&gt;A general design goal in state transition changes is to minimize the number of
special cases an EIP has. In early iterations, this EIP resisted a special case
for clearing an account&#x27;s delegation indicator.&lt;&#x2F;p&gt;
&lt;p&gt;For most intents and purposes, an account delegated to &lt;code&gt;0x0&lt;&#x2F;code&gt; is
indistinguishable from a true EOA. However, one particular unfortunate case is
unavoidable. Even if a user has a zeroed out delegation indicator, most
operations that interact with that account will incur an additional
&lt;code&gt;COLD_ACCOUNT_READ_COST&lt;&#x2F;code&gt; upon the first touch caused by attempting to load the
code at &lt;code&gt;0x0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason, the authors have opted to include a special case which allow
users to restore their EOA to its original purity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lack-of-instruction-prohibition&quot;&gt;Lack of instruction prohibition&lt;&#x2F;h4&gt;
&lt;p&gt;Consistency is a valuable property in the EVM, both from an implementation
perspective and a user-understanding-perspective. Despite considering bans on
several families of instructions in the context of EOAs, the authors feel there
is not a compelling reason to do so, as it would cause smart contract wallets
and EOA smart contract wallets to proceed down distinct UX workstreams.&lt;&#x2F;p&gt;
&lt;p&gt;The main instruction families where a ban was considered were storage related
and contract creation related. The decision to not ban storage instructions
hinged mostly on their importance to smart contract wallets. Although it&#x27;s
possible to have an external storage contract that the smart contract wallet
calls into, it is unnecessarily complicated and inefficient. In the future, new
state schemes may allow substantially cheaper access to certain storage slots
within an account. This is something smart contract wallets will want to take
advantage of that a storage contract wouldn&#x27;t support.&lt;&#x2F;p&gt;
&lt;p&gt;Creation instructions were considered for a ban as well on other similar EIPs,
however because this EIP allows EOAs to spend value intra-transaction, the
concern with bumping the nonce intra-transaction and invalidating pending
transactions is not significant.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;protection-from-malleability-cross-chain&quot;&gt;Protection from malleability cross-chain&lt;&#x2F;h4&gt;
&lt;p&gt;One consideration when signing a code pointer is what code that address points
to on another chain. While it is possible to create a deterministic deployment,
i.e. via Nick&#x27;s method, verifying such a deployment may not always be desirable.
In such situations, the chain ID can be set to reduce the scope of the
authorization. When universal deployment is preferred, simply set chain ID to 0.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative to adding chain ID could be to substitute in the actual code for
the address in the signature. This seems to have the benefit of both minimizing
the on-chain size of auth tuples, by continuing to serialize only the address,
while retaining specificity of the actual code running in the account, by
pulling in the code for the signature. One unfortunate issue of this format,
though, is that it imposes a database lookup to determine the signer of each
auth tuple. This imposition itself seems to create enough complexity in
transaction propagation that it is decided to avoid and simply sign over the
address directly.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;delegation-of-code-execution-only&quot;&gt;Delegation of code execution only&lt;&#x2F;h4&gt;
&lt;p&gt;Other code retrieving operations like &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; do not automatically follow
delegations, they operate on the delegation indicator itself. If instead
delegations were followed, an account would be able to temporarily masquerade as
having a particular codehash, which would break contracts that rely on
codehashes as a definition of possible account behavior. A change of behavior in
a contract is currently only possible if its code explicitly allows it (in
particular via &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), and a change of codehash is only possible in the
presence of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (which, as of Cancun, only applies in the same
transaction as contract creation), so choosing to follow delegations in
&lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; opcodes would have created a new type of account breaking prior
assumptions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;charge-maximum-cost-upfront&quot;&gt;Charge maximum cost upfront&lt;&#x2F;h4&gt;
&lt;p&gt;While computing the intrinsic gas cost, the transaction is charged the
worst-case cost for each delegation. Later, while processing the authorization
list, a refund is issued if the account already exists in state. This mechanism
is designed to avoid state lookups for each authorization when computing the
intrinsic gas and can quickly determine the validity of the transaction with
only a state lookup on the sender&#x27;s account.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;no-blobs-no-contract-creation&quot;&gt;No blobs, no contract creation&lt;&#x2F;h4&gt;
&lt;p&gt;Transactions should be thought of as specialized tools and not necessarily a
one-type-does-all solution. EIP-4844 is treated differently at the p2p level due
to burden blobs place on a node&#x27;s bandwidth. EIP-7702 has different implications
on transaction gossiping and there is no need to complicate those rules
unnecessarily by making it a superset of all possible functionality. The authors
ultimately do not expect there to be much demand for atomic delegation and blob
submission.&lt;&#x2F;p&gt;
&lt;p&gt;Contract creation is another specialized use case that has been grandfathered
into several transaction types. It adds complexity to testing, because it is a
new distinct branch of execution that needs to be tested when any change to the
EVM occurs and verify the change works as expected in that context.&lt;&#x2F;p&gt;
&lt;p&gt;For these reasons, the authors have chosen to keep the scope of the EIP focused
on improving UX.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;disallow-delegation-to-precompiles&quot;&gt;Disallow delegation to precompiles&lt;&#x2F;h4&gt;
&lt;p&gt;Precompiles are themselves edge cases, so allowing delegations to precompiles or
not requires some focus in implementation. Considering the fact that precompiles
technically do not have code associated with their accounts, the authors decided
it would be marginally simpler to not execute the precompile logic when a user
delegates to one. This is somewhat unintuitive.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;non-empty-authorization-list-required&quot;&gt;Non-empty authorization list required&lt;&#x2F;h4&gt;
&lt;p&gt;Set code transactions are required to have at least one authorization to be
considered valid. This is to disincentivize senders from using type 4
transactions as a generic transaction format, because this transaction has
different implications on the transaction pool than, say,
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP breaks a few invariants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An account balance can only decrease as a result of a transaction originating
from that account.
&lt;ul&gt;
&lt;li&gt;Once an account has been delegated, any call to the account may also cause
the balance to decrease.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;An EOA nonce may not increase after transaction execution has begun.
&lt;ul&gt;
&lt;li&gt;Once an account has been delegated, the account may call a create operation
during execution, causing the nonce to increase.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;tx.origin == msg.sender&lt;&#x2F;code&gt; can only be true in the topmost frame of execution.
&lt;ul&gt;
&lt;li&gt;Once an account has been delegated, it can invoke multiple calls per
transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;implementation-of-secure-delegate-contracts&quot;&gt;Implementation of secure delegate contracts&lt;&#x2F;h3&gt;
&lt;p&gt;The following is a non-exhaustive list of pitfalls that delegate contracts
&lt;em&gt;should&lt;&#x2F;em&gt; be wary of and require a signature over from the account&#x27;s authority:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Replay protection (e.g., a nonce) should be implemented by the delegate and
signed over. Without it, a malicious actor can reuse a signature, repeating its
effects.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; -- without it, a malicious sponsor could cause unexpected effects in
the callee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt; -- without it, a malicious sponsor could cause the callee to run out of
gas and fail, griefing the sponsee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;calldata&lt;&#x2F;code&gt; -- without them, a malicious actor may call arbitrary
functions in arbitrary contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A poorly implemented delegate can &lt;em&gt;allow a malicious actor to take near complete
control over a signer&#x27;s EOA&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;front-running-initialization&quot;&gt;Front running initialization&lt;&#x2F;h3&gt;
&lt;p&gt;Smart contract wallet developers must consider the implications of setting code
in an account without execution. Contracts are normally deployed by executing
initcode to determine the exact code to be placed in the account. This gives
developers the opportunity to initialize storage slots at the same time. The
initial values of the account cannot be replaced by an observer, because they
are either signed over by an EOA in the case of a creation transaction or they
are committed to by computing the contract&#x27;s address deterministically from the
hash of the initcode.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not provide developers the opportunity to run initcode and set
storage slots during delegation. To secure the account from an observer
front-running the initialization of the delegation with an account they control,
smart contract wallet developers must verify the initial calldata to the account
for setup purposes be signed by the EOA&#x27;s key using ecrecover. This ensures the
account can only be initialized with desirable values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-management&quot;&gt;Storage management&lt;&#x2F;h3&gt;
&lt;p&gt;Changing an account&#x27;s delegation is a security-critical operation that should
not be done lightly, especially if the newly delegated code is not purposely
designed and tested as an upgrade to the old one.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, in order to ensure a safe migration of an account from one
delegate contract to another, it&#x27;s important for these contracts to use storage
in a way that avoids accidental collisions among them. For example, using
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7201&#x2F;&quot;&gt;ERC-7201&lt;&#x2F;a&gt; a contract may root its storage layout at a slot
dependent on a unique identifier. To simplify this, smart contract languages may
provide a way of re-rooting the entire storage layout of existing contract
source code.&lt;&#x2F;p&gt;
&lt;p&gt;If all contracts previously delegated to by the account used the approach
described above, a migration should not cause any issues. However, if there is
any doubt, it is recommended to first clear all account storage, an operation
that is not natively offered by the protocol but that a special-purpose delegate
contract can be designed to implement.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setting-code-as-tx-origin&quot;&gt;Setting code as &lt;code&gt;tx.origin&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing the sender of an EIP-7702 to also set code has the possibility to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Break atomic sandwich protections which rely on &lt;code&gt;tx.origin&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Break reentrancy guards of the style &lt;code&gt;require(tx.origin == msg.sender)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The authors of this EIP believe the risks of allowing this are acceptable for
the reasons outlined in the Rationale section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sponsored-transaction-relayers&quot;&gt;Sponsored transaction relayers&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible for the &lt;code&gt;authorized&lt;&#x2F;code&gt; account to cause sponsored transaction
relayers to spend gas without being reimbursed by either invalidating the
authorization (i.e., increasing the account&#x27;s nonce) or by sweeping the relevant
assets out of the account. Relayers should be designed with these cases in mind,
possibly by requiring a bond to be deposited or by implementing a reputation
system.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-propagation&quot;&gt;Transaction propagation&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing EOAs to behave as smart contracts via the delegation indicator poses
some challenges for transaction propagation. Traditionally, EOAs have only been
able to send value via a transaction. This invariant allows nodes to statically
determine the validity of transactions for that account. In other words, a
single transaction has only been able to invalidate transactions pending from
the sender&#x27;s account.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, it becomes possible to cause transactions from other accounts to
become stale. This is due to the fact that once an EOA has delegated to code,
that code can be called by anyone at any point in a transaction. It becomes
impossible to know if the balance of the account has been swept in a static
manner.&lt;&#x2F;p&gt;
&lt;p&gt;While there are a few mitigations for this, the authors recommend that clients
do not accept more than one pending transaction for any EOA with a non-zero
delegation indicator. This minimizes the number of transactions that can be
invalidated by a single transaction.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative would be to expand the EIP-7702 transaction with a list of
accounts the caller wishes to &quot;hydrate&quot; during the transaction. Those accounts
behave as the delegated code &lt;em&gt;only&lt;&#x2F;em&gt; for EIP-7702 transactions which include them
in such a list, thus returning to clients the ability to statically analyze and
reason about pending transactions.&lt;&#x2F;p&gt;
&lt;p&gt;A related issue is that an EOA&#x27;s nonce may be incremented more than once per
transaction. Because clients already need to be robust in a worse scenario
(described above), it isn&#x27;t a major concern. However, clients should be aware
this behavior is possible and design their transaction propagation accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase calldata cost</title>
        <published>2024-05-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7703/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7703-increase-calldata-cost/19933" />
        

        <id>https://wg-eips.ritovision.com/7703/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7703"
            label="EIP-7703" />
        

        
        

        
        <summary type="html">Increase calldata cost to decrease the maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7703/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An adjustment in the Ethereum calldata cost which reduces the maximum possible block size and allows a higher block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Larger blocks take longer to propagate through the network.
In this way, the maximum potential block size is constraining the block gas limit.
Therefore, in order to safely increase the block gas limit, the calldata gas must be increased.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Increase &lt;code&gt;G_CALLDATAZERO&lt;&#x2F;code&gt; from 4 to 12.&lt;&#x2F;li&gt;
&lt;li&gt;Increase &lt;code&gt;G_CALLDATANONZERO&lt;&#x2F;code&gt; from 16 to 48.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Tripling the gas cost of calldata reduces the maximum possible block size by a factor of three.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Activation can cause some transactions to revert due to the increased gas costs.
Ahead of activation, &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; could be calculated using the new parameters in order to provide results viable for activation, avoiding out-of-gas reverts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security issues have been found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Native Account Abstraction</title>
        <published>2024-05-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7701/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7701-native-account-abstraction/19893" />
        

        <id>https://wg-eips.ritovision.com/7701/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7701"
            label="EIP-7701" />
        

        
        

        
        <summary type="html">Native Account Abstraction protocol, relying on a new transaction type and a family of opcodes</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7701/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We propose splitting the Ethereum transaction scope into multiple steps: validations, execution, and post-operation logic. Transaction validity is determined by the result of the validation steps of a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;We further separate transaction validation for the purposes of authorization and the gas fee payment, allowing one contract to pay gas for a transaction that will be executed from another contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Native Account Abstraction allows custom validation logic of a transaction and custom gas payment logic, opening new use-cases and features for wallets and dApps.&lt;&#x2F;p&gt;
&lt;p&gt;A more detailed motivation for this proposal can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;assets&#x2F;README&#x2F;&quot;&gt;README document&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0x7701)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_SENDER_DEPLOYMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_SENDER_VALIDATION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_PAYMASTER_VALIDATION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_SENDER_EXECUTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ROLE_PAYMASTER_POST_OP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with type &lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt; is introduced.
Transactions of this type are referred to as &quot;AA transactions&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Their payload should be interpreted as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AA_TX_TYPE || rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  chain_id,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  nonce,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender, sender_validation_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  deployer, deployer_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  paymaster, paymaster_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender_execution_data,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  max_priority_fee_per_gas, max_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender_validation_gas, paymaster_validation_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  sender_execution_gas, paymaster_post_op_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  access_list,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  authorization_list&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;current-role-and-accept-role-opcodes&quot;&gt;&lt;code&gt;CURRENT_ROLE&lt;&#x2F;code&gt; and &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;current_context_role&lt;&#x2F;code&gt; is a context variable set by the AA transaction to the current role.
During AA transactions, it is set to the current role in the transaction&#x27;s lifecycle for each top level call.
During non-AA transactions it is always set to &lt;code&gt;ROLE_SENDER_EXECUTION&lt;&#x2F;code&gt;.
It remains unchanged on &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; but is reset to &lt;code&gt;ROLE_SENDER_EXECUTION&lt;&#x2F;code&gt; on &lt;code&gt;CALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;. This behavior resembles &lt;code&gt;msg.sender&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CURRENT_ROLE&lt;&#x2F;code&gt; opcode returns the &lt;code&gt;current_context_role&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode is equivalent to &lt;code&gt;RETURN&lt;&#x2F;code&gt; in the sense that it copies a memory slice, ends execution, and pastes the memory slice onto parent returndata, with a single modification:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It accepts the &lt;code&gt;frame_role&lt;&#x2F;code&gt; as the additional input parameter, and reverts if it differs from the &lt;code&gt;current_context_role&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For each &lt;code&gt;role&lt;&#x2F;code&gt; in the transaction&#x27;s lifecycle, a successful &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; is expected with the &lt;code&gt;frame_role == role&lt;&#x2F;code&gt;.
If any validation frame failed to perform an &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; matching its role, the transaction fails the validity checks and cannot be included.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;txparam-opcodes&quot;&gt;&lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;TXPARAMDLOAD&lt;&#x2F;code&gt;, &lt;code&gt;TXPARAMSIZE&lt;&#x2F;code&gt;, &lt;code&gt;TXPARAMCOPY&lt;&#x2F;code&gt; opcodes follow the pattern of &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; opcode families.&lt;&#x2F;p&gt;
&lt;p&gt;Each &lt;code&gt;TXPARAM*&lt;&#x2F;code&gt; opcode takes an extra stack input value as a first input compared to its &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; equivalent.
The values of this input are as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;n&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Return value&lt;&#x2F;th&gt;&lt;th&gt;Data size&lt;&#x2F;th&gt;&lt;th&gt;Default&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;current transaction type&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x02&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x03&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_validation_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x04&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;deployer&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 or 32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x05&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;deployer_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;empty array&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x06&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0 or 32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address(0)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x07&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;empty array&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x08&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_execution_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0B&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0C&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0D&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_validation_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0E&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster_validation_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x0F&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;sender_execution_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;paymaster_post_op_gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x11&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;access_list&lt;&#x2F;code&gt; hash&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x12&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;authorization_list&lt;&#x2F;code&gt; hash&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xf1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;execution_status&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;See transaction scoped vars in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;#aa-transaction-processing-flow&quot;&gt;processing flow&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xf2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;execution_gas_used&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;See transaction scoped vars in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;#aa-transaction-processing-flow&quot;&gt;processing flow&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0xff&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;tx_hash_for_signature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;Hash of the transaction without the signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;affected-opcodes&quot;&gt;Affected opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;In all top-level frames, the global variables have the following meaning:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode Name&lt;&#x2F;th&gt;&lt;th&gt;Solidity Equivalent&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;msg.sender&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt; address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ORIGIN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;tx.origin&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The transaction &lt;code&gt;sender&lt;&#x2F;code&gt; address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLDATA*&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;msg.data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Empty for all call frames except for the sender execution frame, for which it is set to &lt;code&gt;sender_execution_data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;costs-of-accessing-cold-addresses-for-sender-paymaster-and-deployer&quot;&gt;Costs of accessing cold addresses for Sender, Paymaster, and Deployer&lt;&#x2F;h3&gt;
&lt;p&gt;The Sender address is pre-warmed as part of the &lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When a non-zero address that is not equal to the &lt;code&gt;Sender&lt;&#x2F;code&gt; address, is provided for a &lt;code&gt;Paymaster&lt;&#x2F;code&gt; or a &lt;code&gt;Deployer&lt;&#x2F;code&gt; contract,
an additional &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; cost of &lt;strong&gt;2400 gas&lt;&#x2F;strong&gt; is charged and the address is added to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aa-transaction-processing-flow&quot;&gt;AA transaction processing flow&lt;&#x2F;h3&gt;
&lt;p&gt;We define processing flow for an AA transaction as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def state_transition_function(tx, block, state):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Empty refunds, warm list, execution status and gas used (new), etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state.transaction_scoped_vars = {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas = tx.sender_validation_gas + tx.paymaster_validation_gas + tx.sender_execution_gas + tx.paymaster_post_op_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_price = min(tx.max_fee_per_gas, block.base_fee_per_gas + tx.max_priority_fee_per_gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payer = tx.sender if tx.paymaster is None else tx.paymaster&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    total_max_cost = max_gas * gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balances[payer] -= total_max_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if get_code(tx.sender) is None:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        deployer_result = call(tx.deployer, [], tx.sender_validation_gas_limit, ROLE_SENDER_DEPLOYMENT)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assert deployer_result.accepted_role == ROLE_SENDER_DEPLOYMENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used += deployer_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_result = call(tx.sender, [], tx.sender_validation_gas_limit - gas_used, ROLE_SENDER_VALIDATION)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert sender_result.accepted_role == ROLE_SENDER_VALIDATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used += sender_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.paymaster:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        paymaster_result = call(tx.paymaster, [], tx.paymaster_validation_gas, ROLE_PAYMASTER_VALIDATION)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        assert paymaster_result.accepted_role == ROLE_PAYMASTER_VALIDATION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used += paymaster_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    checkpoint = state.take_snapshot()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sender_execution_result = call(tx.sender, [], tx.sender_execution_gas, ROLE_SENDER_EXECUTION)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used += sender_execution_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state.transaction_scoped_vars[execution_status] = sender_execution_result.output_code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state.transaction_scoped_vars[execution_gas_used] = gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if tx.paymaster:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        postop_result = call(tx.paymaster, [], tx.paymaster_post_op_gas, ROLE_PAYMASTER_POST_OP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_used += postop_result.gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if postop_result.accepted_role != ROLE_PAYMASTER_POST_OP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state.revert_snapshot(checkpoint)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    balances[payer] += gas_price * (max_gas - gas_used)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A full list of rationales for the decisions made in this proposal can be found in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7701&#x2F;assets&#x2F;README&#x2F;&quot;&gt;README document&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As the &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode represent a generic way to authorize any action on behalf of the contract,
correct and secure implementation of this code is critical.
We expect that compilers targeting EVM will play a major role in enabling and ensuring Smart Contract Accounts&#x27; security.&lt;&#x2F;p&gt;
&lt;p&gt;For smart contract security auditors and security-oriented developer tools it is crucial to ensure that contracts not
meant to have roles in AA transactions do not have unexpected &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode.
Otherwise, these contracts may present an immediate security threat.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, block explorers should tag contracts as &quot;user accounts&quot; or &quot;paymasters&quot; if they have the &lt;code&gt;ACCEPT_ROLE&lt;&#x2F;code&gt; opcode used in their source code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Creation transaction</title>
        <published>2024-04-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7698/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7698-eof-creation-transaction/19784" />
        

        <id>https://wg-eips.ritovision.com/7698/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7698"
            label="EIP-7698" />
        

        
        

        
        <summary type="html">Deploy EOF contracts using creation transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7698/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transactions (i.e. the ones with empty &lt;code&gt;to&lt;&#x2F;code&gt;) can be used to deploy EOF contracts by providing EOF initcontainer concatenated with &lt;code&gt;calldata&lt;&#x2F;code&gt; for initcontainer execution in transaction&#x27;s &lt;code&gt;data&lt;&#x2F;code&gt;. Initcontainer execution is similar to its execution during &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction, ending with &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction. New account address calculation is based on sender&#x27;s address and nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transaction is one of the three ways alongside creation instructions provided by legacy EVM to deploy new code. Given that legacy creation instructions (&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;) are not allowed to deploy EOF code, supporting EOF in creation transactions is the only way to get the first EOF on-chain.&lt;&#x2F;p&gt;
&lt;p&gt;The mechanism for providing constructor arguments to initcontainer is exactly the same as for deploying legacy code (just concatenating them with initcontainer), therefore existing deployment tooling can be used as is to deploy EOF.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Wherever not explicitly listed, the rules of EOF contract creation should be identical or analogous to those of legacy creation transaction. This includes but is not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;behavior on &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and address collision (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EVM execution frame created for the initcode - memory, account context etc.&lt;&#x2F;li&gt;
&lt;li&gt;nonce bumping of the account of newly created contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;balance checking and transfer for the creation endowment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EOF_MAGIC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;0xEF00&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;24576&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;In case a creation transaction (transaction with empty &lt;code&gt;to&lt;&#x2F;code&gt;) has &lt;code&gt;data&lt;&#x2F;code&gt; starting with &lt;code&gt;EOF_MAGIC&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt; is interpreted as a concatenation of EOF &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt;. More specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Intrinsic gas cost rules and limits defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; for creation transactions apply. The entire &lt;code&gt;data&lt;&#x2F;code&gt; of the transaction is used for these calculations.&lt;&#x2F;li&gt;
&lt;li&gt;Find the split of &lt;code&gt;data&lt;&#x2F;code&gt; into &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;Parse EOF header&lt;&#x2F;li&gt;
&lt;li&gt;Find &lt;code&gt;intcontainer&lt;&#x2F;code&gt; size by reading all section sizes from the header and adding them up with the header size to get the full container size.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Validate the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and all its subcontainers recursively.
&lt;ul&gt;
&lt;li&gt;Unlike in general validation, &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is additionally required to have &lt;code&gt;data_size&lt;&#x2F;code&gt; declared in the header equal to actual &lt;code&gt;data_section&lt;&#x2F;code&gt; size.&lt;&#x2F;li&gt;
&lt;li&gt;Validation includes checking that the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; does not contain &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If EOF header parsing or full container validation fails, transaction is considered valid and failing. Gas for initcode execution is not consumed, only intrinsic creation transaction costs are charged.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;calldata&lt;&#x2F;code&gt; part of transaction &lt;code&gt;data&lt;&#x2F;code&gt; that follows &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is treated as calldata to pass into the execution frame.&lt;&#x2F;li&gt;
&lt;li&gt;Execute the container and deduct gas for execution.
&lt;ol&gt;
&lt;li&gt;Calculate &lt;code&gt;new_address&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(sender || sender_nonce)[12:]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A successful execution ends with initcode executing &lt;code&gt;RETURNCODE{deploy_container_index}(aux_data_offset, aux_data_size)&lt;&#x2F;code&gt; instruction. After that:
&lt;ul&gt;
&lt;li&gt;load deploy-contract from EOF subcontainer at &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; is executed,&lt;&#x2F;li&gt;
&lt;li&gt;concatenate data section with &lt;code&gt;(aux_data_offset, aux_data_offset + aux_data_size)&lt;&#x2F;code&gt; memory segment and update data size in the header,&lt;&#x2F;li&gt;
&lt;li&gt;let &lt;code&gt;deployed_code_size&lt;&#x2F;code&gt; be updated deploy container size,&lt;&#x2F;li&gt;
&lt;li&gt;if &lt;code&gt;deployed_code_size &amp;gt; MAX_CODE_SIZE&lt;&#x2F;code&gt; instruction exceptionally aborts,&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;state[new_address].code&lt;&#x2F;code&gt; to the updated deploy container (rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;, prohibiting deployment of &lt;code&gt;code&lt;&#x2F;code&gt; starting with &lt;code&gt;EF&lt;&#x2F;code&gt; from creation transactions, do not apply in this case).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Deduct &lt;code&gt;200 * deployed_code_size&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;irregular-state-change-to-deploy-creator-contract&quot;&gt;Irregular state change to deploy Creator Contract&lt;&#x2F;h3&gt;
&lt;p&gt;Originally it was proposed to deploy the first EOF contract via irregular state change. This contract would execute &lt;code&gt;TXCREATE&lt;&#x2F;code&gt; instruction and could be used then as an entry point to deploy any other EOF code. This would also require an introduction of &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt;, required by &lt;code&gt;TXCREATE&lt;&#x2F;code&gt;. It was decided against this variant for the benefit of reduced scope of changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constructor-arguments-outside-of-initcontainer-vs-in-data-section&quot;&gt;Constructor arguments outside of initcontainer vs in data section&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative mechanism for providing constructor arguments to initcontainer execution was considered, where they are concatenated with data section of the initcontainer and are accessed via &lt;code&gt;DATA*&lt;&#x2F;code&gt; instructions instead of &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt;. This has a benefit of not requiring the step finding the split of &lt;code&gt;transaction.data&lt;&#x2F;code&gt; into &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt;, as entire &lt;code&gt;transaction.data&lt;&#x2F;code&gt; is an EOF container. However it was rejected for the following reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Existing tooling could not be used for deploying EOF without modification. To construct EOF creation transaction, the tooling would need to append constructor arguments to the container, as well as update data section size in the EOF header. Compiler could predict the size of constructor arguments to put the anticipated data size in the header, but it would not be possible for variadic length constructor arguments.&lt;&#x2F;li&gt;
&lt;li&gt;In case a specialized EOF creation transaction is introduced in a later upgrade (such as the &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt;), it would have a dedicated field for initcontainer execution input (&lt;code&gt;calldata&lt;&#x2F;code&gt;), and it will be accessed with &lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; instructions in initcode. It is better to avoid the situation where compilers would need to generate initcontainer code differently depending on which context it will be used in.&lt;&#x2F;li&gt;
&lt;li&gt;As a general argument, data section can be seen to contain the data that execution considers validated and being closely coupled with the code definition, whereas calldata is an input from the outside that may be arbitrary and not validated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transactions deploying legacy code are not affected, because any such transaction starting with &lt;code&gt;EF&lt;&#x2F;code&gt; byte previously would fail on executing invalid instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blob throughput increase</title>
        <published>2024-04-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Parithosh Jayanthi</name><uri>https://github.com/parithosh</uri>
	</author>
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Sam Calder-Mason</name><uri>https://github.com/samcm</uri>
	</author>
	
	<author>
		<name>Andrew Davis</name><uri>https://github.com/savid</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7691/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7691-blob-throughput-increase/19694" />
        

        <id>https://wg-eips.ritovision.com/7691/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7691"
            label="EIP-7691" />
        

        
        

        
        <summary type="html">Increase the number of blobs to reach a new target and max of 6 and 9 blobs per block respectively</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7691/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increases the number of blobs in a block to provide more scale to Ethereum via L2 solution that rely on L1 data capacity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum, with its rollup centric roadmap, scales by relying on L2. Since the Dencun fork, the blob gas target and maximum was set to 3&#x2F;6 respectively. The blob gas limit was arrived at based on a series of big block tests performed on the Ethereum mainnet network as well as a series of testnets. The values were chosen cautiously, as it&#x27;s extremely hard to predict the exact p2p behaviour of Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;As we now have the Dencun upgrade live, we are able to use monitoring tools to check the network health. Initial monitoring indicates that we have a stable network with the current gas target and the re-org rate is trending downwards. Additionally, analysis on messages in gossipsub indicate that the inclusion of &lt;code&gt;IDONTWANT&lt;&#x2F;code&gt; messages could bring us a significant bandwidth savings. This allows us to consider starting a series of big block and blob tests to determine the theoretical headroom we currently have. The EIP specifies a proposed new blob gas target and limit based on the series of tests.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to increase the throughput short term to provide some scaling until future solutions are deployed. In order to alleviate valid concerns about solo-stakers, approaches such as the inclusion of a flag indicating the max blobs per block for locally built blocks could be considered.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;9&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1179648&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;786432&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;5007716&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;MAX_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; are consumed by the consensus layer clients, and starting at &lt;code&gt;PECTRA_FORK_EPOCH&lt;&#x2F;code&gt; replace the respective old max and target values.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; are consumed by the execution layer clients, and starting at the epoch when this EIP is activated, replace the old max, target and update fraction values.
Any references to &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; should be updated to the new values defined in this EIP when processing the activation block.
The value &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; replaces its previous equivalent when processing the activation block.
These changes imply that &lt;code&gt;get_base_fee_per_blob_gas&lt;&#x2F;code&gt; and &lt;code&gt;calc_excess_blob_gas&lt;&#x2F;code&gt; functions defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; use the new values for the first block of the fork (and for all subsequent blocks).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;simplicity&quot;&gt;Simplicity&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP aims to minimize the amount of testing and implementation effort from the perspective of the client teams, to allow for more resources to be allocated to peerDAS and other scaling research.&lt;&#x2F;p&gt;
&lt;p&gt;While this EIP may not achieve the new optimal blob limit, it offers a compromise for a short term increase.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;update-fraction&quot;&gt;Update Fraction&lt;&#x2F;h3&gt;
&lt;p&gt;The original target and max values from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; were at a 1:2 ratio. As a consequence, responsiveness to full and empty blob sections was symmetrical:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;full blobs: basefee increases by ~12.5%&lt;&#x2F;li&gt;
&lt;li&gt;no blobs: basefee decreases by ~11.1%&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new target and max values from this EIP are at a 2:3 ratio, which breaks that symmetry. As a consequence, the basefee becomes significantly more responsive to empty blob sections (that are 6 blobs under target) than to full ones (that are 3 blobs over target). This is by design, as it takes two blocks with full blobs in a row to make up for a single block with no blobs. However, it creates the challenge of finding a good compromise base fee sensitivity level.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; value in this EIP is chosen as the mid-point between keeping the responsiveness to full blobs and no blobs constant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;full blobs: basefee increases by ~8.2%&lt;&#x2F;li&gt;
&lt;li&gt;no blobs: basefee decreases by ~14.5%&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The consensus clients would continue to use &lt;code&gt;MAX_BLOBS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOBS_PER_BLOCK&lt;&#x2F;code&gt; for the deneb fork and once the &lt;code&gt;ELECTRA&lt;&#x2F;code&gt; fork is active, they would use &lt;code&gt;MAX_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; and &lt;code&gt;TARGET_BLOBS_PER_BLOCK_ELECTRA&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;p&gt;The execution clients would continue to use &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; for the cancun fork and once the prague fork is active, they would use &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;, &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION_PRAGUE&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;network-impacts&quot;&gt;Network Impacts&lt;&#x2F;h3&gt;
&lt;p&gt;Through the use of big block&#x2F;blob tests on Ethereum mainnet as well as testnets, we can earn a high degree of certainty that the blob limit increase would not negatively impact the network. These tests as well as the associated analysis can be performed mostly by non-client team entities, with minimal input required. Since the changes are quite contained, the EIP should be able to reduce the risk of the blob limit increase.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stability-around-fork-epoch&quot;&gt;Stability Around Fork Epoch&lt;&#x2F;h3&gt;
&lt;p&gt;A blob limit increase at the fork transition is relatively straightforward from an implementation perspective. We would need to deploy an increased amount of monitoring around the fork epoch, but after a period of stability we can assume that the blob limit increase was successful, reducing any unexpected co-ordination efforts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Linear EVM memory limits</title>
        <published>2024-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7686/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7686-linear-evm-memory-limits/19448" />
        

        <id>https://wg-eips.ritovision.com/7686/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7686"
            label="EIP-7686" />
        

        
        

        
        <summary type="html">Adjust memory limits and gas limits of sub-calls to create a clear linear bound on how much total memory an EVM execution can consume</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7686/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a hard memory limit equal to the gas limit of the current context. Make the maximum gas cost of a sub-call depend on the memory used in the current context. The two rules together ensure that a transaction with N gas can use at most N bytes of memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Today, memory pricing rules are complicated: we have the quadratic cost for expanding memory as well as the 63&#x2F;64 rule for how much gas can go into a child call. This also makes it extremely hard to calculate a maximum possible amount of memory required to process a given EVM execution.&lt;&#x2F;p&gt;
&lt;p&gt;The rules in this post simplify these rules, and add a new hard limit: an EVM execution with N gas can require at most N total bytes of memory to process. This limit is tight: there are easy ways for an N-gas call to use &lt;code&gt;N - O(1)&lt;&#x2F;code&gt; bytes of memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Change &lt;code&gt;memory_cost&lt;&#x2F;code&gt; from:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_size_word&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;memory_byte_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;memory_size_word&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; **&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 512&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; memory_size_word&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_size_word&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;memory_byte_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;memory_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; memory_size_word&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additionally, if a memory expansion would lead to &lt;code&gt;memory_byte_size&lt;&#x2F;code&gt; strictly exceeding the current call&#x27;s initial gas limit, revert with an error.&lt;&#x2F;p&gt;
&lt;p&gt;When making any type of call, change the maximum gas limit from the current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; definition:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max_call_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max_call_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; memory_byte_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; memory_byte_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With this EIP, there is a simple EVM implementation that can process an N-gas call using an N-byte bytearray as memory: allocate all bytes to the current context, when doing a child call use the remaining memory starting from the position &lt;code&gt;memory_byte_size&lt;&#x2F;code&gt; for the child call&#x27;s memory, and so on recursively.&lt;&#x2F;p&gt;
&lt;p&gt;Having this clean invariant is useful for EVM implementations, especially EVM implementations in constrained environments (eg. ZK-SNARK provers).&lt;&#x2F;p&gt;
&lt;p&gt;The 3 gas per word memory expansion cost is retained because it is equivalent to MCOPY, and so the operation of clearing memory at the end of a child call (cheap in regular machines, but more expensive in ZK-SNARKs and other unusual contexts) can be implemented with the same logic as that used to implement the MCOPY opcode itself.&lt;&#x2F;p&gt;
&lt;p&gt;The 63&#x2F;64 rule is maintained in order to maintain the current de-facto call stack depth limit of roughly &lt;code&gt;1 + log((gaslimit + 6300) &#x2F; 6400) &#x2F; log(64&#x2F;63) = 537&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is theoretically possible for EVM code that works today to fail to work under this new EIP, if that code accesses a high index in memory but is called with a low gas limit. However, almost all EVM execution consumes far more code than it uses bytes of memory. For example, for a call to cause even a single state change, it must have at least 5000 gas. This would allow it 5000 bytes of memory, which is greater than that used by almost all applications. More complex applications would have even higher limits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security concerns were raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Forward compatible consensus data structures</title>
        <published>2024-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7688/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7688-forward-compatible-consensus-data-structures/19673" />
        

        <id>https://wg-eips.ritovision.com/7688/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7688"
            label="EIP-7688" />
        

        
        

        
        <summary type="html">Transition consensus SSZ data structures to ProgressiveContainer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7688/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines the changes needed to adopt &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495&lt;&#x2F;a&gt; and &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;EIP-7916&lt;&#x2F;a&gt; in consensus data structures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s consensus data structures make heavy use of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; &lt;code&gt;Container&lt;&#x2F;code&gt;, which defines how they are serialized and merkleized. The merkleization scheme allows application implementations to verify that individual fields (and partial fields) have not been tampered with. This is useful, for example, in smart contracts of decentralized staking pools that wish to verify that participating validators have not been slashed.&lt;&#x2F;p&gt;
&lt;p&gt;While SSZ &lt;code&gt;Container&lt;&#x2F;code&gt; defines how data structures are merkleized, the merkleization is prone to change across the different forks. When that happens, e.g., because new features are added or old features get removed, existing verifier implementations need to be updated to be able to continue processing proofs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495&lt;&#x2F;a&gt;, is a forward compatible alternative that guarantees a forward compatible merkleization scheme. By transitioning consensus data structures to use &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, smart contracts that contain verifier logic no longer have to be maintained in lockstep with Ethereum&#x27;s fork schedule as long as the underlying features that they verify don&#x27;t change. For example, as long as the concept of slashing is represented using the boolean &lt;code&gt;slashed&lt;&#x2F;code&gt; field, existing verifiers will not break when unrelated features get added or removed. This is also true for off-chain verifiers, e.g., in hardware wallets or in operating systems for mobile devices that are on a different software update cadence than Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;container-conversion&quot;&gt;&lt;code&gt;Container&lt;&#x2F;code&gt; conversion&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Container&lt;&#x2F;code&gt; types that are expected to evolve over forks SHALL be redefined as &lt;code&gt;ProgressiveContainer(active_fields=[1] * len(type.fields()))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For example, given a type in the old fork:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This type can be converted to support stable Merkleization in the new fork:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Foo&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As part of the conversion, a stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; is assigned to each field that remains valid in future forks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a fork appends a field, &lt;code&gt;active_fields&lt;&#x2F;code&gt; MUST be extended with a trailing &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If a fork removes a field, the corresponding &lt;code&gt;active_fields&lt;&#x2F;code&gt; bit MUST be changed to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compatibility rules SHOULD be enforced, e.g., by defining a &lt;code&gt;CompatibleUnion[fork_1.Foo, fork_2.Foo, fork_3.Foo, ...]&lt;&#x2F;code&gt; type in the unit test framework.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;list-type-n-bitlist-conversion&quot;&gt;&lt;code&gt;List[type, N]&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;Bitlist&lt;&#x2F;code&gt; conversion&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;List&lt;&#x2F;code&gt; types frequently have been defined with excessively large capacities &lt;code&gt;N&lt;&#x2F;code&gt; with the intention that &lt;code&gt;N&lt;&#x2F;code&gt; is never reached in practice. In other cases, the capacity itself has changed over time.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;List&lt;&#x2F;code&gt; types with dynamic or unbounded capacity semantics SHALL be redefined as &lt;code&gt;ProgressiveList[type]&lt;&#x2F;code&gt;, and the application logic SHALL be updated to check for an appropriate limit at runtime.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Bitlist&lt;&#x2F;code&gt; types with dynamic or unbounded capacity semantics SHALL be redefined as &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As part of the conversion, a stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; is assigned to each list element that remains valid regardless of the number of added elements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;converted-types&quot;&gt;Converted types&lt;&#x2F;h3&gt;
&lt;p&gt;The following types SHALL be converted to &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#attestation&quot;&gt;&lt;code&gt;Attestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;aggregation_bits&lt;&#x2F;code&gt; field is redefined to use &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#indexedattestation&quot;&gt;&lt;code&gt;IndexedAttestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;attesting_indices&lt;&#x2F;code&gt; field is redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;transactions&lt;&#x2F;code&gt; and &lt;code&gt;withdrawals&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;MAX_TRANSACTIONS_PER_PAYLOAD&lt;&#x2F;code&gt; (1M) limit is no longer enforced (the limit is unreachable with &lt;code&gt;MAX_PAYLOAD_SIZE&lt;&#x2F;code&gt; 10 MB)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#executionrequests&quot;&gt;&lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;deposits&lt;&#x2F;code&gt;, &lt;code&gt;withdrawals&lt;&#x2F;code&gt; and &lt;code&gt;consolidations&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#beaconblockbody&quot;&gt;&lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;proposer_slashings&lt;&#x2F;code&gt;, &lt;code&gt;attester_slashings&lt;&#x2F;code&gt;, &lt;code&gt;attestations&lt;&#x2F;code&gt;, &lt;code&gt;deposits&lt;&#x2F;code&gt;, &lt;code&gt;voluntary_exits&lt;&#x2F;code&gt; and &lt;code&gt;bls_to_execution_changes&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;validators&lt;&#x2F;code&gt;, &lt;code&gt;balances&lt;&#x2F;code&gt;, &lt;code&gt;previous_epoch_participation&lt;&#x2F;code&gt;, &lt;code&gt;current_epoch_participation&lt;&#x2F;code&gt;, &lt;code&gt;inactivity_scores&lt;&#x2F;code&gt;, &lt;code&gt;pending_deposits&lt;&#x2F;code&gt;, &lt;code&gt;pending_partial_withdrawals&lt;&#x2F;code&gt; and &lt;code&gt;pending_consolidations&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt;, &lt;code&gt;kzg_proofs&lt;&#x2F;code&gt; and &lt;code&gt;column&lt;&#x2F;code&gt; fields are redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;immutable-types&quot;&gt;Immutable types&lt;&#x2F;h3&gt;
&lt;p&gt;These types are used as part of the &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; definitions, and, as they are not &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; themselves, are considered to have immutable Merkleization. If a future fork requires changing these types in an incompatible way, a new type SHALL be defined and assigned a new field name.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Slot&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Slot number on the beacon chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Epoch&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Epoch number on the beacon chain, a group of slots&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;CommitteeIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Index of a committee within a slot&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ValidatorIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Unique index of a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Gwei&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Amount in Gwei (1 ETH = 10^9 Gwei = 10^18 Wei)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte vector containing an SSZ Merkle root&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Hash32&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte vector containing an opaque 32-byte hash&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Version&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus fork version number&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;BLSPubkey&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptographic type representing a BLS12-381 public key&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;BLSSignature&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptographic type representing a BLS12-381 signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;_features&#x2F;sharding&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;G1 curve point for the KZG polynomial commitment scheme&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#fork&quot;&gt;&lt;code&gt;Fork&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus fork information&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#checkpoint&quot;&gt;&lt;code&gt;Checkpoint&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple referring to the most recent beacon block up through an epoch&#x27;s start slot&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#validator&quot;&gt;&lt;code&gt;Validator&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Information about a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#attestationdata&quot;&gt;&lt;code&gt;AttestationData&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Vote that attests to the availability and validity of a particular consensus block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#eth1data&quot;&gt;&lt;code&gt;Eth1Data&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Target tracker for importing deposits from transaction logs&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#depositdata&quot;&gt;&lt;code&gt;DepositData&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Log data emitted as part of a transaction&#x27;s receipt when depositing to the beacon chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#beaconblockheader&quot;&gt;&lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus block header&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#proposerslashing&quot;&gt;&lt;code&gt;ProposerSlashing&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of two equivocating consensus block headers&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#deposit&quot;&gt;&lt;code&gt;Deposit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of deposit data and its inclusion proof&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#voluntaryexit&quot;&gt;&lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Consensus originated request to exit a validator from the beacon chain&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#signedvoluntaryexit&quot;&gt;&lt;code&gt;SignedVoluntaryExit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of voluntary exit request and its signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#syncaggregate&quot;&gt;&lt;code&gt;SyncAggregate&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Cryptographic type representing an aggregate sync committee signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte vector containing an account address on the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Byte list containing an RLP encoded transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;WithdrawalIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Unique index of a withdrawal from any validator&#x27;s balance to the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#withdrawal&quot;&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Withdrawal from a beacon chain validator&#x27;s balance to the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#depositrequest&quot;&gt;&lt;code&gt;DepositRequest&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of flattened deposit data and its sequential index&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#withdrawalrequest&quot;&gt;&lt;code&gt;WithdrawalRequest&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execution originated request to withdraw from a validator to the execution layer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#consolidation&quot;&gt;&lt;code&gt;ConsolidationRequest&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Execution originated request to consolidate two beacon chain validators&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#blstoexecutionchange&quot;&gt;&lt;code&gt;BLSToExecutionChange&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Request to register the withdrawal account address of a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#signedblstoexecutionchange&quot;&gt;&lt;code&gt;SignedBLSToExecutionChange&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple of withdrawal account address registration request and its signature&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ParticipationFlags&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Participation tracker of a beacon chain validator within an epoch&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#historicalsummary&quot;&gt;&lt;code&gt;HistoricalSummary&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Tuple combining a historical block root and historical state root&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#pendingdeposit&quot;&gt;&lt;code&gt;PendingDeposit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pending operation for depositing to a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#pendingpartialwithdrawal&quot;&gt;&lt;code&gt;PendingPartialWithdrawal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pending operation for withdrawing from a beacon chain validator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#pendingconsolidation&quot;&gt;&lt;code&gt;PendingConsolidation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pending operation for consolidating two beacon chain validators&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;best-timing&quot;&gt;Best timing?&lt;&#x2F;h3&gt;
&lt;p&gt;Applying this EIP breaks &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; and Merkle tree verifiers a single time, while promising forward compatibility from the fork going forward. It is best to apply it before merkleization would be broken by different changes. Merkleization is broken by a &lt;code&gt;Container&lt;&#x2F;code&gt; reaching a new power of 2 in its number of fields.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;can-this-be-applied-retroactively&quot;&gt;Can this be applied retroactively?&lt;&#x2F;h3&gt;
&lt;p&gt;While &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; serializes in the same way as the legacy &lt;code&gt;Container&lt;&#x2F;code&gt;, the merkleization and &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; of affected data structures changes. Therefore, verifiers that wish to process Merkle proofs of legacy variants still need to support the corresponding legacy schemes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immutability&quot;&gt;Immutability&lt;&#x2F;h3&gt;
&lt;p&gt;Once a field in a &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; has been published, its name can no longer be used to represent a different type in the future. This is in line with historical management of certain cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Phase0: &lt;code&gt;BeaconState&lt;&#x2F;code&gt; contained &lt;code&gt;previous_epoch_attestations&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;current_epoch_attestations&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Altair: &lt;code&gt;BeaconState&lt;&#x2F;code&gt; replaced these fields with &lt;code&gt;previous_epoch_participation&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;current_epoch_participation&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Furthermore, new fields have to be appended at the end of &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;. This is in line with historical management of other cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Capella appended &lt;code&gt;historical_summaries&lt;&#x2F;code&gt; to &lt;code&gt;BeaconState&lt;&#x2F;code&gt; instead of squeezing the new field next to &lt;code&gt;historical_roots&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;, stable Merkleization requires these rules to become strict.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cleanup-opportunities&quot;&gt;Cleanup opportunities&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;eth1_data&lt;&#x2F;code&gt;, &lt;code&gt;eth1_data_votes&lt;&#x2F;code&gt;, &lt;code&gt;eth1_deposit_index&lt;&#x2F;code&gt; and &lt;code&gt;deposit_requests_start_index&lt;&#x2F;code&gt; fields could be dropped as they are no longer needed after the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;#eth1data-poll-deprecation&quot;&gt;EIP-6110&lt;&#x2F;a&gt; transition period finishes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;historical_summaries&lt;&#x2F;code&gt; could be redefined to use &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt; and also integrate the historical &lt;code&gt;historical_roots&lt;&#x2F;code&gt; data by merging in full &lt;code&gt;HistoricalSummary&lt;&#x2F;code&gt; data from an archive (&lt;code&gt;historical_root&lt;&#x2F;code&gt; is frozen since Capella), simplifying access to historical block and state roots.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;attestation&quot;&gt;&lt;code&gt;Attestation&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;committee_bits&lt;&#x2F;code&gt; is defined as a &lt;code&gt;Bitvector&lt;&#x2F;code&gt;, but the top bits are forced to 0 based on &lt;code&gt;get_committee_count_per_slot(state, data.target.epoch)&lt;&#x2F;code&gt;. It could be re-defined as a &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;indexedattestation&quot;&gt;&lt;code&gt;IndexedAttestation&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;attesting_indices&lt;&#x2F;code&gt; are limited to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#indexedattestation&quot;&gt;&lt;code&gt;MAX_VALIDATORS_PER_COMMITTEE * MAX_COMMITTEES_PER_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, which is insufficient when the &lt;code&gt;IndexedAttestation&lt;&#x2F;code&gt; is formed from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#singleattestation&quot;&gt;&lt;code&gt;SingleAttestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; traffic. &lt;code&gt;SingleAttestation&lt;&#x2F;code&gt; allows validators that are not assigned to a slot to produce signatures that are not aggregatable into an &lt;code&gt;Attestation&lt;&#x2F;code&gt; (as such validators are not assigned), but that are still slashable.&lt;&#x2F;p&gt;
&lt;p&gt;Further, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md#max-operations-per-block&quot;&gt;&lt;code&gt;MAX_ATTESTER_SLASHINGS_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; at 1 limits inclusion efficiency of slashings in non-finality scenarios with a lot of forks where slashings happen across multiple different &lt;code&gt;AttestationData&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;p&gt;Limits could be rethought to be based on actual resource usage, e.g., by limiting:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The total number of &lt;code&gt;attesting_indices&lt;&#x2F;code&gt; across all &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; (shared total)&lt;&#x2F;li&gt;
&lt;li&gt;The total number of signature checks across all &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;, &lt;code&gt;ProposerSlashing&lt;&#x2F;code&gt;, &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt;, and &lt;code&gt;SignedBLSToExecutionChange&lt;&#x2F;code&gt; messages&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Limiting totals rather than individual resources would allow extra attester slashings to be included at the cost of potentially delaying inclusion of a couple altruistic messages (if there even are any &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;SignedBLSToExecutionChange&lt;&#x2F;code&gt; messages at that time), thus increasing security and block packing efficiency.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;executionpayload&quot;&gt;&lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;block_hash&lt;&#x2F;code&gt; field could be moved to the top of &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, reducing the Merkle proof size.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;executionrequests&quot;&gt;&lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;As deposits cannot be retried by the user (they pay the ETH upfront), deposit requests cannot fizzle like other requests; they are always included in the same block (since Pectra). For that reason, the current &lt;code&gt;MAX_DEPOSIT_REQUESTS_PER_PAYLOAD&lt;&#x2F;code&gt; (8192) is essentially unbounded at current gas limits, but may eventually become reachable (around ~192M gas, or earlier with gas repricings). The CL limit for deposit requests could be dropped to avoid scaling issues, instead solely relying on EL backpressure (gas fees, 1 ETH deposit minimum).&lt;&#x2F;p&gt;
&lt;p&gt;For other requests (withdrawal &#x2F; consolidation requests), a shared total limit based on the added CL state size could provide more flexibility than the current per-operation limits. For example, in times without consolidation requests, space could be used to enqueue more withdrawal requests.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;beaconblockheader&quot;&gt;&lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt; is currently proposed to be kept as is. Updating the &lt;code&gt;BeaconBlockHeader&lt;&#x2F;code&gt; to &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; is tricky as it breaks &lt;code&gt;hash_tree_root(latest_block_header)&lt;&#x2F;code&gt; in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. One option could be to store &lt;code&gt;latest_block_header_root&lt;&#x2F;code&gt; separately, possibly also incorporating the block proposer signature into the hash to avoid proposer signature checks while backfilling historical blocks.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validator&quot;&gt;&lt;code&gt;Validator&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;Validator&lt;&#x2F;code&gt; container is currently proposed to be kept as is. Updating the &lt;code&gt;Validator&lt;&#x2F;code&gt; to &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; would add an extra hash for each validator; validators are mostly immutable so rarely need to be re-hashed. With a conversion, implementations may have to incrementally construct the new &lt;code&gt;Validator&lt;&#x2F;code&gt; entries ahead of the fork when validator counts are high. It should be evaluated whether the hashing overhead is worth a clean transition to future fields, e.g., for holding postquantum keys. Also consider that such a transition may also involve a new hash function, which is a breaking change to the Merkle proofs, so generalized indices do not have to be stable across that transition.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Existing Merkle proof verifiers need to be updated to support the new Merkle tree shape. This includes verifiers in smart contracts on different blockchains and verifiers in hardware wallets, if applicable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Before this EIP, all &lt;code&gt;List&lt;&#x2F;code&gt; types had a fixed upper bound, enabling implementations to reject messages exceeding that size early. With &lt;code&gt;ProgressiveList&lt;&#x2F;code&gt;, that is no longer possible, as there is no more maximum message size. Instead, the length checks have to be implemented as part of P2P gossip validation, and as part of the state transition logic. However, many of the limits are not practically reachable (e.g., the gas limit is reached before the maximum payload size). Further note that SSZ is simple enough that clever implementations could still enforce those length checks on the serialized data, before fully decoding it.&lt;&#x2F;p&gt;
&lt;p&gt;All data inbound via libp2p is decrypted, then uncompressed with Snappy, then hashed with &lt;code&gt;MESSAGE_DOMAIN_VALID_SNAPPY&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;MESSAGE_DOMAIN_INVALID_SNAPPY&lt;&#x2F;code&gt; prefix depending on whether the decompression worked to compute the libp2p message ID, while honoring a global &lt;code&gt;MAX_PAYLOAD_SIZE&lt;&#x2F;code&gt; message size limit. This has to be done even if the underlying SSZ data ends up being invalid.&lt;&#x2F;p&gt;
&lt;p&gt;As SSZ does not use variable-length encoding, it does not have uncontrolled blowup (no 1 byte becomes 100 MB). Therefore, attempting to decode a &lt;code&gt;MAX_PAYLOAD_SIZE&lt;&#x2F;code&gt; message before checking dynamic &lt;code&gt;List&lt;&#x2F;code&gt; limits does not decrease security. Any intentional DoS attacks can already target a heavier portion of the processing pipeline (e.g., by sending invalid BLS signatures, or by sending invalid Snappy data that still needs to be hashed to compute the message ID). Therefore, the EIP does not notably impact security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>General purpose execution layer requests</title>
        <published>2024-04-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7685/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7685-general-purpose-execution-layer-requests/19668" />
        

        <id>https://wg-eips.ritovision.com/7685/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7685"
            label="EIP-7685" />
        

        
        

        
        <summary type="html">A general purpose bus for sharing EL triggered requests with the CL</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7685/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal defines a general purpose framework for storing contract-triggered
requests. It extends the execution header with a single field to store the
request information. Requests are later on exposed to the consensus layer, which
then processes each one.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proliferation of smart contract controlled validators has caused there to be
a demand for additional EL triggered behaviors. By allowing these systems to
delegate administrative operations to their governing smart contracts, they can
avoid intermediaries needing to step in and ensure certain operations occur.
This creates a safer system for end users. By abstracting each individual request
details from the EL, adding new request types is simpler and does not require an
update on the execution block structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;requests&quot;&gt;Requests&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;requests&lt;&#x2F;code&gt; object consists of a &lt;code&gt;request_type&lt;&#x2F;code&gt; byte prepended to an opaque byte array
&lt;code&gt;request_data&lt;&#x2F;code&gt;. The &lt;code&gt;request_data&lt;&#x2F;code&gt; contains zero or more encoded request objects.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;requests = request_type ++ request_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each request type will define its own &lt;code&gt;requests&lt;&#x2F;code&gt; object with its own &lt;code&gt;request_data&lt;&#x2F;code&gt; format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-header&quot;&gt;Block Header&lt;&#x2F;h4&gt;
&lt;p&gt;Extend the header with a new 32 byte commitment value &lt;code&gt;requests_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While processing a block, multiple &lt;code&gt;requests&lt;&#x2F;code&gt; objects with different &lt;code&gt;request_type&lt;&#x2F;code&gt;s will
be produced by the system, and accumulated in the block requests list.&lt;&#x2F;p&gt;
&lt;p&gt;In order to compute the commitment, an intermediate hash list is first built by hashing
all non-empty requests elements of the block requests list. Items with empty
&lt;code&gt;request_data&lt;&#x2F;code&gt; are excluded, i.e. the intermediate list skips &lt;code&gt;requests&lt;&#x2F;code&gt; items which
contain only the &lt;code&gt;request_type&lt;&#x2F;code&gt; (1 byte) and nothing else.&lt;&#x2F;p&gt;
&lt;p&gt;Within the intermediate list, &lt;code&gt;requests&lt;&#x2F;code&gt; items must be ordered by &lt;code&gt;request_type&lt;&#x2F;code&gt; ascending.&lt;&#x2F;p&gt;
&lt;p&gt;The final commitment is computed as the sha256 hash of the intermediate element hashes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    m&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block_requests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;update&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;requests_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_requests_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;requests&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;Each proposal may choose how to extend the beacon chain types to include new EL request
types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opaque-byte-array-rather-than-an-rlp-array&quot;&gt;Opaque byte array rather than an RLP array&lt;&#x2F;h3&gt;
&lt;p&gt;By having the bytes of &lt;code&gt;request_data&lt;&#x2F;code&gt; array from second byte on be opaque bytes, rather
than an RLP (or other encoding) list, we can support different encoding formats for the
request payload in the future such as SSZ, LEB128, or a fixed width format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;request-source-and-validity&quot;&gt;Request source and validity&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP makes no strict requirement where a request may come from nor when&#x2F;how
a request must be validated. This is to provide future protocol designers
maximum flexibility.&lt;&#x2F;p&gt;
&lt;p&gt;The authors&#x27; recommendations on source and validity of requests are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The source of requests should be from the execution of transactions. More
specifically, transactions which make calls to designated system contracts
that store the request in account. The storage would later be retrieved by a
post-block system call to the contract. Alternatively, if the system call does
not need to be inherently concerned with rate limiting, it could rely simply
on emitting an event which is later parsed post-block by the system and
converted into a request.&lt;&#x2F;li&gt;
&lt;li&gt;A request&#x27;s validity can often not be fully verified at the execution layer.
This is why they are referred to merely as &quot;requests&quot;; they do not carry the
authority on their own to unilaterally catalyze an action. We expect the system
contracts to perform whatever validation is possible by the EL and then pass
it on to the CL for further validation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;ordering&quot;&gt;Ordering&lt;&#x2F;h3&gt;
&lt;p&gt;The ordering across types is ascending by type. This is to simplify the process
of verifying that all requests which were committed to in &lt;code&gt;requests_hash&lt;&#x2F;code&gt; match.&lt;&#x2F;p&gt;
&lt;p&gt;An alternative could be to order by when the request was generated within the
block. Since it&#x27;s expected that many requests will be accumulated at the end of
the block via system calls, this would be difficult to enforce. Therefore,
ordering by type is the most straightforward ordering which ensures integrity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;intra-type&quot;&gt;Intra-type&lt;&#x2F;h4&gt;
&lt;p&gt;Within the same type, order is not defined. This is because the data of the
request is opaque as far as this EIP is concerned. Therefore, it is to be
determined by each request type individually.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-empty-requests-in-commitment&quot;&gt;Removing empty requests in commitment&lt;&#x2F;h3&gt;
&lt;p&gt;We exclude empty requests elements from the &lt;code&gt;requests_hash&lt;&#x2F;code&gt; commitment in order to get a
stable &#x27;empty&#x27; hash value that is independent of the blockchain fork. For a block with no
requests data, the &lt;code&gt;requests_hash&lt;&#x2F;code&gt; is simply &lt;code&gt;sha256(&quot;&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Return deposits for distinct credentials</title>
        <published>2024-04-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7684/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7684-return-deposits-for-distinct-credentials/19632" />
        

        <id>https://wg-eips.ritovision.com/7684/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7684"
            label="EIP-7684" />
        

        
        

        
        <summary type="html">Automatically withdraw deposits for existing validator records but with distinct execution withdrawal credentials</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7684/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Automatically withdraw deposits for existing validator records, but where the deposit includes a distinct execution withdrawal credential.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Some staking operations feature two distinct entities, one operating the validating key, and one funding the deposit. The funding entity delegates control of the stake operation but must retain ultimate control of funds. If the funding entity naively submits a single deposit with the full stake amount and the other entity&#x27;s validating key, it is subject to a front-run attack. The validating entity can front-run the bigger deposit with a second deposit with its own set of withdrawal credentials. The full stake amount deposit becomes a top-up, in control of the validating entity.&lt;&#x2F;p&gt;
&lt;p&gt;There exist workarounds to the front-run attack. Using some distributed key generation protocol between the funding and validating entity, such that a deposit must be made with the consent of both entities. Submit a 1 ETH deposit first wait for its inclusion then send the full stake amount as a top-up, to bind the maximum loss under the attack to 1 ETH. While these workarounds, work; they difficult the operation of trustless autonomous staking protocols.&lt;&#x2F;p&gt;
&lt;p&gt;This specification reduces the total loss on a naive deposit submission from the full deposit amount to &lt;code&gt;RETURN_DEPOSIT_PENALTY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The configuration values and mechanics of the specification can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2360756c8c19c0f7b0e91135f5bbcddecdf0a835&#x2F;specs&#x2F;_features&#x2F;eip9999&#x2F;beacon_chain.md&quot;&gt;Consensus Layer specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A sketch of the resulting changes to the consensus layer is included below.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;code&gt;apply_deposit&lt;&#x2F;code&gt; to queue for withdrawal deposits with distinct execution withdrawal credentials&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_expected_withdrawals&lt;&#x2F;code&gt; to return pending withdrawals first&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_withdrawals&lt;&#x2F;code&gt; to clear the pending withdrawals queue&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This specification does not require any changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;persist-pending-withdrawals&quot;&gt;Persist pending withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;Rejected deposits from block at slot N can not be withdrawn in block N due to a cyclic dependency. An execution client must know the full list of withdrawals before constructing a payload for slot N. After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;&quot;&gt;EIP-6110&lt;&#x2F;a&gt;, a consensus client must know the full execution payload for slot N before constructing the beacon block for slot N. Therefore, rejected deposits must be withdrawn in some future slot. All pending withdrawals are processed at once in the very next slot for simplicity but could be queued and processed progressively if there are DOS concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backward incompatible change to the Consensus Layer of Ethereum and must be scheduled with a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;There are no forwards &#x2F; backwards compatibility issues with the Execution Layer&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are work-in-progress within the standard Consensus Layer tests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The worst-case number of withdrawals is raised from a fixed 16 to 1,271 under current gas rules and a 30M gas block. Citing &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;&quot;&gt;EIP-6110&lt;&#x2F;a&gt;, future gas efficiencies can increase the number to 1,916 withdrawals in a 30M gas block. Each withdrawal results in a single address balance change. There is no explicit pricing for such an operation, but under the worst case, it results in a notable increase in the total block gas (30% assuming 6,900 gas per withdrawal and current gas rules).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RETURN_DEPOSIT_PENALTY&lt;&#x2F;code&gt; disincentivizes rejected deposits, and imposes a gas cost of 144,927 Gwei &#x2F; gas, assuming 6,900 gas per withdrawal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Prepare for Address Space Extension</title>
        <published>2024-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7676/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eof-prepare-for-address-space-extension/19537" />
        

        <id>https://wg-eips.ritovision.com/7676/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7676"
            label="EIP-7676" />
        

        
        

        
        <summary type="html">Update EOF opcodes so addresses are not trimmed during execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7676/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Operations in the Legacy EVM trim off the top 12 bytes of an address operand before evaluation. This
EIP changes the handling of those opcodes within EOF so that no trimming occurs and the top twelve
bytes need to be zero or an exceptional halt is raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There have been proposals to extend Ethereum Addresses from 160 bits to 256, such as one that would
use the extra bits for state expiry (such as the ethereum magicians forum topic &quot;Increasing the
address size from 20 to 32 bytes&quot;). One issue ground the work to a halt: EVM opcodes that accept
addresses trim all but the lowest 20 bytes out from the operand before processing. EVM Reference
tests verify this behavior in the &#x27;stBadOpcode&#x2F;invalidAddr.json&#x27; tests.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM Object Format presents an opportunity to remove this address masking in a backwards
compatible way, by baking it into the format definition from the start.&lt;&#x2F;p&gt;
&lt;p&gt;Most of the work is already in place. The following 5 operations have already been banned from
EOF: &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;. Three call
operations, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; are being revamped
in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7069&#x2F;&quot;&gt;EIP-7069&lt;&#x2F;a&gt;. That leaves only one operation, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, with issues.&lt;&#x2F;p&gt;
&lt;p&gt;When future uses of address space extension are specified it is expected that the exceptional halt
behavior will be modified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce one new instruction:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; (&lt;code&gt;tbd&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address)&lt;&#x2F;code&gt;, returning &lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; will pop one stack item off of the stack, the address of another account or contract.
The balance of that account or contract will be pushed onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; is invoked with any of the high 12 bytes in &lt;code&gt;target_address&lt;&#x2F;code&gt; set to a non-zero value
the operation will cause an exceptional halt. All gas in the current frame will be consumed on
failure, no gas schedule change is needed.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; will be costed according to the gas schedule for the &lt;code&gt;BALANCE&lt;&#x2F;code&gt;
operation specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;. This means if the account is not
in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; then it is charged 2600 gas and added to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. If the
account is in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; then 100 gas is charged. The &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; is shared with
all other operands described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Also, for the &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;, &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;EXTSTATICCALL&lt;&#x2F;code&gt; operations a new step is added just
before the memory expansion check: halt with exceptional failure if any of the high 96 bits of
the &lt;code&gt;target_address&lt;&#x2F;code&gt; are set.&lt;&#x2F;p&gt;
&lt;p&gt;It is anticipated that future EIPs will alter the behavior in a way that will not result in an
exceptional halt. Contract implementors should not depend on the exceptional halt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;new-opcode&quot;&gt;New Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;There is no need to ban the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode as it does not cause any problems that would require
banning it within an EOF container. Adding a new opcode also allows the existing opcode to behave
the same in EOF and legacy code, reducing potential friction points for end user confusion and bugs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;revert-on-invalid-address&quot;&gt;Revert on invalid address&lt;&#x2F;h3&gt;
&lt;p&gt;There are two alternative ways to handle accounts with high bits set. The specification calls for
an exceptional halt, but the alternative was to treat the account as empty. The reason the &quot;empty
account&quot; approach was rejected is twofold:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; list could be required to track 256 bit accounts when an invalid address
is accessed.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; series instructions could still send balance to those addresses and such accounts
would then hold an (inaccessible) balance that would need to be reflected in the merkle trie.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;no-change-in-gas-costing&quot;&gt;No change in gas costing&lt;&#x2F;h3&gt;
&lt;p&gt;Because the BALANCE operation already needs to check &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; there is already a good
amount of processing that must go into the operation. Hence, no changes to the gas schedule are
needed to prevent abuse of the failures. Such incremental costs will be dominated by costs related
to reverts and address checking for valid accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Preparing for Address Space Expansion is explicitly done inside the scope of EOF with the intent
that it will not require changes in old contracts, but with the caveat that old contracts may not be
able to use addresses in the expanded space.&lt;&#x2F;p&gt;
&lt;p&gt;Future EIPs should be mindful when adding new operation with an address operand or parameter to how
it interacts with EOF and legacy contracts. Authors should ensure that such additions remain in
harmony with this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases similar to &lt;code&gt;invalidAddr.json&lt;&#x2F;code&gt;  tests in the standard reference tests will need to be
written for the EOF tests, except they would check for halts on invalid addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP only defines a revert behavior for previously stripped addresses. Compilers will need to be
aware of the need to mask addresses coming in from call data. Some of this is already present in
existing Solidity ABI standards, but more care should be taken in examining the flow
around &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt; and code for &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; operations to ensure that compiled code strips the high
bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM-ify the identity precompile</title>
        <published>2024-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7666/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7561-evm-ify-the-identity-precompile/19445" />
        

        <id>https://wg-eips.ritovision.com/7666/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7666"
            label="EIP-7666" />
        

        
        

        
        <summary type="html">Remove the identity precompile, and put into place a piece of EVM code that has equivalent functionality</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7666/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Remove the identity precompile at 0x04. At the start of executing the block in which this change activates, put into that contract a short piece of EVM code that has the same functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum today has a large number of precompiles. Nearly half of these precompiles are not seeing significant use, and are contributing to ongoing maintenance cost and risk of consensus bugs, as well as increased development effort for new Ethereum client implementations, including ZK-EVMs and implementations in formal-verification-friendly languages.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a path for the Ethereum ecosystem to gracefully abandon these precompiles, and takes a first step by applying this procedure to the simplest precompile of all: the identity precompile (which outputs returndata equal to the input calldata). The identity precompile was originally introduced because memory copying is a common operation, and there was no opcode available to do it directly. Since then, norms around what is acceptable for an opcode have changed, and we have introduced the MCOPY opcode with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5656&#x2F;&quot;&gt;EIP-5656&lt;&#x2F;a&gt;. And so we can remove the identity precompile, and replace it with an ultra-minimal piece of EVM code that replicates its functionality.&lt;&#x2F;p&gt;
&lt;p&gt;In the future, this technique can be applied to other more complex precompiles, such as little-used hash functions and MODEXP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;IDENTITY_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000....0004&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EVM_CODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x365f5f37365ff3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;At the start of the block in which this fork activates, set the code of &lt;code&gt;IDENTITY_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; to &lt;code&gt;EVM_CODE&lt;&#x2F;code&gt;. Starting from and including that block, &lt;code&gt;IDENTITY_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; should no longer be treated as a precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The given &lt;code&gt;EVM_CODE&lt;&#x2F;code&gt; corresponds to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALLDATASIZE PUSH0 PUSH0 CALLDATACOPY CALLDATASIZE PUSH0 RETURN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Which copies calldata into memory, and then returns the same memory slice. This is thus a minimally disruptive change to Ethereum that preserves functionality, and accomplishes the goal of reducing the number of precompiles by 1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The functionality of the given &lt;code&gt;EVM_CODE&lt;&#x2F;code&gt; is the same as the identity precompile. Gas costs are slightly different, though gas repricings have been done in the Ethereum ecosystem several times before and their effects are well understood.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As no new functionality is introduced or made cheaper, no security concerns are raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Raise gas costs of hash functions</title>
        <published>2024-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7667/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7562-raise-gas-costs-of-hash-functions/19446" />
        

        <id>https://wg-eips.ritovision.com/7667/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7667"
            label="EIP-7667" />
        

        
        

        
        <summary type="html">Raise the gas costs of hash function opcodes and precompiles, to match prover expenses in ZK-EVMs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7667/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Raise the gas costs of opcodes and precompiles that involve hash functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas costs for hash function opcodes and precompiles were originally set based on the time that it takes to execute them on a regular CPU. Since then, however, there has emerged another equally important execution substrate that the EVM is executed on: zero knowledge proof (ZK-SNARK) systems. By that standard, these opcodes and precompiles are &lt;em&gt;very&lt;&#x2F;em&gt; underpriced relative to other operations.&lt;&#x2F;p&gt;
&lt;p&gt;Blocks that are heavy with hash function executions take much longer to ZK-SNARK prove than average blocks. Today, many layer-2 protocols are using workarounds such as arbitrary limits and rules enforced by centralized sequencers to deal with this issue. These workarounds are often poorly designed and lead to unneeded security and centralization concerns.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, there is a design goal of eventually using ZK-SNARKs to prove the correctness of layer-1 Ethereum blocks. To do this, we need to establish very tight bounds on how long it takes to generate a ZK-SNARK proof of an Ethereum execution block&#x27;s correctness. Today, the difference between average-case proving time and worst-case proving time is large, and hash function executions are the largest reason why.&lt;&#x2F;p&gt;
&lt;p&gt;Verkle trees solve the part of this problem that comes from Keccak hashing in the Merkle Patricia tree. Today, the theoretical worst case is a block with &lt;code&gt;30000000 &#x2F; 2600 = 11538&lt;&#x2F;code&gt; account accesses (minus a small percent for EVM overhead), where proving each access would require proving &lt;code&gt;24000&lt;&#x2F;code&gt; bytes of code, plus a roughly &lt;code&gt;512 * log(500m) &#x2F; log(16) = 3712&lt;&#x2F;code&gt; byte Merkle-Patricia proof: roughly &lt;code&gt;305 MB&lt;&#x2F;code&gt; of hashing spread between &lt;code&gt;83650&lt;&#x2F;code&gt; hash calls. Verkle trees solve this. However, using opcodes, a block execution can still require roughly the following amount of hashing:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Hash&lt;&#x2F;th&gt;&lt;th&gt;Cost per word&lt;&#x2F;th&gt;&lt;th&gt;Maximum bytes from 30 million gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KECCAK&lt;&#x2F;code&gt; (opcode)&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;160 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SHA256&lt;&#x2F;code&gt; (precompile)&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;80 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RIPEMD&lt;&#x2F;code&gt; (precompile)&lt;&#x2F;td&gt;&lt;td&gt;120&lt;&#x2F;td&gt;&lt;td&gt;8 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLAKE2&lt;&#x2F;code&gt; (precompile)&lt;&#x2F;td&gt;&lt;td&gt;3 (12 per 128 bytes)&lt;&#x2F;td&gt;&lt;td&gt;320 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;LOG*&lt;&#x2F;code&gt; (hashing data)&lt;&#x2F;td&gt;&lt;td&gt;256 (8 per byte)&lt;&#x2F;td&gt;&lt;td&gt;3.75 million&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;These hash functions have been optimized for rapid CPU computation, so CPUs can compute them quickly: for example, this author&#x27;s laptop can compute a 160-million byte keccak in less than half a second. In ZK-SNARKs, however, these operations are &lt;em&gt;very&lt;&#x2F;em&gt; time-consuming and inefficient. This is mitigated in newer proof systems based on small fields, but hashes remain underpriced.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Previous value&lt;&#x2F;th&gt;&lt;th&gt;New value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KECCAK_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;30&lt;&#x2F;td&gt;&lt;td&gt;300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KECCAK_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SHA256_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;td&gt;300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SHA256_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;60&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RIPEMD_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;600&lt;&#x2F;td&gt;&lt;td&gt;600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;RIPEMD_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;120&lt;&#x2F;td&gt;&lt;td&gt;120&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLAKE2_GFROUND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GLOGBYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Change the above parameters to their new values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The above increases the gas costs of all opcodes and precompiles that can be used to require large amounts of hashing in the EVM. All hashing costs are increased to 300 per hash plus 60 per word (or kept the same if they are already higher than this).
&#x27;&quot;
A possible alternative to this approach is to implement either multidimensional gas pricing (ie. a separate floating basefee and per-block target and limit for hashes) or a &quot;total gas cost floor&quot; similar to what &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; does for calldata. However, this approach is much harder to implement for in-EVM gas costs such as hashes than it is for calldata and blobs, because EVM gas limits are set not just by users, for whom new transaction types that specify newly required limits, max-basefees and priority fees can easily be added, but also by contracts making sub-calls to other contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;For most applications, a reasonable upper bound is that data that is getting hashed in the EVM is getting brought in as calldata. If the hashing being done is binary Merkle proof verification, every 32 bytes of data corresponds to a 64-byte (2-word) hash. A word of costs 512 gas. Under the new costs, the hashing per word in that situation would be &lt;code&gt;300 + 60 * 2 = 420&lt;&#x2F;code&gt; gas. Hence, this will increase gas consumption for that component of the application by less than 2x.&lt;&#x2F;p&gt;
&lt;p&gt;Concretely, a length-20 Keccak-based binary Merkle proof gas cost would increase from &lt;code&gt;(512 + 42) * 20 = 11080&lt;&#x2F;code&gt; to &lt;code&gt;(512 + 420) * 20 = 18640&lt;&#x2F;code&gt;. This is a small increase, especially taking into account other costs associated with such an application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As no new operations are introduced or made cheaper, no security concerns were raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove bloom filters</title>
        <published>2024-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7668/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7653-remove-bloom-filters/19447" />
        

        <id>https://wg-eips.ritovision.com/7668/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7668"
            label="EIP-7668" />
        

        
        

        
        <summary type="html">Remove bloom filters from the execution block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7668/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Require the bloom filters in an execution block, including at the top level and in the receipt object, to be empty.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Logs were originally introduced to give applications a way to record information about onchain events, which decentralized applications (dapps) would be able to easily query. Using bloom filters, dapps would be able to quickly go through the history, identify the few blocks that contained logs relative to their application, and then quickly identify which individual transactions have the logs that they need.&lt;&#x2F;p&gt;
&lt;p&gt;In practice, this mechanism is far too slow. Almost all dapps that access history end up doing so not through RPC calls to an Ethereum node (even a remote-hosted one), but through centralized extra-protocol services.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes recognizing that reality, and removing bloom filters from the protocol. Applications that need history querying would be encouraged to develop and use decentralized protocols that create provable log indexes using eg. ZK-SNARKs and incrementally-verifiable computation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The logs bloom of an execution block is now required to be empty (ie. 0 bytes long). The logs bloom of a transaction receipt is now required to be empty (ie. 0 bytes long).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is a minimally disruptive way to remove the need to handle blooms from clients. A future EIP can later clean up by removing this field entirely, along with other fields that have been deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;Gas costs of LOG are not reduced, because while the externality of polluting the bloom filter no longer needs to be accounted for, the costs of hashing have increased due to the needs of ZK-SNARK EVM implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that depend on bloom filters to read events will cease to work. Very few applications depend on this feature today, because at current gas limits the false positive rate is so high and processing the logs in a long history query is so slow, especially for light clients (whom this feature was primarily intended to benefit).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As no new features are introduced or made cheaper, no security concerns are raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Access-Key opcode</title>
        <published>2024-03-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Diederik Loerakker</name><uri>https://github.com/protolambda</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7664/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/access-key-opcode/19395" />
        

        <id>https://wg-eips.ritovision.com/7664/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:7664"
            label="EIP-7664" />
        

        
        

        
        <summary type="html">The access-key opcode enables contracts to read inputs that are statically declared in access-lists.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7664/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode to inspect the access-list keys of the executing address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP serves as a substitute of top-level-call detection to enable a smart-contract to
enforce static declaration of attributes.&lt;&#x2F;p&gt;
&lt;p&gt;Previously, application-layer contracts, against common advice from account-abstraction proponents, used to rely
on the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to enforce a top-level call, such that the contract inputs are encoded as transaction input.&lt;&#x2F;p&gt;
&lt;p&gt;While the access-list of transactions directly affects the execution, it only affects the gas-costs.
This EIP enhances the access-list feature to provide the property of statically-defined contract-inputs,
without relying on top-level calls, the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; behavior, or gas introspection.&lt;&#x2F;p&gt;
&lt;p&gt;This enables smart contracts to reliably enforce static declaration of inputs.&lt;&#x2F;p&gt;
&lt;p&gt;This is a step towards fulfilling the purposes as described in the Motivation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Introduces the access list format and the logic for handling the format.
This logic can later be repurposed for many other purposes, including block-wide witnesses,
use in ReGenesis, moving toward static state access over time, and more.&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_KEY_OPCODE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_KEY_OPCODE_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x4B&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;opcode&quot;&gt;Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;We add an instruction &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt; (with opcode &lt;code&gt;ACCESS_KEY_OPCODE_BYTE&lt;&#x2F;code&gt;) which pops &lt;code&gt;index&lt;&#x2F;code&gt; from the top
of the stack as big-endian &lt;code&gt;uint256&lt;&#x2F;code&gt;, and pushes &lt;code&gt;tx.access_list[address][index]&lt;&#x2F;code&gt; back on the stack,
if &lt;code&gt;address&lt;&#x2F;code&gt; is present in the &lt;code&gt;tx.access_list&lt;&#x2F;code&gt; and &lt;code&gt;index &amp;lt; len(tx.access_list[address])&lt;&#x2F;code&gt;,
and otherwise pushes a zeroed &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode has a fixed gas cost of &lt;code&gt;ACCESS_KEY_OPCODE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic gas costs of the access-list contents of the transaction itself do not change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;static-analysis-of-transactions&quot;&gt;Static analysis of transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Static declaration of contract-inputs enables advanced layer-two constructions and block-building techniques:
data is available without EVM introspection, and contracts can reliably tell if the executing transaction
declared critical properties to the block builder and verifying nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Static-declaration of contract inputs is now independent of account-abstraction related changes,
such as transaction bundlers, as well as in-protocol with 3074.&lt;&#x2F;p&gt;
&lt;!-- EIP link&#x2F;requires omitted due to Walidator EIP status bug --&gt;
&lt;h3 id=&quot;global-read-only-values&quot;&gt;Global read-only values&lt;&#x2F;h3&gt;
&lt;p&gt;Akin to &lt;code&gt;TLOAD&lt;&#x2F;code&gt;, as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;,
the &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt; opcode provides contracts with a view that is global
to the message-execution of the transaction in the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;However, with &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt; it is guaranteed to be read-only, and cannot change during the execution of a transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;access-list-utility&quot;&gt;Access-list utility&lt;&#x2F;h3&gt;
&lt;p&gt;Access-lists are under-utilized today:
very few users utilize this to warm-up storage interactions for reduced gas costs.
Generally the gas cost savings achieved with EIP-2930 are not applicable in as many use-cases.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, the utility of the access-list functionality increases,
without requiring additional resources from the EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;witness-data&quot;&gt;Witness data&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP supports the transformation of applications to reduce statefulness,
by supporting read-only application state to be provided to contracts without
requiring the contract caller to support forwarding of data.&lt;&#x2F;p&gt;
&lt;p&gt;The access-list contents may contain witness-data, which the contract can verify and utilize statelessness.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs-1&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost of &lt;code&gt;ACCESS_KEY_OPCODE_GAS&lt;&#x2F;code&gt; gas matches that of similar operations,
specifically the &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; opcode of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;:
this opcode also pop an index-like EVM word from the stack,
and pushes a full 32 byte EVM word back on the stack, based on a list of hashes embedded in the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; is not re-usable for the purposes of this EIP however,
as the intention is to have access to just the statically declared hash, and not the cost of a blob.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-of-access-key&quot;&gt;Naming of &lt;code&gt;ACCESS_KEY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Access-lists currently only support a list of access-keys.
The list is not enforced to be sorted, and thus supports indexed lookups.&lt;&#x2F;p&gt;
&lt;p&gt;This is not a &lt;code&gt;LOAD&lt;&#x2F;code&gt; opcode, as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; or &lt;code&gt;TLOAD&lt;&#x2F;code&gt; are, since the opcode returns a key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;no-transaction-type-changes&quot;&gt;No transaction-type changes&lt;&#x2F;h3&gt;
&lt;p&gt;This enhancement of access-lists utility does not affect the access-list encoding,
or the existing transaction types that support access-lists.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-impact-on-evm-transaction-context&quot;&gt;Minimal impact on EVM transaction-context&lt;&#x2F;h3&gt;
&lt;p&gt;With EIP-2930, the access-list contents are already readily available in the transaction-context during EVM execution,
and the RPC methods that trigger said execution.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP thus does not require significant changes to the construction of the EVM context,
nor any changes to RPC methods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The block fee-recipient, and any other warmed-up attributes not declared statically in the transaction access-list,
must not be considered to be part of the access-list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The access-list attributes are already gas-metered in EIP-2930,
and readily accessible in the EVM to determine storage gas-costs. In terms of denial-of-service risks,
this EIP introduces no new significant data or data-processing costs.&lt;&#x2F;p&gt;
&lt;p&gt;The access-list is read-only, and thus forms a minimal risk to application-developers.&lt;&#x2F;p&gt;
&lt;p&gt;The access is scoped strictly to the contract that would otherwise perform a warm &lt;code&gt;SLOAD&lt;&#x2F;code&gt;,
and thus storage-layout abstractions do not leak between different smart contract applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sync committee slashings</title>
        <published>2024-03-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7657/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7657-sync-committee-slashings/19288" />
        

        <id>https://wg-eips.ritovision.com/7657/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7657"
            label="EIP-7657" />
        

        
        

        
        <summary type="html">Slashing condition for malicious sync committee messages</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7657/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a slashing condition for malicious &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;altair&#x2F;validator.md#containers&quot;&gt;sync committee messages&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A dishonest supermajority of sync committee members is able to convince applications relying on Ethereum&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md&quot;&gt;light client sync protocol&lt;&#x2F;a&gt; to assume a non-canonical finalized header, and to potentially take over the sync authority for future &lt;code&gt;SyncCommitteePeriod&lt;&#x2F;code&gt;. By signing a malicious beacon block root, a malicious (but valid!) &lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt; message can be formed and subsequently used to, for example, exploit a trust-minimized bridge contract based on the light client sync protocol.&lt;&#x2F;p&gt;
&lt;p&gt;An additional type of slashing is introduced to deter against signing non-canonical beacon block roots as a sync committee member. As is the case with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#proposerslashing&quot;&gt;&lt;code&gt;ProposerSlashing&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#attesterslashing&quot;&gt;&lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;, only malicious behaviour is slashable. This includes simultaneous contradictory participation across multiple chain branches, but a validator that is simply tricked into syncing to an incorrect checkpoint should not be slashable even though it is participating on a non-canonical chain. Note that a slashing must be verifiable even without access to history, e.g., by a checkpoint synced beacon node.&lt;&#x2F;p&gt;
&lt;p&gt;Note that regardless of the slashing mechanism, a slashing can only be applied retroactively after an attack has already occurred. Use cases that secure a larger amount than &lt;code&gt;SYNC_COMMITTEE_SIZE * MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; = &lt;code&gt;512 * 32 ETH&lt;&#x2F;code&gt; = &lt;code&gt;16384 ETH&lt;&#x2F;code&gt; (on mainnet) should combine the light client sync protocol with other established methods such as a multisig, or may want to require posting additional collateral to be eligible for submitting updates. Other methods are out of scope for this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-transition-checks&quot;&gt;State transition checks&lt;&#x2F;h3&gt;
&lt;p&gt;Note: This still allows having contradictions between attestations&#x2F;proposals and sync committee messages. This also, by design, allows a validator to not participate at all in honest sync committee messages but solely participate in dishonest sync committee messages.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCK_STATE_ROOT_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(BeaconBlock, &#x27;state_root&#x27;)&lt;&#x2F;code&gt; (= 11)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_BLOCK_ROOTS_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(BeaconState, &#x27;block_roots&#x27;)&lt;&#x2F;code&gt; (= 37)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(BeaconState, &#x27;historical_roots&#x27;)&lt;&#x2F;code&gt; (= 39)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;get_generalized_index(HistoricalBatch, &#x27;block_roots&#x27;)&lt;&#x2F;code&gt; (= 2)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attested_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_sync_committee_branch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finality_branch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Vector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;BLSPubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SYNC_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOCK_STATE_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SyncCommitteeSlashing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ValidatorIndex&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SYNC_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee_branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finality_branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_valid_sync_committee_slashing_evidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashingEvidence&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                                              recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                                              recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;                                              genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sync committee has sufficient participants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_SYNC_COMMITTEE_PARTICIPANTS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the `finality_branch`, if present, confirms `finalized_header`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to match the finalized checkpoint root saved in the state of `attested_header`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note that the genesis finalized checkpoint root is represented as a zero hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GENESIS_SLOT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlockHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            finalized_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            finalized_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_merkle_branch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;finalized_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finality_branch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;get_subtree_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FINALIZED_ROOT_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the `next_sync_committee`, if present, actually is the next sync committee saved in the&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; state of the `attested_header`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; SyncCommittee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_merkle_branch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee_branch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;get_subtree_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NEXT_SYNC_COMMITTEE_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify that the `actual_finalized_block_root`, if present, is confirmed by `actual_finalized_branch`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; to be the block root at slot `finalized_header.slot` relative to `recent_finalized_block_root`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        distance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; distance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; GeneralizedIndex&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_STATE_ROOT_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; distance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;STATE_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STATE_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STATE_HISTORICAL_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `mix_in_length`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                historical_batch_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_ROOTS_LIMIT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; historical_batch_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORICAL_BATCH_BLOCK_ROOTS_INDEX&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `mix_in_length`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            block_root_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block_root_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_valid_merkle_branch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            branch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_branch&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            depth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;floorlog2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;get_subtree_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;gindex&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sync committee aggregate signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    participant_pubkeys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fork_version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_fork_version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;compute_epoch_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    domain&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_domain&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DOMAIN_SYNC_COMMITTEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fork_version&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signing_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_signing_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; domain&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; bls&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;FastAggregateVerify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;participant_pubkeys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signing_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncCommitteeSlashing&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that evidence is ordered descending by `attested_header.slot` and is not from the future&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only conflicting data among the current and previous sync committee period is slashable;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on new periods, the sync committee initially signs blocks in a previous sync committee period.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This allows a validator synced to a malicious checkpoint to contribute again in a future period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; evidence_1_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is not allowed to sign conflicting `attested_header` for a given slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;attested_header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is not allowed to sign conflicting finalized `next_sync_committee`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_1_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evidence_2_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evidence_1_attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_attested_period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; evidence_1_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_1_attested_period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2_attested_period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;next_sync_committee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; It is not allowed to sign a non-linear finalized history&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_block_root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing_evidence_has_finality&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkle proofs may be included to indicate that `finalized_header` does not match&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the `actual_finalized_block_root` relative to a given `recent_finalized_block_root`.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The finalized history is linear. Therefore, a mismatch indicates signing on an unrelated chain.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note that it is not slashable to sign solely an alternate history, as long as it is consistent.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This allows a validator synced to a malicious checkpoint to contribute again in a future period&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        linear_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        linear_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; linear_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; linear_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; linear_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; linear_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not slash on signing solely an alternate history&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; `actual_finalized_branch` may be rooted in the provided `finalized_header` with highest slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rooted_in_evidence_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; linear_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rooted_in_evidence_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;actual_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; linear_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Alternatively, if evidence about non-linearity cannot be obtained directly from an attack,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; it can be proven that one of the `finalized_header` is part of the canonical finalized chain&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; that our beacon node is synced to, while the other `finalized_header` is unrelated.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        rooted_in_canonical&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; compute_start_slot_at_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block_roots&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;recent_finalized_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOTS_PER_HISTORICAL_ROOT&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; rooted_in_evidence_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; rooted_in_evidence_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; rooted_in_canonical&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        is_slashable&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; is_slashable&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check that slashable validators are sorted, known, and participated in both signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    will_slash_any&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_committee_pubkeys_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; evidence_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_pubkeys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    participant_pubkeys_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate_1&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_pubkeys_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    participant_pubkeys_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;bit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; zip&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate_2&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_pubkeys_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; bit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slashable_validators&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sync_committee_slashing&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slashable_validators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_validators&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; num_validators&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            and&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; participant_pubkeys_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; participant_pubkeys_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_slashable_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            will_slash_any&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; will_slash_any&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate evidence, including signatures&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; is_valid_sync_committee_slashing_evidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evidence_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; is_valid_sync_committee_slashing_evidence&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evidence_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        recent_finalized_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;genesis_validators_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform slashing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; slashable_validators&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_slashable_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validators&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            slash_validator&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;what-s-the-use-case&quot;&gt;What&#x27;s the use case?&lt;&#x2F;h3&gt;
&lt;p&gt;Without a slashing, the light client sync protocol is somewhat limited. While wallet applications may benefit from it (the risk being, that incorrect data is displayed) and new beacon nodes may use it for accelerating chain synchronization, other interesting use cases such as bridges, token distributions or other systems requiring proofs depend on the mechanism providing higher security guarantees.&lt;&#x2F;p&gt;
&lt;p&gt;By making attacks by sync committee members slashable, a sufficiently high deterrent could be provided. A majority of the sync committee would have to be bribed to succeed in an attack even in the most simple cases, representing a sizable slashable balance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork as it introduces new consensus validation rules.&lt;&#x2F;p&gt;
&lt;p&gt;Supporting infrastructure may be introduced separately once the consensus validation rules are in place, including but not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Slashing protection DB updates, to guarantee that honest validators cannot be slashed on reorgs&lt;&#x2F;li&gt;
&lt;li&gt;Validator client &#x2F; remote signer APIs, to pass along information related to slashing protection&lt;&#x2F;li&gt;
&lt;li&gt;libp2p meshes for exchanging slashing evidence between beacon nodes&lt;&#x2F;li&gt;
&lt;li&gt;Slasher, to monitor potential targets and construct slashing evidence&lt;&#x2F;li&gt;
&lt;li&gt;Beacon APIs, to submit and monitor slashing evidence&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Light client data backfill</title>
        <published>2024-03-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7658/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7658-light-client-data-backfill/19290" />
        

        <id>https://wg-eips.ritovision.com/7658/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7658"
            label="EIP-7658" />
        

        
        

        
        <summary type="html">Mechanism for beacon nodes for syncing historical light client data</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7658/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a mechanism for syncing &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;full-node.md&quot;&gt;light client data&lt;&#x2F;a&gt; between beacon nodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;full-node.md&quot;&gt;Light client data&lt;&#x2F;a&gt; is collected by beacon nodes to assist &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;light-client.md&quot;&gt;light clients&lt;&#x2F;a&gt; to sync with the network. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md&quot;&gt;sync protocol&lt;&#x2F;a&gt; defines a mechanism to sync forward in time. However, it cannot be used to sync backward.&lt;&#x2F;p&gt;
&lt;p&gt;Collecting light client data is challenging because beacon nodes need to have access to the corresponding &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#signedbeaconblock&quot;&gt;&lt;code&gt;SignedBeaconBlock&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. &lt;code&gt;BeaconState&lt;&#x2F;code&gt; objects are not available before the initially synced checkpoint state, and &lt;code&gt;SignedBeaconBlock&lt;&#x2F;code&gt; objects have a limited retention period on libp2p.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, each &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#get_next_sync_committee&quot;&gt;sync committee period&lt;&#x2F;a&gt; consists of &lt;code&gt;EPOCHS_PER_SYNC_COMMITTEE_PERIOD * SLOTS_PER_EPOCH&lt;&#x2F;code&gt; slots. To support archive services such as Portal network to provide a consistent view regardless of backend, it is necessary to choose a single canonical slot for which to derive the representative light client data for that period. Such data should be verifiable to be canonical and optimal in a decentralized and independent manner.&lt;&#x2F;p&gt;
&lt;p&gt;To support light client data backfill, this EIP proposes to track the canonical and optimal &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;beacon-chain.md#syncaggregate&quot;&gt;&lt;code&gt;SyncAggregate&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;. This minimal addition allows proving that derived &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md#lightclientupdate&quot;&gt;&lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md#lightclientbootstrap&quot;&gt;&lt;code&gt;LightClientBootstrap&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; are also canonical and optimal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;containers&quot;&gt;Containers&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;new-containers&quot;&gt;New containers&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;syncdata&quot;&gt;&lt;code&gt;SyncData&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sync committee aggregate signature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncAggregate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Slot at which the aggregate signature was created&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_slot&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;extended-containers&quot;&gt;Extended containers&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;beaconstate&quot;&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;New fields are added to the end of &lt;code&gt;BeaconState&lt;&#x2F;code&gt; from the activating fork onward to track the current and previous sync committee period&#x27;s best sync data.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Sync history&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;default-sync-data&quot;&gt;&lt;code&gt;default_sync_data&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; default_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        sync_aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;SyncAggregate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            sync_committee_bits&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bitvector&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SYNC_COMMITTEE_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            sync_committee_signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;G2_POINT_AT_INFINITY&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;GENESIS_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;beacon-chain-state-transition-function&quot;&gt;Beacon chain state transition function&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;epoch-processing&quot;&gt;Epoch processing&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;modified-process-sync-committee-updates&quot;&gt;Modified &lt;code&gt;process_sync_committee_updates&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;On sync committee boundaries, current period data is moved to previous period. This allows proving that light client data for the previous period is canonical.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_sync_committee_updates&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_current_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; Epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; next_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EPOCHS_PER_SYNC_COMMITTEE_PERIOD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;previous_best_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; default_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h4&gt;
&lt;p&gt;Block processing is extended to track the optimal light client data for the current period. Due to the possibility for empty slots this must be tracked before the block header is overwritten; this allows tracking the exact block after which &lt;code&gt;next_sync_committee&lt;&#x2F;code&gt; becomes finalized.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    process_block_header&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;new-process-best-sync-data&quot;&gt;New &lt;code&gt;process_best_sync_data&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconState&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BeaconBlock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period_at_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;latest_block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track sync committee finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    old_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ALTAIR_FORK_EPOCH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_sync_committee_period&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;finalized_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;finalized_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; attested_period&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent_block_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Track best sync data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; attested_period&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; signature_period&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        old_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_committee_bits&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; max_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        old_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; max_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; new_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_has_supermajority&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_has_supermajority&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; new_has_supermajority&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_has_sync_committee_finality&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_num_active_participants&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; old_num_active_participants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            is_better_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature_slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; is_better_sync_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;current_best_sync_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; SyncData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;                sync_aggregate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;body&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sync_aggregate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;                signature_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;how-to-rank-syncaggregate&quot;&gt;How to rank &lt;code&gt;SyncAggregate&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The EIP reuses the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4afe39822c9ad9747e0f5635cca117c18441ec1b&#x2F;specs&#x2F;altair&#x2F;light-client&#x2F;sync-protocol.md#is_better_update&quot;&gt;&lt;code&gt;is_better_update&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; function from existing specs.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure deterministic selection when participation and finality are equal, implementations MUST break ties by preferring the lower &lt;code&gt;signature_slot&lt;&#x2F;code&gt;; if equal, the existing selection SHOULD be retained.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-could-a-backfill-protocol-use-this&quot;&gt;How could a backfill protocol use this?&lt;&#x2F;h3&gt;
&lt;p&gt;Once the data is available in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;, a light client data backfill protocol could be defined that serves, for past periods:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A &lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt; from requested &lt;code&gt;period&lt;&#x2F;code&gt; + 1 that proves that the entirety of &lt;code&gt;period&lt;&#x2F;code&gt; is finalized.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BeaconState.historical_summaries[period].block_summary_root&lt;&#x2F;code&gt; at (1)&#x27;s &lt;code&gt;attested_header.beacon.state_root&lt;&#x2F;code&gt; + Merkle proof.&lt;&#x2F;li&gt;
&lt;li&gt;For each epoch&#x27;s slot 0 block within requested &lt;code&gt;period&lt;&#x2F;code&gt;, the corresponding &lt;code&gt;LightClientHeader&lt;&#x2F;code&gt; + Merkle multi-proof for the block&#x27;s inclusion into (2)&#x27;s &lt;code&gt;block_summary_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;For each of the entries from (3) with &lt;code&gt;beacon.slot&lt;&#x2F;code&gt; within &lt;code&gt;period&lt;&#x2F;code&gt;, the &lt;code&gt;current_sync_committee_branch&lt;&#x2F;code&gt; + Merkle proof for constructing &lt;code&gt;LightClientBootstrap&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If (4) is not empty, the requested &lt;code&gt;period&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;current_sync_committee&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The best &lt;code&gt;LightClientUpdate&lt;&#x2F;code&gt; from &lt;code&gt;period&lt;&#x2F;code&gt;, if one exists, + Merkle proof that its &lt;code&gt;sync_aggregate&lt;&#x2F;code&gt; + &lt;code&gt;signature_slot&lt;&#x2F;code&gt; is selected as the canonical best one in (1)&#x27;s &lt;code&gt;attested_header.beacon.state_root&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Only the proof in (6) depends on &lt;code&gt;BeaconState&lt;&#x2F;code&gt; tracking the best light client data. This modification would enshrine the logic of a subset of &lt;code&gt;is_better_update&lt;&#x2F;code&gt;, but does not require adding any &lt;code&gt;LightClientXyz&lt;&#x2F;code&gt; data structures to the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork as it introduces new consensus validation rules.&lt;&#x2F;p&gt;
&lt;p&gt;Only light client data following the hard fork can be proven to be canonical and optimal. However, after finalization of the fork transition block, earlier light client data can no longer change and could be locked in using a hash.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Programmable access lists</title>
        <published>2024-03-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	<author>
		<name>Zhiqiang Xu</name><uri>https://github.com/zhiqiangxu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7650/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7650-programmable-access-lists/19159" />
        

        <id>https://wg-eips.ritovision.com/7650/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7650"
            label="EIP-7650" />
        

        
        

        
        <summary type="html">Add a precompiled contract that add access lists programmatically</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7650/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new precompiled contract named &lt;code&gt;prefetch&lt;&#x2F;code&gt;, which accepts an &lt;code&gt;accessList&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;accessList&lt;&#x2F;code&gt; specifies a list of addresses and local storage keys; these addresses and local storage keys are added into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets (introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). Similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, prefetching data through this precompile incurs a gas charge, albeit at a reduced rate compared to accesses made outside of this list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The primary goal of this EIP is to enhance EIP-2930 by enabling contracts to add access lists programmatically. The advantage of implementing this precompile within a contract is the sustained reduction in gas costs for data access operations, leveraging the concurrent computing and IOs that most nodes have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PREFETCH_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONCURRENCY&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new precompile is deployed at &lt;code&gt;PREFETCH_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;.  The encoding of the precompile input is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[32 bytes for local storage key length n][n * 32 bytes local storage keys][32 bytes for address length m][m * 32 bytes addresses]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the beginning of the call, we will charge &lt;code&gt;2100 * (N + CONCURRENCY - 1) &#x2F;&#x2F; CONCURRENCY + 2600 * (M + CONCURRENCY - 1) &#x2F;&#x2F; CONCURRENCY&lt;&#x2F;code&gt;, where &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is the integer division operator, &lt;code&gt;N&lt;&#x2F;code&gt; is the number of local storage keys not in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global set, and &lt;code&gt;M&lt;&#x2F;code&gt; is the number of addresses not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; global set. The client should concurrently read the keys and addresses and put the keys and addresses into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets.  The following read cost of the storage keys and addresses obeys &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;Using UniswapV2 &lt;code&gt;swap()&lt;&#x2F;code&gt; function as an example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; this low-level function should be called from a contract which performs important safety checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefetch {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token0.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token1.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             reserve0.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             price0CumulativeLast.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             price1CumulativeLast.slot,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } &#x2F;&#x2F; add the storage keys `accessed_storage_keys`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        prefetch {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;             token1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } &#x2F;&#x2F; add the contracts of token0 and token1 to `accessed_addresses`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;charging-less-for-accesses-in-the-access-list&quot;&gt;Charging less for accesses in the access list&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to EIP-2930, we encourage contract developers to use the &lt;code&gt;prefetch&lt;&#x2F;code&gt; precompile as much as possible, especially assuming the nodes have some decent concurrent capabilities (e.g., some cores and IO bandwidth).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-duplicates&quot;&gt;Allowing duplicates&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to EIP-2930, we allow duplicates in the list to maximize simplicity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-storage-keys-for-external-contract&quot;&gt;No storage keys for external contract&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike EIP-2930, the &lt;code&gt;prefetch&lt;&#x2F;code&gt; precompile only accepts local storage keys and addresses. Prefetching the data of the storage keys of external contracts assumes that the contract knows the storage layout of an external contract, which may not be a good practice. To better employ the concurrency of a node, the precompile may accept a list of static calls of external contracts together with the calldata.  This work may be done in the future EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;If the EIP is not yet implemented, a contract calling the precompile should result in no operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Alias ORIGIN to SENDER</title>
        <published>2024-03-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Cyrus Adkisson</name><uri>https://github.com/cyrusadkisson</uri>
	</author>
	
	<author>
		<name>Eirik Ulversøy</name><uri>https://github.com/EirikUlversoy</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7645/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7645-alias-origin-to-sender/19047" />
        

        <id>https://wg-eips.ritovision.com/7645/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7645"
            label="EIP-7645" />
        

        
        

        
        <summary type="html">Eliminate ORIGIN tech debt to lay groundwork for account abstraction and close security holes</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7645/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes aliasing the ORIGIN opcode to the SENDER opcode within the Ethereum Virtual Machine (EVM). The purpose of this change is to move Ethereum closer to enabling account abstraction by harmonizing the treatment of externally owned accounts (EOAs) and smart contracts and to address the security concerns associated with the use of ORIGIN that have and will continue to surface in all or most account abstraction proposals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The ORIGIN opcode in Ethereum returns the address of the account that started the transaction chain, differing from the SENDER (or CALLER) opcode, which returns the address of the direct caller. The use of ORIGIN has been discouraged and deemed deprecated since mid-2016 due to the security problems it introduces, such as susceptibility to phishing attacks and other vulnerabilities where the distinction between the original sender and the immediate sender can be exploited.&lt;&#x2F;p&gt;
&lt;p&gt;For instance, if an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; bundler has tokens or other authority in a smart contract determined by ORIGIN, any of the transactions it bundles can hijack this authority since ORIGIN remains the bundler address throughout each child transaction.&lt;&#x2F;p&gt;
&lt;p&gt;More apropos in the current context of EVM evolution, the differentiation between the ORIGIN and SENDER opcodes presents a challenge for all account abstraction efforts, such as those outlined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7377&#x2F;&quot;&gt;EIP-7377&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;, because any move towards account abstraction must address the ORIGIN opcode&#x27;s role, either by modifying or completely bypassing it. Without addressing this, the ORIGIN opcode stands as a barrier to the evolution of Ethereum&#x27;s account model towards greater flexibility and functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes the alteration of the behavior of the ORIGIN opcode within the Ethereum Virtual Machine (EVM). Currently, the ORIGIN opcode returns the address of the original transaction initiator. Under this EIP, the ORIGIN opcode would, instead, return the same value as the SENDER opcode, which is the address of the immediate sender of the message or transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Definition Change: The ORIGIN opcode (0x32) MUST, in all contexts of execution, return the same value as that returned by the SENDER (also known as CALLER) opcode (0x33).&lt;&#x2F;p&gt;
&lt;p&gt;EVM Implementation: All Ethereum clients MUST implement the following change to the EVM: Whenever the ORIGIN opcode is called, the value to be pushed onto the stack is the current call&#x27;s sender address, as if the SENDER opcode was executed instead.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction Validation: Transactions MUST be validated as before, with no changes to the transaction structure or processing logic beyond the EVM opcode behavior specified above.&lt;&#x2F;p&gt;
&lt;p&gt;Compatibility: Smart contracts relying on the ORIGIN opcode for obtaining the transaction initiator&#x27;s address MUST be reviewed to ensure they function correctly under the new definition and worked-around or avoided if this EIP introduces breaking changes.&lt;&#x2F;p&gt;
&lt;p&gt;Implementers are encouraged to provide feedback on this specification and report any potential issues encountered during the implementation or testing phases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind aliasing ORIGIN to SENDER is to:&lt;&#x2F;p&gt;
&lt;p&gt;Facilitate Account Abstraction: Elegantly nullify a universal barrier to account abstraction, enabling more flexible and powerful account models in Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Enhance Security: Eliminate the security vulnerabilities associated with differentiating between the original transaction initiator and the immediate caller.&lt;&#x2F;p&gt;
&lt;p&gt;Clean up tech debt and simplify the EVM Model: Reduce the complexity of the EVM&#x27;s transaction and execution model by removing an outdated and deprecated feature, making future changes easier and safer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not fully backwards compatible. Contracts relying on the distinction between ORIGIN and SENDER for logic or security will be affected. However, given the longstanding discouragement of ORIGIN&#x27;s use, the minimal impact of the change, the widespread desire for a future account abstraction solution in the EVM, and the reality that any AA solution will ultimately have to deal with ORIGIN one way or the other, this incompatibility is considered a necessary step forward for Ethereum&#x27;s development.&lt;&#x2F;p&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;For each CALL, STATICCALL, DELEGATECALL, CALLCODE:&lt;&#x2F;p&gt;
&lt;p&gt;Direct - Ensure that, at the target smart contract, ORIGIN and SENDER produce the same value. (For simple no-hop EOA-to-EOA&#x2F;SCA transactions, this is already the case today.)&lt;&#x2F;p&gt;
&lt;p&gt;Multi-hop - Ensure that, at each frame in a multi-hop transaction, ORIGIN and SENDER produce the same value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;By aliasing ORIGIN to SENDER, the specific security vulnerabilities associated with the ORIGIN opcode are addressed and eliminated. Outside the scope of this EIP, it may be wise to ban all use of ORIGIN to eliminate further misunderstanding or misuse. This can be done via tooling changes outside the EVM or, inside the EVM, reverting smart contract deployments that use ORIGIN.&lt;&#x2F;p&gt;
&lt;p&gt;For existing misuse of ORIGIN affected negatively by this aliasing to SENDER (of yet a clear example has yet to be identified), it may be necessary to educate users to avoid this problematic legacy code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>History accumulator for pre-PoS data</title>
        <published>2024-02-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>kdeme</name><uri>https://github.com/kdeme</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7643/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7643-history-accumulator-for-pre-pos-data/19014" />
        

        <id>https://wg-eips.ritovision.com/7643/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7643"
            label="EIP-7643" />
        

        
        

        
        <summary type="html">Commit to a single root for all block data before the merge.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7643/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Defines an SSZ object for accumulating all pre-PoS data and commit to the
historical hashes accumulator&#x27;s root
&lt;code&gt;0xec8e040fd6c557b41ca8ddd38f7e9d58a9281918dc92bdb72342a38fb085e701&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are two main uses we consider for the historical hashes accumulator:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;for users who wish to download the pre-PoS data for the execution chain and
verify it without executing each block, they may simply compute each block
hash, accumulate the epoch records, and then compare the local accumulator
root with the expected value.&lt;&#x2F;li&gt;
&lt;li&gt;additionally, the accumulator root allows for &lt;code&gt;O(log(n))&lt;&#x2F;code&gt; sized proofs to any
pre-PoS block, whereas today to achieve something similar, one must
recursively verify the header chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;historical-hashes-accumulator&quot;&gt;Historical Hashes Accumulator&lt;&#x2F;h3&gt;
&lt;p&gt;The historical hashes accumulator commits to the set of pre-merge headers and their
associated total difficulty. The format for this data is defined as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;EPOCH_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8192&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_HISTORICAL_EPOCHS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An individual record for a historical header.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HeaderRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;block_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; total_difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The records of the headers from within a single epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;EpochRecord&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;HeaderRecord&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_length&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;EPOCH_SIZE&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;HistoricalHashesAccumulator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Container&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    historical_epochs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; max_length&lt;&#x2F;span&gt;&lt;span&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_HISTORICAL_EPOCHS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; EpochRecord&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;pre-pos-root&quot;&gt;Pre-PoS Root&lt;&#x2F;h3&gt;
&lt;p&gt;The hash tree root of &lt;code&gt;HistoricalHashesAccumulator&lt;&#x2F;code&gt; for data before block 15537394 is
&lt;code&gt;0xec8e040fd6c557b41ca8ddd38f7e9d58a9281918dc92bdb72342a38fb085e701&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;inclusion-of-total-difficulty&quot;&gt;Inclusion of total difficulty&lt;&#x2F;h3&gt;
&lt;p&gt;The total difficulty allowed so that clients may return the value for specific
JSON-RPC methods which support it. It is also useful for verifying the TTD of
the final proof-of-work block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;n&#x2F;a&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;csv&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;epoch,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00000,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ec1ffb8c3b146f42606c74ced973dc16ec5a107c0345858c343fc94780b4218&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00001,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5364e9a9bc513c4601f0d62e6b46dbdedf3200bbfae54d6350f46f2c7a01938&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00002,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98cbd8a95ae7dc9c1ed823156d0eab9aaffa869f6852cab18ff0083063f27d26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00003,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8b8a40b8cf6818e1bac871d882e772be0b28d1baaf72374946506d9e6fa7d75&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00004,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e3baba7e324b99ed72d98f0255d25ce66832736550f8b971c12280eac2a0bb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00005,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cff5a4b7284b1a4a6cebfcc80d876ab0418f71254d03f91d46a9a1fab49fa09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00006,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x678fb79306f84e9d0a4749323dc29934ca59b852fbc7c8d2890eabe8a0cde282&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00007,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9bc682bc5bc63b20a8344407ae12cb17e2085d448f438efa6aa5d522b913a20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00008,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12c9605f2d8d4738f9aa04fbecdbbbc8b77135ebfaa9db399135c14e1ef10bee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00009,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9e4e8905b214c97bb4ed1f69178d6ecc769e21352885147fce5b671215db2a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00010,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f5d4516b7a38929b47ea7334b62b53829b9665d37f752d96c33fad0f7f78583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00011,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x30f04eb968efe4079356b873e37f1657984717e60af612ecca95c98226528d54&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00012,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ecb9bf9e193da08c7e7f22abcd50d1b4d3c2b909f980ac1315856cb48ca49cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00013,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0175c1ed6e694180c4c161ac7f06a913784daba14dc1d2e926f72def4f7f65d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00014,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f92d78141b7fa8d6fcef45f9dbc611f858447629eeac2d63bb43d07e6bd1aca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00015,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa47cb8eb7157d56f718a6896c2ee1843a44e3de81b9127e64b78fc38ee382310&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00016,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9344d8b785c0e619d0b1b83e5d7b3849d667f1ec0d0d6390d26fa33dd4cb31af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00017,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x43963724de4a8917d16d8c6a663c38fcdcf3ce5b89a51bc766dcd0ffd1d5aa32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00018,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefce27b480c92a0e7fec472fe38e87ed9a1c91c3d07324cc2f262de3916a38f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00019,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf5434352253a7f35d909fb2c383e7cdad65761c509eec24741197b869ebcc212&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00020,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c405203cb7b2e54b910e5d953b5378ff4f0c3bcebef92e7e3a1f240dd6703ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00021,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20d8f1af038c2777dea9f86fe9e33f14af9e4270ee20adb32e0dddedc4b85236&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00022,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb694d8955851f744e44c68fba193f6bc41d1159036531c5f55fac9ce91883695&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00023,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11beacba76e467dda23253f104d064b00ab75672ab33cff6097be1c3e8ce7053&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00024,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf216a28afb2212269b634b9b44ff327a4a79f261640ff967f7e3283e3a184c70&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00025,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x987cb6206e5bae4b68ce0eeb6c05ae090d02b7331e47d1705a2a515ac88475aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00026,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3afd50ff0edf3cae577c42bfc39871f0f0ffe7bdd5ee0b96f7b2e879c9b29994&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00027,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28083285c935c0c169ea1406f9830701ff20fde3d0b2a5b83efc1cd13139dccf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00028,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x362fc97cbcfa6ab609f1a3f8ca2f8a6e0ac6061c33e84a285a14713cfd73f203&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00029,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0cb99e26e896f5d115914910c4c66fc112ae240bc827acdd564785e738ff29c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00030,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78fc5e8e58e6dd726499295eea1f7f52a31979c6a003d48d4e027d95285e851c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00031,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x52306cf9ed840bea9d8c3466bfbed5ffecdfd51107f33d013a487c3b653b3646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00032,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcb4d0c3a2384b890a8acd698da6b9ae6267c5365fcc516391829f7adbae838ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00033,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c3781bbc07124e29ff67754bdcf556b20ac4f4ef19ddb004837ec50193ce0bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00034,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfac9315aa442073b647e71716a7acf1c170e5a0092b69edc2a5634813716592f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00035,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x737e07578f0dd5eeebd8313e58cdb59ac705c0ba07d842feace53fa2922c6508&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00036,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84c7c1e7c4a8949247953858992012799d323ebcd0fc6cdecf8002f20f2ea7e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00037,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34d067652cbea843a01e70ba75566b6f174218969dc453c285e59b4f309faee8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00038,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38aaf94c653d619b1a08e7cf9fac72ecc57715bc19ba236c942d400742bc3f16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00039,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ad4940c51be350c9d8c69f424f01a9e87e42fe6b312afae3f8f7267c62512e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00040,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4707f60dffab08b6837078ae91316ebe04a275aa19892462521cb6125913d3d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00041,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6a87a9e797af923887645fc57602d60f7cd684357ae837a6270936eb6e5ebd5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00042,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c8dca3c7c7842995372aed15fae7b9bada264b56082bec19c870bd4c7562b97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00043,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcb513d912a6ee576a33cf3683d596354b57484cfb4d7e382f64326eef5bec32b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00044,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c72a3909e56831cea647e4c67faeb91db49b5be8c61832082041c16b2072e87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00045,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa87afdc1e1d225e6826d8f18c15c0415c7d13ba2a3933dc35816491bbc64501c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00046,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22b3f78d1437187866a86fc05463d5afa558903def2357a05ffd32663d5b7896&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00047,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92d8437253506251ea652d6242ced9f3941906d4ffaa78edcb396a6c5fcad7d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00048,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78ae53ed63f208b18448b40e3c31476eb2cd6627d6c65ba7dbc96d3e1051dcca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00049,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3934e9608386c1bab748cf80199b6b6341e581a163c64f6c0bfc55d36d41cc64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00050,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71698ebf74b826ce701bdda7c804c2b9d0aa3616bc1ccfbb62d4455cc2b0bec6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00051,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c1c77788b22e42409b9e068fc98a28310af7cb451dbdc2601d29771bb117c47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00052,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a047d9aba82db1eac26733dcc652c0aed663250b25781360ba9596db48ebe01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00053,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x161ee1b5102e9c6300c04d4885dda180e50f3e5078ca8d2bc1f3d0af0a9d8287&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00054,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x14074ce7acc2ad4e4d60966d9717d8f2e6f7d28cffa1fccede05d4ab7269b772&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00055,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae639ad86664191274136f85177a515b7524be9d089571f5e24c13bff9f91a38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00056,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd92c394c57df45119161e4ffecf8445e3af06c79c90987db86db649f2cbf7840&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00057,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bbe776e7229c9583ccc6da7d82451b56ef1fc015c802c27b2d364ffff7c6e7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00058,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ac60ed891eb7490ae1a5fa1d9c14ef66b01bf5fdc6f31a419a28c2946e0c3bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00059,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x246c1b33d8b91d3fad3c3b88d6aa04cd872bdf0608aafcd1f11a53c437418eec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00060,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4533d0c5d211593355e4bf1e07564fc04bc158e75437f33eb97ec9066322b3dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00061,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x122db1c231fee4e86b938a432ae95eae69a3ea733b82b15c2d784c70be3f9b89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00062,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65505079e3493c2fb572db2d1d9e455ef3e48be78c18f760fa6724fe1326f5ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00063,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x39b219117b1d306e0e9ac0a8f969d47f1cc375d7593e2c8e0996fbb80822f293&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00064,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb26a83cc55bf6f8c6ff63525fafd2c8dca1a0cd99828afcdbc5d3146da18dde&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00065,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1df3a40f96ae6291f081fcf9dab9ebe03382d958cde909a4cb7cdc76201fe006&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00066,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07bde22d34d4cd3a29214dd2bd1c35a49190a3df40505ddddde8e3622c6e7cab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00067,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x751bac833356761ab2a1794fed46b04afcbc60d23e608a707db5b897e5d042d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00068,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x546a10c136f0cb0c85bf58b69e04424ffcf1b00b4afffd3f33c5ee253899367b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00069,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55c236ed7566681663e88a71b9597a48970297cbc0ee8b23b1d302dfe69f61f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00070,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0ac3ebb18ec9ee6c921f36d5053d9343ad81218f797c39376d9e4f4352c768c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00071,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2fb03713d78b7fba05408f872267c4877ed8db5e1bd1b9f1e57d872c5cc08adf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00072,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f9a4a75044a49046297e71c578329b8326352fd49bd01158f42c73ea6948454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00073,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32871a4303777114e0f17126567013d94bb2884ea22bf0a103d45fef47c4b005&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00074,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8aacdeeec1021158c05056e5aa2ea4cc4994aa2372f5d37d22272ed065f7493d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00075,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x368ce2b13e74f99ef231825ba5df588d654ccaea62e0ff46d012b879608454d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00076,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x290a4131608502c9423b9ec4fdbb4cfdfa245ec92a571053702cb431d6d661ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00077,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5d736b0aecc493c6160872dbcc216816071483a4c4518a2284bbaad9a9c592c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00078,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98ac3e9dfdd27556bf5d5e037d10de525ad1142c1e954de9cc3b7e2287dc9ca9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00079,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95e0734eb17b4182d2458e6f5268abbc75c44e743b5abeb775d99bfdb1d1f6a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00080,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd778ae86ee6b3ed9f3f3dc83a5ece367faa9ea230daa21c07c54e073af83f2fe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00081,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2089ffc8e635baaf3e1673f9ca3ed6d64b1dd02dd73aa5c2beb692af5363a1a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00082,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x382ac3bc7f5de4df286366863351ae1d3655fe5df7aa195e3f955e5cb4988bed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00083,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ab1cca211eb959107d5541a30d1b9f3e8a6fcf9935643acabd4f2dff8f3d212&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00084,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ec0497d2130e92ea521793e98774962fe83ebd994fcac4963cede93950efaaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00085,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf847bef9c0f4876906d74c0955d362175cc4d9bb83f134d60dad7bf3df6d0b3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00086,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dd5eb92d78e345af8ac60db208207fe3f4621e5ea09f195da8c977418c358fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00087,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0612d68f34fc28c18a095b0062d5762cf56d5c6554d94a0e97315ef262a4dd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00088,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f433e6334fa2b3d05edd615d92926aaec56b355f9375e3ea4b91ca0dd7c654d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00089,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0432ee13cd0aab4c445219c8edcbf80bd502d11170a2724cabad19f55d8f2ad1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00090,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf23b0c8c31f2368dc982efbf1220f64439b107d691450a3eb15dca1180f5854&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00091,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9fbb0197fb4b50008c5feea2810b0336d38dba1958fafdb3482036e6ad269895&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00092,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf88ab15fc925643c8adc5b3485f19240e4afc53dc777f0c9bf9ab5c6c6f3338b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00093,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7499b8c5bdb76c9a892b9e0d09cde7813ed0c38740d25743d02910f337c3c6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00094,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c45bbb126771f6277dca461a28239b4efd388b55afe6ef1c6e595ea4ebd9509&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00095,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa3dea11d2eef1db4c8855ae369918a0e12de5b99e0087e3af0105ceb1ed1e0a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00096,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x91ff33f7ed74652bdd22a154aeec0cf24542b29477122dc02704000ef15dd540&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00097,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e4ffd2bc8e767d8848b4d001c20a7dbf942fe73b20f6821a2abd586c8462334&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00098,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c5709afb1a85d25d9131fe5e441ad7f0d5d4608583c07836ff4cc2e3228a30d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00099,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd55b92c14fec40d8ccf4fee501efecf9f71ced6d787eb3faaa4cd7050f3a3e08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00100,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb39d00a031359e390914a91d9c26c1b8dff1b6d8ca4a44ebb64d5946a5451c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00101,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe6df19425c17f10ef876e9964f7561bf3f7bc41fdca9151c26797f38e4a064e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00102,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2aac9e21e2134958f6ebebe21acaa65142ccab41a0ca386aad4eb4c383b69145&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00103,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3fe56c2aa4b33540147f05427b757a5ecfb57a4301a84022a0a26c57bd1f5b4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00104,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3269b3047cc6b5dd1f38313ff3bcc717b44375148a8637e4ce41ec39a9adc57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00105,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f2f86e801b6456e59b5f4c6d2587ca8e5cfd97fbf93dcbd11b7c3cf65b83170&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00106,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x621a252741c0cc84c5e7e3b01f90d30d86474348f44cc659ff48000093671bbd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00107,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3e8f7cdf2b7fd8a0ac98834d4ab1374e8aec4644fc722a04db5abd57329405c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00108,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe1a1635522e1529456595e0615c4d3c53905a0198ad65320c8ec1f7f3ec665b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00109,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49424c3e48cdef7a00003a3ea76da66ce8f833df83f74580faacfa7cbff5dd28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00110,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf29e604357c6c3d6f8a23c69ab648b8b19c0bac3e7e8ffcfe3d23f62c585490&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00111,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1738246f2b0b1ba4a084cbe299233f487f3730d8ebcac38bc6cb43e503992248&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00112,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0074a32e1420b57f8f7c142a61d5d945fa0df577c3007b375dc4412c46e774a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00113,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56e191304d05e3370a821bf16ef43a7528b63105a03b425fb2c408ec21807233&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00114,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x10c2a569cfef2c20fbce1953dcabaa463cae1daf08e83a38322091fb1da59db0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00115,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x26efb6b7b8a822fcfb126451c09491efa88a986bf3ee4f0bcbc7ff5610f051c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00116,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbdf3bc6e520513ff3ca5382abbcfad7f2bc857db708233a07f17149d57d66648&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00117,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe68e5334db9c4e799fdd67843038b909e231e8f5d248af1cb212907554ccc352&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00118,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c9a243765a53509f7ac091504edfdb27fe9e22f9766a7cfa02e0f87ba6774b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00119,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5fc6b689c399c8151792427fa1e9b44c6453f520ea15ca643ec14cf1860b3397&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00120,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcfefc65fab88cf757198c581e272c0e02d6488f4447b87dea8c908cbd8b3fdc6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00121,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0e29b6cdd3b4816acfbd104ca56b2ed140958c37fd4f7d9dbe5d62e1e7444e61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00122,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcddbda3fd6f764602c06803ff083dbfc73f2bb396df17a31e5457329b9a0f38d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00123,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7717d3958ced7ec038af0b4d7daaaf2ab4da56290db865faaf96da59e9babf7b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00124,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e66a66a8ff5e15178ee8c9e500475b7badb71cc65d26dd6074e8faad109b427&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00125,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82fdaab150f1a25c78a2a0253018fc5a83c420bfed8ec727f6c98e1571b39b6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00126,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x427637ff154cc2036316442348c319c019515af54dd5a2c702527b87f6ea4611&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00127,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65e302f1d26bca3ceb600bcc6c19190d2a5e9723a47a99e0710f4ea1fdf9a2f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00128,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6fdc1fedc9d9454ed6b7f1067da89f57ee4c4e298767cebcf549b37c38b463e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00129,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc8705b6e734dc09bff141a739eddafc9a3016ca7e7078a09439db7785fb4e688&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00130,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x650f1d51006a9afa156973b7080774340dbff7334f6d4941729ed1fd39f4bbd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00131,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b4435cab2538749da96316d2068854b40a8cc5eb4810155954acb70ab8eefec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00132,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23bd760353974c8a41e410bb24b6aee32d19eb703692420d375da68ed5b8b4a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00133,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0faccfc19b41bb694cb86c86b88760dddc771125caff85b33ee5cf935f5106b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00134,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xec9cf3ec39f1bb33d363eda9d803fd63de89a5b4afeed17c9bb5185b784d4cc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00135,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66f5486b3e5c79a9d9d10d4ac5581bf89b4068376bf05ced98455b7d50b08844&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00136,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc4ebb94b5007edaa6be31715620430cab85927af56ff7efcd8e5c4df5b2912d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00137,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x022982006526d25c7ee022373f4832c10fe42c7aa25b26044ee3f317b812c221&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00138,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d2314001a3de949f8cf44018b245fe6522bfe212ecae7b8e1676505d05c9905&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00139,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f31661180c2ee22f0f7209e38c1c2aea2fc03384aa0ea1f9d8b98cb0747ca5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00140,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf13c9fc08dd8e3fd03250091f66d0cebcad41cfb4330d6e68bf447863d2f8201&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00141,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17dbb0e39329cd8b2bf6839de0722241211c8a602c233f48302e50d7e6aa6361&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00142,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe42539c839845c3033143db80f7bd316ab323114554cca363c2f3ead3ed6a68d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00143,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5594a813aaa2752040681086954b21e457ddc5a8f1d816b45925eb85ee7528ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00144,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ac2296fd274fd53197c615a25b4fb6f4303b17a977954775f73e036981eb4f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00145,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9244d418b8875cb5a463decd0f8cee235755222f2e72ad97810635975f6ffff8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00146,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf9e7a53390b2fe7c833e937cdbf627a8ecb39da70260eda50ad0af37b4a2d1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00147,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b6fa332dd5f6b04e3fb1a027b63f2513b4159035d3294b0212899649b61da2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00148,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x39f0b0575eec3daa97f64b9bc538f841242003a72256fed04e015e78f72bb92d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00149,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x586c4a913ddb47e0cd4847637cccd2b458a09e35e10b29451febc5ce8f19f696&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00150,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3ff89a4a288f9325e315b394c991680a5843acde1412d0539412363b08ee7c4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00151,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe322efe1b787fb583eed8d19ef06ac5660c014e566ba2541c160251273f8eaf5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00152,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d9d0d1c39a4d03a8e4def8892d713c4c9c84df804bd2da90e20e596c99ff6f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00153,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b5702b39f5bde08d74649594e48ef49faf24a19c5d7ec75d8cf490157f4f201&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00154,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13608c120fd377b160206bd5f9afe2ed660ecd8a121210faeaec26c9b6010975&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00155,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0bf6ce2d1f149196b41e2379831cd9e07d215a9da2be8a2b772be32a10b3f64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00156,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8c3629c89fbf5c93a481688d05e108af37f4ca1152e2c1ce66de366db58e934&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00157,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97351a9d18fe2307ffc128e294f580eb5c9c9f48fba6a5f4f25a0aa98d97fac8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00158,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cee8f8c5f208a9d23dc367deb3c47e1b3e186bbdd94f2812ac27b40825de041&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00159,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb92f84e91d955459a2de86bc28544a82ffaf23c6175f657f767303d63cf8b842&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00160,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e41d9f5b9538accaac888b49abc201aa3d71f5aa6c516a97e69314886989788&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00161,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0736b99a2882a562bfd35db27b128a498711834107fd2c0356063b406ed8c804&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00162,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a1530daf01f3cddb2af69fc527b5f7635aab2d02adc46e5a21f8344eed9f7b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00163,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x43212d3b60bfcccb6b12bf765fd072f8785a7d41dca097e37ea14b7c8faf6d85&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00164,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3744a01c5c7968e2230ec9d29de8a370db7f43763ef8f22f58cbbdf13f27eb1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00165,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d14fc84c9f2dafa748275285205ae2b29df613c8f982d1f334d661b1511f8e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00166,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97c2592527a83d1c2c514f447e8ae6fdb1481c0dc9c4a3f7212049c5eeae578d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00167,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1148500252c17babbed0e2df0e3913dc380f7c0a06e680d4ba101748620660b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00168,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88a365fabc60615ca56960314ae6006f61df6fe729a40341c12bb3c98045a4dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00169,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf18242e71a0c97722f01fbe9c462e0fe857d93a43f1d683fff9e36e4d3ad59df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00170,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf03ea8ee5343e37601df81cc61173e6276516b1f69225a8c1a94fb079545957f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00171,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbec8ccd9a6e13443a8e61a931138f3cf6218a2b477d11ef59a082f898796c439&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00172,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34a4c5d21fc33c31b415829b9e46c63588db2327e3ee13682d52233108a2af25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00173,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe1ae6c812dc2ca1cb0613ab42e6c81721f96e771b13c79d284dacbb30c65e5aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00174,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x727d10b81b790e7f5f608c35126fafc3523c7e991bfdb8ef018edbdd207b4c24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00175,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1bf21dcc47b8d4ed6511e49dfc4bc14c1f40f2c21464d52aba8b4a50c60e3b1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00176,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xecc872aa4aa1c53bdc3c22687ed31f1373db111f1c1219286f857b157f6990b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00177,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x966bdbf23d2e86326afccf08377aac0067d485c6098d90c1c74a84b34b8eea3a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00178,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb412f22cecb0219921846638c68908fbc2d73f3d2c7d32d7d86795e9f48c5145&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00179,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x09e40d3b668d4808509a521703734da066da50c303525314712713c5dbc6a2f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00180,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ce22357ac0066d519294b9ab476c222a2edf3cbcc4e06a2df0504ad11f5c1ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00181,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac1cf418529f5346213890d7f11ccf4a21e24023d40f2eaaa943606f8b7a1e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00182,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf770e12a39d1ebfe34919a211fcedb2098ff562689be021bbfb8636f756c4b95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00183,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x798224ae95fa5281f29cdd3ac9eb753ca8e9ee44b9cb2c5747f97c8d71917b58&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00184,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x876fdbe53a7831817a5e123f1b043700f1f3d47f685b772dded35c953d629e5a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00185,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b447a76548eb9c28145371f61831a2dc941acd907804808a7ab93f7c171d621&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00186,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf1e11ac5a67e45142b1a1a13663c725f82a84d5e59ddf65f3b740dbd028b3d63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00187,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xce8b009f996254d6df379dd2b3a5aba9dd1d3e0b64de28e5838b43f411f42e4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00188,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7bd816d6d55b71c0f6784b2925ff9e1daf65bfb238fc1bb4980274130b500c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00189,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x144cc97d4bfc31469fec6de2cc4ab5556af13aa4b00b96081692ea64092c592d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00190,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbbcca518e96049a99aad9b53f2e579cf866d6c8fa3a69e407404a3508963394&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00191,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a7f648499e877f2451d3bb6f1e90e5e48ce653459849d52aef5b1f04bd7a9cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00192,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a4639c3f8df41e06f4af80ecd6227823708c39128cd6a791e9ce390d9bcc7c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00193,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x52629553fb11ce8b1f53ad71c3ec8fa911ff6e0424b7c0a015922311888079d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00194,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4828a4b7616281c5e82ba47e691de8a9975512f0d9033b098082cf027e90236&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00195,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf50a165e20e68aa37f97ead770fd9710ccb7b4fdc80581b5982f1d7a219feae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00196,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c31919b4d982bee212e5d30e35fc2998d946a0c124e54e3e2c27fbf8d129494&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00197,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e2a709b9953cd0e76df8b6f36d2cee961b24aa19ed11c6def3f5a1744c1755b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00198,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3e781bf3998d0fd70bdbdf8213e066bb31636039606d9763ab9449cf73ad5d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00199,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20c05ee3e79b3ab76d806ae93d9cd01340ea68c007816dcedede0635df91850a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00200,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc265ad95ef9c500cecb8bf2a5da52b3f29d171aa981c8bd9ccbd6ccb7696e69&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00201,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1356f2dabf963afe35b149a0de796d3e48f87bc41d9a516d4924854af52dd709&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00202,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84e861144a0bfc933935e47097d963e8591a0f321cdb7ad1d75d899ca501df1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00203,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2da7b50b32ed6bc786564ffc8e7b85ab250ec0eaa0096dea3faebfc9e07bdc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00204,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f42b43f0556b03846f18a12da581203682f8d2266fcd686b388970ea6229de5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00205,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafd08f8ec73d9a83ac8b099ba3202cda132e9e07e3dd18738dc4b5b1f0d98e93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00206,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf4a2c657b1cf55f37167bf85a51ed104eac71967a98bd4c02a42dfc057c02a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00207,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x59a0e883c7a7087b9c330ae4703d0cf263eedd8d20466e313c894519235f5d44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00208,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d0bbaf203bdf186daab82974347c617e1210a586751ec6c9818185d0a096e3f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00209,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc1041285ee311030789717024ad66718f6184a03a0d31a1ce4ccb0948fa17dc5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00210,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1eb673abfb14d61c67d81d48dad2b7f72080a90fe090b6846779fb78046402ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00211,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01e5a4d0cf29ec996c00f168d445f55eb3552f213200a247c4efd60d4fceede4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00212,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83c3bb0ad1f3784c92a88909ab533c62dd5e7b3dcacbaf624ae95ee12022eb11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00213,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a09fe68cd5dcdc15ea76f08eac7e2a679075e772064354c747b75e5ddca8d2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00214,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e78dc12bf0023bdf0c8c1b8e7f7c6e5a92d66b56475594bfa334c129df58735&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00215,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb02bf96a7443e246b6733270453b35a70ff1fcf49375cedc97338614ac65ac51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00216,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x209c8b324d31fd9d8c8c4cf26f6506657608e6816471fe522adb1425b5ebd04d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00217,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6c84f49aa1ae7943df31f340739b2b63df7476e87cf0ddf82862982456865c95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00218,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xacb60f14bf4bdc96ce579f02f62f8bb35db16f03dde7329363bb50388c3c45b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00219,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a773645ba0627df6df44158e292f2f226ca74bbc90464ec4796ac2e9bf26578&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00220,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76ed2324a565e51cf2a82bd0cdb025f255caf25d61396d4da19d708c40adcf92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00221,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76ddd2d829c12483b2ffec2c587557bc5972e08dc8866708a2d44a31575483d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00222,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71e986b22213ce63d0e3df141581fca8fbfc41569f0bcd62c101c67cb00295b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00223,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xca2b5c289ff78be184a6cea0f072aa71cfe0977f18bbcca536b48938e5d64276&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00224,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff571e13e54cdc9ca6facd7012051ee787bee1c52a555653fd969751bfaac7f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00225,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cfe32398c41e4ecdde6cff7b2df6f9f2651ee87aae1b52bc35e4d76f136c3a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00226,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb0eb8f2f68728e48a4ded02891b9a682f7c925099e899c26143083850b3f2829&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00227,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83556e9f3d0e05c0d4cd809cf1bcad1557bfeae027ac4de16e6956596e8309fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00228,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7651e7fbd8326e549f9af9122585f517c4f59ab6e735cd958888fb6f80f29db3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00229,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x238ed7884113c0356cf4e5ef35e05434d3e076428884b93bbb873ac30afef54d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00230,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3826affaf4ebf5817b453c54c937951770c19ddb7900c9a7742919c24242f6b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00231,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb81f93c6179db089673e919d91660274e96f240a699a12a140185c69ac19b674&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00232,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0cda2a75d5dd4059a2e5712ac7cb151f033b700995e93c0819f38cb01b7f005e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00233,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb183167b3a03238701597a198475ccec1308e2c55babbe5d5acb92fcd694fa21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00234,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a88300d556d8a8d66669f2d2b395263ded44d9a86bd45b3b426a55f7da8eb22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00235,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05ef61436ee159233c382043f0a9e99d34ed88a0bf3c12244f546b7b861b9f5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00236,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4164fdf451a7134e2faa3672aa40a0168e2a16895020c0cd5632322793fc96d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00237,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd5c9eed4c1796793e8595d155187444376f4b5478ea5ff1804f1ba06bd328506&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00238,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb0d90c5045dec94b87c81a03fb985a6fb84e1debb372b56c2513f25d4a2d8f8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00239,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0c972ed0270d34b19b803a74649470307f138ef0567df85ef53a862b383dbdd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00240,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9cc1a86a28230bad01981b644067885e0333588976edef464aac674744c9eed9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00241,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ab5ad435e4c9a37815b47344d282c90a3f364d516374b4b2158cf16148d79de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00242,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x491f232e15a8a44b1f045dc68552543672c6d3bff361a5fecd7c0a54c1f21d2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00243,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf66eb348a6b9dd916baf6bbab3299c57b9d95e5bfb585893f2953209c2c451e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00244,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b141f131b2878edbef5e71682051e3082490e755502c0372e5ace9cb5ea3d5b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00245,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef5b96a583318ef2d24bde313396aa09dd5d102cbd270b95c036bc6db98349a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00246,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32d63aa14065862ce43f33e578625a2892710dd11025a9299f8722421c625874&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00247,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b033a6c76470c8b7b953161d562fe30c90705672f950a176de70a6aa5f1b130&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00248,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x50916052436d167fa83998749a703038ddb08d7cc789c276099235f9af28a613&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00249,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75e0db34d48e90e80705be01c100e3767aa3302d4269a00f4c944069ea451ccf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00250,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4781ac7f896d2a547f2a973fdd352d5e9efb019939bd10ab31f0f84887968831&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00251,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0f8b33bf4828ab6578b5312d922b37139bf9c1d0eddd973f5ee84b39af48a28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00252,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafa72ca222af4feacee96c6a64a4b05a1fe464f9ed48e93e13cdb096d0147d25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00253,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96c6ccb34878fb040117b6933c7d7f1ca4f534dc63ab86d2cc4914b06786331a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00254,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b32050e8240cfbf7ab11e4b06647d363c83aafa32d78cf34460b335d0e55a3c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00255,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x16317cf915089e0c7cc1afb35540a004fa2c79e75f4410dbd89e6d9fdb2b89e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00256,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb4ccb50be9c8f0759450e6dd9d05cb16778cc2852c0f8aaaeaa118a45267891b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00257,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98808d165ea3e628d92a93cfb1081e68254c4e2a48eea8c1cb3771772ee0fa74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00258,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cf61b1ca697e63092bcbaafad3cf25608f47a9b6563bf8dc1720eb2a7fbe384&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00259,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x051764d24d14c62f71e8df8e9eda01d4edba8a9a52cf50ed50dce0d06f33bbeb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00260,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3b0545e8512ad0ef40623a237e1461577102fb2d6aa820dc0a9420d62f1a5942&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00261,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6f4bfcafda2d4cfc8bc900a5f844d60a50822aff332f7aadec3157b12a8d1ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00262,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a75662f7da5af8abe9f73deddfdbc4fa23772f28a2968eb44dab1e413238841&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00263,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21bf7eeeff2979facb0c0a59ebfe07e4f110c9f7417217a341039ae2deb4c6d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00264,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd41eb83d2e64d9928f6c18e95060bca40c3226b4982f91dc97a518201aac8fb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00265,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7a1956113e4b4c440a7ca46855ad2d2705ee3c018770e3fa8f8a3b3a6b6d6a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00266,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f172aab43c6bec97adf68392b12e82b4512ebc52df0298ce3253672fe59135b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00267,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c0e1bcfc2aaa6ae002a1bc3fe0ed288598013b4c0dbce889d4b41cc8f1c792b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00268,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc839e6d47fa99f7bab58ca9eea51d6306873f67fd286ddeca8348a09c773cc42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00269,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ec52dfb6facec401f848cee38bd6eda4e3429291939754a4985eb8ae969787d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00270,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4e8bc7277defdbc8c904f780c9b6f82c214816b5379e95490c7f0052a7295465&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00271,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5294c75dc9cdf4c43f683b6c02c9078852607faf9dec990339b74476e0c0108b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00272,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02a11db25d807b03efafe32a0ee0647b35d47506a7fac186bb51e3c3a77a5655&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00273,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd81a2c4138adf6e8b1af325a9a0b08ce6a0b3b72a79b367118294bafb4b832e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00274,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9c4bd87dc1b25b83302973a9c4223cda44c1200ea2a83106463adf6317bdc605&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00275,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85b9c67dc6b5b7c0014824f8b1909633459cd0b8e1584753064f85e1a1243c8a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00276,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38cc12366c2a7d559e4df0705bb822d8d0db59221de71477dfcab90e317b2e97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00277,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40c70f952d1ecfafbd064b1367045570b703fdbc7059cc7f9194ed34794d1db6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00278,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9e0d7381580a9f3fa81e7a8f582967f09e1e87f0e4c5d08221edf0434053608&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00279,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd20a7b7f9138afec7ab17bcc1fa4d77571d78f12bac193db64cbe046d0bcd1e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00280,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54a85faaf00ddd99bf86faab4ddbd028b8d3f4e8f4492d1c7160aad9a03db638&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00281,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf08b974956e8b7c14b335bf82add248bdf06a9626ecd6627ae0cc523359cad9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00282,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5912776593b35ee8dbca404e0c36497dc410062c0e5f4c6b40923232b17a8ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00283,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ee7ec35fab36575d9e5105303fa547ca8a03b6ecf731cbb64b9823250323d25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00284,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x374996f2ff5de9c6262168bc93fe7548bc6cb94d45dd4dcce211a9be677ddcfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00285,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9494258571f7dda74ed018ffed536e412f5272028442ce932677668613278035&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00286,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d47a23492f0ec9831f3536b4b542b1addaa041ab9f9cb6d2f6821a5f9ed6646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00287,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9804151a4dbbe0c86e08b2109fc328a287ea4ac10abfbe01a9bcc866e7422b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00288,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3724a8c948c728a89eb03af19c3be5e7e26abde6713e6e9ab5559dd21f8e095e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00289,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x60d72bd902aef520fa3a0fd618cc230a50c8cd3951042f5a613b3d45f0b94c6d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00290,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64cca80b0eb18b315b2213ad5e2b53dfcbb1141ffa422ad46e7cb3586a200aeb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00291,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dfa92f2d0ff334ed8306b33e6d3325720cc13aa0f046d53a2de144d89b9af92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00292,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9490598864a1e3ce2241136637de020cf275921f59545dbc4ecf4cf87f678b84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00293,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d6c5812bd1b877d8715198580c66eab1ddaa78e1dc350e70eba0d59e633cf30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00294,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6c5c94a2006aa624d007104ed8debbb32ec15423382e4759bc7a16a1357d5ed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00295,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4efa78d05a58e9b1e633443b058c9f8d447728e0ad64a50332f848199f8a4253&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00296,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81c1446a12d42c3ce40f4a99326cf8e5a306ab72c773ac26f63a63cbe0a58064&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00297,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08d13a3189fb2e18636d6beadbc137a79d03d9278c60f80829443348b8c560a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00298,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d1d6d89bcfb495fccee7bb0bd8f04715d84abe14f94fb36f870e5606c2cdf18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00299,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23728d43eeafdcff8f761c5a53e3f9373d25d17efb28347a91938484e03d07cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00300,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde0332534e50154c9eac98068e56da4508d82ecf24ca3a275aeef3dee99b95e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00301,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x15a24df990de83affd9aa7cd9e67f4c558e1b3f306a6281385cc2e6409b9793a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00302,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba653536adb3464fdd46fe741d7daa1514a84f7555bf7ed91cb4d3bddc0a6f1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00303,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x35fde006dd9552f56250125ce80ad21476daf78f8727b432cdb370372c161a65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00304,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x377bf395fc2a3ef98595766247a1c057a05d5fd3629bfd27d0bede0c6183a7f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00305,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x340a0b81056d5170e635ef43d952b8ec4ff7f3d5cf4ea1469750448d78f3e501&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00306,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x848e3d92711946156cd7c848947d2ba4ee4c0b39087ea30c90eb1e64f8aba773&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00307,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa3ff791642f87c2bffb269a1da3d8e943a1828cafe10ea7a483a508f78ab54e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00308,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x48c7160cbf3a38ea7299edf971711e9d6875969dd38ce2086763389d9fac048c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00309,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7948131b78ed9f05c0e18ff0497a192aaf8c5d3c1a56e1096570b3b45117253&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00310,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb22eaaf717a1a827a085d3960e2a477a2e9a73584bc4a293377ac50a492350f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00311,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9e4fff98d04206dd4004f5ec146e676327dc8399dff7c7eb61d1d80f706d3ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00312,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd95903d02e93dc935ce569153d9c88680972dd5e9156dc0a7f4da9a3435ff004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00313,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x73f91876f19025335210705149eac61825673f8698bcf5aae285c00051fd6f6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00314,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e3397949f833d550ca3a268befa4c48c238f488572b2512f8cb5232d78dde24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00315,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe83123f07d6e146998f885c5c4f71988f472b9769e9c731d421327f3f4add351&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00316,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe49c7af7a328992fb98e65057e28326f3684f84293a6b9825ef8297fb361a186&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00317,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3ae6a628ac464fc0f14f4654dedf31ab553c9750bbbc801e395ac858bbb619f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00318,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bf5c84ae3ef17b5fb6455380d4708dba2da9c9224c4a31a0cb14ed4e8eb17f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00319,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x391837c44adbebf55ee138d56c65353612b31c66f1cc02663b7f088b80dde22f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00320,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbfd4677eb2bd0210ee172956700adfcf8b5164982b533a191907f62ac3f6ae1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00321,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7189f4963254c00f349ebdb7f507638472c13e083cc525be744de2ce8374e1e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00322,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x344663aa7240ee9c312f31e5111dcb672451ef971ec1375fb8a298c676738c7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00323,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe111bfc2e481e928c91b0d0a5868221c8699e22fbe87852b3bedb3124072659a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00324,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe2b4b22f7c8c897ba0731eb6342e075c338b8feb2791c31be1d20c6c47f167d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00325,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x441fdc4402e5b407058b634523f6318e2b6ac078414720bda9466129896e19c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00326,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4297936031236c915aed0b391555294f1df7b346889ca02edd1313b8fbd73298&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00327,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x820afe74538d0b05b98e1d16604fb60bca79f04c56fa724e6d2af5532a5b45e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00328,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08665862041221b6d297f4e7619b1044eadbdb92ec1415e916e9bc78558aafca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00329,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc85d0d955b9068c848b56435b53e7eef8d2a1266cfd92c46544594a1b7c06fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00330,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ffabe96ffed7125caf2395331a37eeeaa016c1fbd0af6ddbaaeaa4ce3a75428&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00331,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57c9aa448a060ee1cbe8a7b5236ef301c090d29baa0f644ccb23661b7933b4df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00332,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3135b7344e51ce37b6f82ad0e1ab5dde01a7cbf154ec76ae394c6e99fa866e68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00333,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef368f009534af83848b1ad36c874d1cd28cbf792663db122dd8f7f123506966&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00334,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c3457cf9b7bde27ad51086fb1ea494d78e82217cf2477f79ac8fc4cfa610f25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00335,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb191a95efc41af23eaf794aea75d4b4c9308a85647f6793201533b30b3d9d368&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00336,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5318d5c8c6f173084a7d838110e3e3de8739123b4ec387658c0b579cb87fcec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00337,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa84d51fe94498ad9c2f558ad6fe685d9aa73ef5ab52c794861277e690ff27d65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00338,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf0b5744f941d4eea8fa255edaa9f7af5028da4900c7fd0b2a1214b00c33f96fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00339,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5a637c4c3cebacbb0caf5c8bb9080288270e8f2ad3106e50ce82a65bc27386a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00340,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6bd16b95991a8cfb3671511c673093106b4aa7d626edd4558bc58ca67f8054c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00341,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0d9d5cba01b6dc8c430de66d0503e58b9be6195e7a767fc26e15277af7a08fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00342,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x203bc599777747671b50d1ddcc78edc4a180537d2e6fe14610426772d1caf926&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00343,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa668f92ec27ced688ad1ce7eeb4f437996bdc213ab001f5d548f5e283f243754&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00344,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9cfd6013d6c92d918e19c4b6118dcf5d73e9070af0c7300f8db0ccc7fef5e89a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00345,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54595ee743dc095ed8c3a82f1c0ae34ab2ef7ebb494286a990be0f6b9e85e6a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00346,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2297e35e02ef969b43a787aa88feb7e101a21fb5d73a81af1c4bc06c57a7c3bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00347,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb8912b310472c79894387c19d79d84113709d05057c043380ec4ad8145991fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00348,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1dde5ab9d554e74a5635f8042ccee5454b215eb598cfbf696a74a459fc1ec87f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00349,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e25d7fe6b0e71c03d401537f46ea1628e91513cc3991171227d6ec165058e2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00350,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2bce5715759f8e6f9f17a735408e410f9965ac3cfd27e2c710060f3778d662b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00351,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x112b61e1ad4e349919eadac971bb9128d385eb3f51668b2895cb978f148a83f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00352,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ffd764d428f87651d62f1a1113874042f1c77dee8b999524e896663e1a0e000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00353,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d5ed81a06d6bb19866099c16d80a7dfe3ebf9c642236410a5f3f491fabab7b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00354,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78c57cc6fa8c8eaee7bef3b0573faacf9a42783f39c9a307a3cebd4a66a56e37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00355,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55973475ad5f1404bca12aec3688d80cb5881796a9d0a9a917245f8ed9bed47b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00356,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7493a6e7fcfb05ceb9f11b9af843556bea9f87883a2ee21ee76cbbb769204fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00357,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe5dd91711b000ce8cd41d02ec760a50625f924fcf7a095353f6965322881fb94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00358,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x60ed8451fe763621afb94803cbec04b48e9ab83c8d05e2ec1524e623dbe0decb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00359,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeeb9573da28cde717ede462163188da0c184c4aa61e166e9bc4ee047fa0c170b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00360,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x277ba2fed1fae84aa2b23a43872100f00b7699326a22df5679115b1dd88c5206&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00361,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc97c47f7bf57fce450809d63a32e255db170aa3fbc94c88d9b15a09f22e2f8f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00362,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77f810e72a7d1aa4a164ba9f7bf0164b6f14842dda65d584508d7f403942c319&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00363,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x056ef66ff214f7a777abda23d7c32c1ed17e2d25f3e5e4299e11c22412bfb1df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00364,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x374faafad27fc139a45b9a73cb5957de978227d494de6cbe4d9bb4d48fc26197&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00365,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa959566e36f4790873b779f74d0b31b5c08b4177e844e430fee9c33c190839c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00366,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x905c4a521e63de87fdd413379e245a1c8c2aafd1cf92e5ed6394892a635e62a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00367,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed4e7dab8d5ac5eb9d4e3b711be5a5074eaceee1936455fc145362871d64faae&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00368,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb4a84335f5900e1df9ffd45af119abb6808b69960359257826702a0792dbb9c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00369,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f3be8331532a43391f286dce1908e750c2c1db4f40e04240df8a49b15077ffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00370,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccf6672e6da5a00cd8ce25a1dcd7ac9701d10e13db51b249cec8a168fbc1fad3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00371,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aa762ac08985e6a081e59742827fdcaa0194f37db5a03574bea395a548c1ae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00372,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05d7f23c6cb10f2e5ea143504193e0c18799879225cc7bb9f548c2a7bca406a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00373,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a8322055f128164d9b1ae8be520dabd5aa9a78e6b38887d2d0ef1c29f8fe5fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00374,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdab73b8e1681ad78f5948c11596f320dc9e37833a372a4bb75131ae27144789d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00375,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe97d6f9f8cf09791cfa7d844116e30f30c0c25a010500db0721e1a0794a0f0bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00376,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6af73957e98a3366086abd58c1d750803706d7bc3ae2bbbab4eb6030d58cb244&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00377,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa0bd020aa5cff144e0c34ec5a67a63cd593c607905dfd7a8697796a7641385d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00378,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85b101eb40a52a559a3bffc4667c2fa220ad9cacca9a34c62c684e87cafa5e56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00379,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbe01c0b7b7e3e3434a5a4723c3619f544c6fc91324421172c74b3aceb816f39&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00380,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e90265a2de6ab0f66324c687364be3c3a4bf46b96fb5dedc4da99c2a59c66f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00381,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b316492b1f48b2a578bf289dbfdcfeccc756410f0260e2b14b8b2bf972ab173&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00382,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa02e585dc76ee230753d64e6f49d31f6c785e03834bba8acc2fe3f97b2b0de67&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00383,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2198573b3c6f4e37218236277eb87d39d60646c6a46b7f516de4ee75f7eb57cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00384,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c367f630c9a45d6320139277a8d2f880118a31a856daea875c5a095986f50fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00385,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8893c8da5a5e2df4e794962fd80bf6d4b8785de5ec445115f1851f601d92afc0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00386,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x30637c5e41cbd7671b1b2744d5abde33576904c2fb999de2262dde69d552b4e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00387,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x069b5e283383b315d1a151162386e05161a9ae0704c2b5d3162d18fe91445c14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00388,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82890633807a55f66db32bbfbc7eddec26666cf69d927c6ec17d3e52839f3d3e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00389,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdef916eb755fd6d271775e79079003b9851e520c744dc2fc544599069a2f9a2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00390,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00f646779628de768f0a78b66f79310092a7eed1b1f42d871bc14945b31c4dab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00391,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6055482350dcadf13a115468db04f05b533177f9cb92ce0d1174e80cf72ffe92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00392,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01eb08ec62a30cb0bc16493c077396adcf2921cf45e7fe07f8ad8a9eb3cb2486&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00393,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5b5b2ed61c5a22e51f28e7081d3c57657bfe1ee7ca90ba380e21b0c29bb871d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00394,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc96f2c65a9b708e26fb06146840df2ba2fee86811fc64b8b03cb8da0e864cf21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00395,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7c791690e0a24e565ad4325f0916eacd1472c5c67ed9d08007f519ab5ea4751&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00396,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98f01c73bc56a14d597f9a2fc522c1f9ce473d5aebcf9f025bf85e10ab5e69b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00397,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xece428f5e482195f4fc650d8ba4535cdc50da4bbd6daff83dabf40f0fc1cb264&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00398,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x15d52476e016b06a31965a6f867703d8e72de4d75952ea588619e24d16946860&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00399,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07f402789b0a04c5c653605ae4a4d9b538575eb278790ee1fca13e1f47aa85a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00400,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x837a78da3c31e197110da75373e9161ec3630eac20956d4976bfdfe5a3f76705&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00401,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf319bb85477c7540c8296e257ae3e9887477cc5ce6615e79ff465e67447ef449&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00402,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28918ded462955d7564a1cf7515dcde37e47a0bf649af47ce19c1bd2f42420f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00403,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d3e10d5ddb059e88145c8a640d6f435b50abf014464ef4112bb7153172e8712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00404,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x729d063ef003bc0cd25960f423adc378a96f94bf330e2894980e229c7f792827&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00405,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3857def7fbba5ea6f0330f98e7810ff7efec3dec752c7a72961925ebb55935ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00406,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7be7d5cd302192b0891e799f7fd3dc6214225bac396740ca00eab0987afa0e15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00407,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a5da5b2bd5353f6dfccb3173ffc30d765f1abae1eb3fe1a2ba70a4c9e69144c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00408,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ef48eb40d14a101421b182a44e62e46058b24a968731f9672658c2998359339&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00409,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4148ff741b9ad3ceebc501e8db8796f923b39918bc4e003164b490a0b61d9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00410,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb195d1d07cd0b541bde741b4086345048fc40eba5c36958db1e84b72f813f9ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00411,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xab2766df14efa74b0e28bb35708e39d6b1ca1d0bca5a94ef65b5aedfb53bb200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00412,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fcf3d8ce7b02562b9f72decca131bda4095b44bff685e901c1a5b5d29ad1bdb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00413,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x371970b092f836d650467a8ce9b049da8e286f73b4ef1063380be6ec1c07622a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00414,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7525f2eda283e525441c353da10bdc982c0b1ff04dea2c153b3543fdad000b73&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00415,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4820498a2f344d87b28241909d366f5be00766e75b23645c45a09c75ec8dfdb4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00416,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55dcafa7fd60cb0110e64c6d5cc69db5f031a572e110368f9067151b0890a0f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00417,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a836ceab0f6c37b3523b9df29cd0434d420819221ef1063600765b3ca5f522f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00418,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc524844779cb06e98494028130b971a762f7e249dd1d79e08acfc33d7927aae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00419,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaa00e84454c9ec2852bedc300676f8d20bda558c13442ec8b9a148fbe5d37098&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00420,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a718263b17245356ffb42bb178e9590283ea2e0a82ff52dab5f904da8951895&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00421,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7a7719554eabde85fa9f5bac7580c6f352f60a460f9a07fbe87fff47ba7c19d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00422,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05e01b82ba2d8b2fda2a7e149186ae56e933298b9251269a4e2eab1717f44fda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00423,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c5c203528a51dc0cc9a0852cea64ed0debab06b3ac95d012870589a5ae4c0a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00424,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d31cd1ad7743f0c08549c8aba82c3914de61f8637f768725812dae0be1c3cf5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00425,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x737fc2002808f4c81dbad877b69160a9ebdc3f8382b5e1f2f08defce897857ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00426,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb042cd22b27a2d46775de19a0fe07ea0187139b69a8a5f9f8ad680b49a50e81c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00427,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5f8fadbaf1e1b1c025e9ca7646d214d84afa0d2575026bfd188492553ad2dc9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00428,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2247adf42e4fabead0c52c18fd8d9c3d378b6a82dc3941e9f2e7c03a3e6a5316&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00429,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cae28d5c467521d0a2986ae1ab697c0137fb88a2cd57b7b65e1087002f4ca8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00430,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xab59cee6f8c573ce2e2abac2865d1590cdcc0e4289aa75144582810327d2bffd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00431,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed24090f25bc8dca7749c25f4d6a81a6c0421251b40e9fefaaf7896a49e1cec8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00432,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xecfb2f473b32475d203492960f9c706024ad7be82ced8dd0f9506c2cedf3b29f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00433,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea10cb3faf85fe26801f5c5c6f963aa09936d48cc6070abdc86ef7c1ab93eb6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00434,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed8823c84177d8ffabf104566f313a2b2a43d05304ba6c74c2f5555bae0ef329&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00435,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1acee0de8d8fa5a692ca7fe4e6e6b6070264bbce1d27bae29aa96794a92fffaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00436,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3510bf4ec6f2561e65ef90ac5f69719835bd88ebc526470a11645a2c743696f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00437,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2dcc620fcc9352d6e87c27c30f9dcbc38e05c66d4cc315a6b04b3007234821b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00438,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00f5e21daa244de11bbc15728bcda77c7c15fd858252459ad7c10c0ac877ae9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00439,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5149508dee482fd1927f619b3984641ee6a4cd545e763475d97a759cdd6b9ce4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00440,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9feb91891bf0aa0981ae9b6d8a71dbec00cc4a2ebf9a94a0aecc1815d621b2c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00441,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f1832caadae9d68b7056679e7e36db138a48754d0bd69f0f7c369ecfff7763c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00442,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1d30de4aac58ef2504ba7fca3cdc0536a6129314efcf91c713578bebd2182e6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00443,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea71b6f9916c2fe3cee071ccbbf4105935e111b40d71ecc3b327ae5a992a6d49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00444,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc56da958661c206315768f8f855721cce15e24ff1f350b294a1331eb29db56e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00445,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02cff3d78ac49a70b6466ab49a54dd2695b8ae3a423b9e52dae2351864ad4e4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00446,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2280f1cf6ebfeddf1211be1d8801bb188f0afb1626da2921ee603ede2bbcf926&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00447,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cff32e3d7dbda7c7efec80b3c9ceaf9c56b9d5d0c03b53cd12897c0ecb8a59a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00448,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7dd2c4f161ae53d17ee1bce79c6dc3a848fabc81c2ed01d08d768e02c7ae8b19&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00449,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d1d274b948411de02b87258045266f96be9a450a363da2482a1219aecf586cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00450,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b5e114981c6f32c8a3b78fa35ce6132d9ca9b597dd94ffd91b77657f5e51be2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00451,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4abe0e076ff522ec7b0eaf0d6751f9dfb7f164b42864e0255f1502a77315178c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00452,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42606107511944b1c7dc61fd2d3467fc43128e69092df1eef47479dbca67f3e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00453,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23cdebe00f8b0071fe04101936e236e3dcb4e58b94a8101a0f449ec38aaf53b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00454,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb2b5e5f97f7552d912156e250165b87cf670d32260186a1a41c47bd53e4b7f51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00455,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54943c8b31b13a4f0cc4f3472967383de372b4ca8f89979f6043d44ae330888b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00456,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcab079083dd2ddc43386c219d265ed110b97d315943e37e859764ddb5c380a2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00457,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82d06ed1ec9bfb436ed64caeb0a1c99efdc719d79167ec9600fed7802c5cb1ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00458,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2bff3cd79eed0180444dfcbfb8fb93579be52e5d0eb92fcd3ae6c70702a93254&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00459,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x29e03017ed0f32215c0705d87beff1ecde7afc804217ec41c250a0541e71dd67&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00460,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f2ddb12b11f17f35b123ca3692ac57b18043af935e33eb2f662fa0fe862a866&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00461,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x86535bae04792f1724aabb2201189ef0b12ca7624e1e9fd296d129d3ef1f74f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00462,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3658342ed3dba9eedabc93cae0d6cc657bedef4d1dc6c631113af874dd65fb64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00463,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f586d74db2e09c1ddb553421304a352ae8ca4dfcdd49cb9905c83184cd1050d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00464,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2da57d6c84f0f2de638453005d496136fac3d1a4957f0e6a8aca32070522c965&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00465,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafdd52d62167b3f4a6e0c88d5bd5fffd1f4fa06a528e52f2cf3a095cf5f84fea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00466,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21cf05fbe816d55dc025ddc38f55aa7e66bcdb98ccff8abfd031c0832f69dd62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00467,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27685b9d5efe40fe088b50b9a1ea62e8dadeb0425171ad45e6bcc3c283af2acf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00468,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x610466b6f8c2771439da2e8a7343c8d961a040e3bbc73ca6c661e4a13f977132&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00469,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c5751e2b93bc6f0ddffd243332a890e3794bb3de71a80ca45c95b971be88167&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00470,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e445b03b86127fe3149c740429382afdd2d0bd2e1ff0b1f05ece2e23470017c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00471,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f37562302193a70baf1096ce39a616be3737721795d7a106ca321593f29af71&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00472,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f279db60b9c122ef92a239345b84ae0d9d6ab6399ef756e89078c9ded3df15c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00473,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ae48eaec56b9a49cbb966ec90af455eaa03ee66604e50195cc6ca4dc3f0e1b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00474,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b70d9c82bf64392306a74b2075f1218f3e25ff143962e2c63d0300437bd9794&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00475,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8e53747848b2eee9050ce20905f07d99282ae9a35ce825ea1b7faf09677a468&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00476,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdd34a7c17094183961aa4c17d9cd6e2e73daeac22f27af1f0d948772d9727e11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00477,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x488d852ffe678ca5d7fd3b4f04afeb893595b929c6a968c2b8e6ff7204be27bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00478,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x232a4fc9a0cf3b37008375f24a562c44e25a0f54774e2384db37ea0acc0b599f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00479,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b082f2481b4819595dba7d5f02505e200b32e78c59100241de37b51720217e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00480,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb54b802e1b7923c298d222ff23b5f0d1c8b76b886c764b517a1e29bd4801ebe0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00481,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x213ae81b453ef36e78b560492832c28c71db8bbb5d12816cf0477c16155ab8d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00482,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5d09d6eed5b020f1268016d5117587d519d1aaea97b575c6ab24a85135daab13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00483,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3c11c6e063ba5b267f6616529b2495424a633e08f6a78bedaa660496914ca81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00484,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdc41b84ddcf6530555d2fd03651ca3fcc29981f4b9df53944efe410442174c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00485,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb26f2e53df52942461b1c54800e6eb25858b1d86f9bee68c40b8f13ca1fb44bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00486,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x82b8c438d8704a976289eb09500c628a3c07ceaca62d081de94e345d14bf58af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00487,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd834f157ce0cabf68f199cabbda6fe5a47256b25acbfaabd376ee9d28d2366c3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00488,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa3989a5ba10e3c27731de69a30136ee3ea9e603cb27d12e2a5f32afa60ddada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00489,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4db390c5cb4c32c03d7f9cd7b8823b700e9d64da825194b83e3df46ce5751864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00490,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb9ad2e4d9c6627f63d60befc8778777c829594a044f464f12956c904486f7691&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00491,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6aa98f9f56f6ef66ad09f15071de716f61e203ab7a31a98737fd5c46649a14e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00492,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xebdcd70d9e477a11b4fc48d3258dd5bcf6c9222db25dfef74dff86487714b798&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00493,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3079f6253e59035a7e4a039275e685c9017d7e1055252fcc7db8c4a5c9bac205&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00494,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33f97b590b8f704670771f738f9df52e2037a876fb185f0cecb89fba754af618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00495,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xee3904aea19ec5886c2f52956576a8e81fa4b2bacc4464257c1dc3190d6694bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00496,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdf13c18466bff16c454c4548995f6d11eb639ebfe71dc793b648066cbb23cb7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00497,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27f7ad957db315648dae2007f3c0c8d7ee81a6c7c3cba09119091325e7ffbf9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00498,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfed48beb69c269ece25dd3b123aae953c66433728e03370df36a76624736b61f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00499,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9c9a7333aded4d0f68412484ca0032f348c55ce9ecf21c986d22855625b3ba3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00500,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb11653db38e95638077c58252fa5695f38b933a229decc1bf3d1dd124c0d5f00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00501,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb202cc73bfc03b7f9f584614f21533221cbd0acc95409239090ddc52b5f27d9a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00502,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x19ef7cc080401251d654b9529fe8018fb1bc1a58cc6b99e8a5a47a40872c5955&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00503,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45f20620961362cc0f7f6e4f3fe15312150eb015de00fe77f6730383c79b9688&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00504,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21e3a8f27e2686892a5cf54955dbf7509feb97114352d211efa8573dc344245d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00505,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6dd1ba5667a00e35a95d075c187344e3dd341c0b96e9d7c686b1cf8768e2d4ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00506,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0414076dded3d476fba3387ed8b0eb57402f1017dbd117dfaa64eebeb162f24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00507,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa7340f2eaab8704157b80028c86a7f0cb1fef4864da34554f08dfcb614cf4955&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00508,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdde4c38d485ca458dcaf7dd54cbd451ee8c9eeae251d59b2f5fa6faa97280a14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00509,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa5dc42a17a4f780caf728dfc049b9fd56455f05e2ea06202c763ec143b9fd6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00510,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea2b8d47198cfdc653a2136b98df5615aee70388df0c64eb5cfb90cacd50a931&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00511,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd5d2416f6a00df2713ec8fa6cc13ef973d1eb9d900d852903fe1046633599565&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00512,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe2918e5026ffd68825dd25cad6ed824a9ab0a4fa4b85a35c4ecf4ef8e0544d08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00513,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd39eefadcb758f4e3c4e4b34eef2e976c6a3959432abcebdfc78d06bcc3148d4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00514,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8bd8f6bdf0226ae2173194ea147c71af760a5c0c661ff1f5ad7cac137b1b6d83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00515,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66d4642ecbc838dc65765a4fcecd474b20b9ae0637244181a84bb373b13d5601&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00516,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed3b11872cdaf7b8feb4ba80cc6635e2123473ceec8e939eb46471c70872bb97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00517,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ef487b21fd4c9f018e1c42787966f14f32ed2e1581fd159ea1e4259a6d73cc8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00518,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x710270293ed9c587e43e725361f93c98be4769eace47c2016e4189ef59c5b7e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00519,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x218c3b62dc99a297a595e41cca22f5f8535ff99908dc03940c9e4a855104b61f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00520,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x062e17197c2a5da9db37319b5a50917706cbb5b2f94436f231515944f5a533af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00521,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b55367f4c641c3f847e97b9507772f3defe8e7a7b7e7ba7485a5350838e1786&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00522,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdbca1ed318fb0b730386df7aa1e3093735b7579852cfc869c4ef4bc80cdd6564&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00523,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x297cf9d5925da0389d57e13787de1938ca0efbc4fdf2683d957e86f076191df4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00524,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf389f3b6336ac065daf31616b7dad80bf6e725ffa95b57da3cea36466c04fa47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00525,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd851e82289f5aeca6786aab0281c156e6e75cce90fb8689cbbbc6cff69f034bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00526,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc69972a185d32c7419238da9577424406252b97d93001e401d8649fe6991809c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00527,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c103256a2b901f09cd43ae21da8743d4b7c8e5c925d98a67de5579de1d89630&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00528,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32a674ae21d37007a12f57639d299bd71d378c127c3b5bf80d9b7b72f8a89800&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00529,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1bf711d19f7b6ee55cebb887105666aa7f30c594081b4b9bacca5b42c935d68c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00530,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaab9d4e3f1f4a07e2dc09ecd78ee8fdd50daf8ec5349ce42d33e93e73452e1c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00531,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f51dbcac068fc62805ec9b43a0b1b83c683b23f255eb63cd81ea3e2562953ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00532,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb4c6703d6f10db4d87cfd07d94c45cdf6176fc42656997210ed219af1320df18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00533,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb2932ed5e95ea609fc5a252cc60087f857230da2797d62330595e0647430f1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00534,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc65d109d82fe28526fe4653452cf09db4db6a254c2c3054b8ce3d6cad489bc3e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00535,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb367122e14176555be535edd3085bbffe0cfa73f3754ca9eaa10dcae6f60e82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00536,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfaadd066133e49dcb1a5fa2c92f376f3d165c3b276ac75e5881fe7012b2734dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00537,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x576b374c1d32e2db299b04073d838366c4525a766e1c10dd8fe0a79ac2ce45f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00538,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8eab6c1d289e8f853425d63e99768ba364012c21537e9be20e9b8999ed94eb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00539,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c32d06d103d4b1f9d31779131b008f404e149a5bd8a53f6805ad0331e592281&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00540,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3078a9b01c1741a63baca8c231bb4a482e62d835c4eb3ca3ef752154ef9454b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00541,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3063ad60f10b704d724c082e97a0145796854d3ce3d1550347309657dd36b8f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00542,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x90a242f8e1785389d27726dab026c0e30677713f67c4bc2747673358990aa4d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00543,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe9dd353aa0b026bc9363961397d25bb46f26570ea7f90ed982373d6a7115c72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00544,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c5c761520401a356ed867ac5172ffcf59b1a9b9c6fda3908a4c9474ea075592&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00545,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe6369239027eb6239ee703f7e9e6dfdb32dd1a94b70094dfcadc9fbe0154e4cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00546,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2135141345bcdc69e19b4e3df1ce29a017c07fb80df9b27bc38287c2c5ccd628&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00547,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0fd9e031326788cff66e44315940516bf926d51524e880548d90717d0da9d6c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00548,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe318be79b341bdbc93f1900e82a5fff4f52df9b9a113edbe4bfaa512d1411189&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00549,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2dde72e5e61c9eea6351d4ff14794a71685daefea6ed3cf9b62ca9aa99f9313f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00550,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd89b717d47ffb827b1490a37ffd97547694c6ad3dbdee5cd56a3583717962751&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00551,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8dfd8606b55c4f54453ccf9e48838bca6accabcb629be668755b0a13867a77c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00552,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd6a3521a5eaec4c47314a4b123701777fb7ab51af66093ad8c57bde9249bfe8a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00553,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf702584d8c87da3ca916ab9caac71d0a0922884cb8db05cf513d5b4144bac3a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00554,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x700d58da768be40c844feeadc5f42385dab83a5b758aafc432172fc150403739&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00555,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41db6d144ada4684a7a61e108131d5d78d250b3e47c8cccc85b447e5b1088a8c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00556,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3503dd53c35d41dd5df98f30d4a4df5f7c4a456edb598cb5c2ecc91cc81198d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00557,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02391085f2bdccf3e4774ffe1e0a7fdf318fdebd564f5015c64d6d1edefb34bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00558,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed670fa946019be6e96bd20ec27eb5c92bd6177ae0a32fc9cbe2c179cf7f536c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00559,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63277435c400bbc4916dcf4d295ab0cb233d68834bcda11cc231e999996628cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00560,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe89160d7dc2b0d06408df356eb166aad39c73e6fd51e97f5a64d1f6d57fa1686&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00561,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf95c755f337bd6df5127911e601a763a36070bda95ec63ab8adbd1fbf148a35d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00562,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97a6fdba7ddb6462d9cae6ecaaf13c2ac670f7db6216547a5c20ef46a9a2af6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00563,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8aa6ac0e68888875b0afe306759d787609bd56cbad19a9cdbed484cba64b15b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00564,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba8486b8d3fc13f529e72ac00fddca459b530ff9a9ec0948a7838089401efc60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00565,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7cba894eacdce587e611f2740c3de0d15e3754efe0331e976e1cf0150035fb2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00566,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54b3e34b615873aa7def6c73d8d45bab4e5f0ee5a9c8e503340ec9bf42e32cb3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00567,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40280a8567c1cab76c46ea7666b3f17b06a6b1d845922feb286020e7c3439091&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00568,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad863b1e23e92bc3b1dfd81f66371f01eb200bb178d4c1659b39fecc1d5209e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00569,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdcb283eaa11602480e3a38aec7563c48bd939a61149760408704f243062dffe0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00570,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb9123623556bc897c2f316008fddb109a20ce6abbb666bf55d9f0e96aff0dc6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00571,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb65f3342d82ea682030d61222badd0d0032f03a44fb33454fd5965edfb57e9ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00572,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc59179d2daa0417c7f7879eee3d53a08066ad558a36cee1535a9b515b0d0cef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00573,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21aec308be98ab2777b0030e3b55220901ba3e4c2059a076086ef52e11e15e9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00574,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55e72fc99ac693fb34bb00d1ed8611d53d6414693acaaa52fdabfd3099dfc88b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00575,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6564eb58e1d7f625d3a634513ab089b913301c69a30faa1bb52730be7908721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00576,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x923096d4ee10bb045085a46459592497f6314b580c75c62cda1e27c637f105df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00577,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5914605dadf8851cf40c7591ff45b182fc6751a233e8ded429a92df0fca49c5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00578,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57d591a81cbbb89601aa972f81d25b61b88f534fa7fdbf207611ebb6aa1cc267&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00579,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x705b8e045b05fb96483e3356c8b0e0120cfef7a8e9649476bce35c26a8d25f95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00580,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b210184902c591dc9dd3630edbe4d816137515009ff3447144360d49ee26317&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00581,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd3dc3f99fc86600deabcc70f3bd7ef4fa9fe70da3a428b2b4ec622012b115d7e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00582,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd6b2c7ef628b2a4e0be27bba141b8f45946d18ad5d17255d9230b21555a377cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00583,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x434001606cc9da452057323ef3d56d1cf3505f9dd19aae59e918617e11e180e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00584,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21b2682b8046bd14001c17d9a9feb7feda179d3a56f21a722df82042056dd1c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00585,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02f0b1510358fee5dda91e345cfe38e0e0bdb0643d0165ebc51cd382fd0ed6fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00586,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x60d868cb6169cbec6c74545f6cc362b6b44290d889527a728b1af1f846e9230a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00587,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x59cc91f73e2cb552ff57ac76eeb2de51c49f80f237e5e05302115e2d1500f668&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00588,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefefa87ce3db08c5545fc2bb64021e8112434e06ec3760bed7b6440d852cd576&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00589,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85c8dc20f625a20a8d969f1cd97a54a4c760817067763f9992be2e1e9d2d9e8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00590,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2bd79cac465f01ebb1eb59886d2b7d2d1c7b7c1debb19d5cea88470aa13fadd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00591,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9b21bd9fc16529e92da39239593c1021e195231affab0eed3475b79e01d8c65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00592,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9dd2dc6ad9373a8e5e80ec6ec9eba8b0f2242692bf27a93678270986620a743e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00593,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a9de411103269d9df322cc24c80bc49e30b0d0021f0a13c84e784a95c1412c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00594,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54bb502669ff807c87513c7ac708c471efaf3782d0ff9b7dba577dbd5024a8d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00595,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08fa26596e31b58ac3788844e300b057d53983911166d3848105b53c0b064993&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00596,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5e2423f9905b980f953f2c35daf3385540333d41dddd46c710ab7dab864278f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00597,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49b11d141d74f6eff4a99a858413e3ab5f3d3740c6ed5c705cd66070af051a63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00598,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x050d0b97623cdfd0c8d202dc6bf4e0c3a73df861383ed307131163623422e0e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00599,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa19b1a209ced8078ab2f240886f68b64cc67bd5806a08d472ba3cccefc5eb9e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00600,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa81ae85fb6a0ebae94d8df6f34414ea890a7ec7621ac195c683a6d6c34a594a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00601,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e26205a26df3598d2ec6236069fb7a74c37fa84cf323c4fa09f4bf7412e687c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00602,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x287136148ea36dabb0693ef81fe921e25974d96a2724ff0d86b10e3e78302ffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00603,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a115bef53f5237d03975ba6c2baf4377bf8e15ac54bf2093375681a38cbf19e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00604,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba62e0022781cddf46d8da27f2c69b7c1dcd33fc184b2329fd59cb187e351d3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00605,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d936f160c2fd830cfc16d6c17e87ca0cf6e6b28ec1f6b7d934100e82d61c59f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00606,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae859b842f320c06c3899683b50a2d37a32e1b07786c761fa092e10e572793ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00607,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62d75fce6440773a1c0e6573ac37e429164c377aa00135c7e1c2e2f7b06a4759&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00608,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd449c48d3ab67d1f1f15eaf0dcd5351f9c463f6aa103e6b4ce6a17a3b69bb523&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00609,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e60445e276f7e090b8ddc8a36a01bc4b66faa212588130c1175a5797a837bb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00610,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f230cba76af9df75862b04ecf554ad6bb46abd4be7a8e99dc468de6d5905408&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00611,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x290b8c2bbdea109cbf5209a39382993c21f9d520ff8fd07e85d273de90c5f587&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00612,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb363f64740a275f7816130024de8ccfdbd67fae7526a015679bee407a5e5f485&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00613,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80a4144c9bb6e7aba587a8a91a1362a5edf92e0fc4dbcd339a717a9200cf391a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00614,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20913bde281d7f10d729b290f509ab76ed07603f32033cb73071f43cef734092&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00615,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b6e7a1e1535c08d0457aacae6cc68c0385a62a35282179c726707090c84985f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00616,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbd35481ad334939158e73a3b0e8214993e9de1202e8a8ff567c5dbf88a3dccc1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00617,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x624ad401fff7fe715ab546b1898e5f3e735f42c134d592d49b4615afd5b6d3e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00618,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc70c6f7e13ccb5d9a1e56381ac39cabeb4c2e9f1693134d59599b7260bfd7954&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00619,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b807cedf382c87a6ee8cf00a7178eba5516948a0318aacb8176f3e577ce0a6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00620,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x850650230838e76460e4ddca3edc33bd286c3f8d40ad3a1ff89b35280cc6510f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00621,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x385fbb21923e5bbca8952a90a3d861ba963d83ddd01c9730fe177341cdb25260&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00622,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92fb5e57d123f079903c0f55481f913c45d490c7df412a721d38cbc528037875&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00623,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x642081dd761497e077b1aab32917656570396000b075f9c182ffeb34e905bf91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00624,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1d72d6273c3ce96a26a5442357d4bd58b84dad51a2eb39f25ec02929e55290dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00625,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7ca7cb8ad47a85c6dad965e8c89bf7b33af62fc5dbfae0f5e141ae4ae1c280c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00626,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f92dd261b9f5a9ed03735dc46722963d949ad3038f66ce380e4a1aaec9997ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00627,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x06e70723c3b912cfe421cb2126e812684742e304f2b8f6d6eb57b1fa959b19e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00628,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x313cbe432878645b4d887d961d6ff1dcd3c75b508b9263c05ed385754b7c7709&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00629,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe939c15140cdf455b99492b6259ecf0c93ff858719948940f54dcc0d202988bd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00630,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1fbd3e9af1082f0e99094876294f6a857d8162f32c1f583eba1618acd2099a17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00631,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x333c0583cffee0f355a1e3ccb6aa6aa16c80ebdc789e698c5f0f17521fc75035&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00632,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbd6027f363c5a6efaf7d6f483653d256c6038a628064927411e970280a7ada9e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00633,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2fc5d74d149d6b265a5f6ef7b220738da67423b7aa176bd97d8b1c0df694ea47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00634,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b3c9d594d6329d06de454698372063fe7c17da6f5dedb0ed68d7220e51af8d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00635,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95e4dedec09d095e65d74638d433817b736659254cfbb46483ff449a9a1414b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00636,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8124b1e4bc3e7715dcff4eac8fdfd594f035a5c37ed7e041c85928cb0f32a93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00637,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12daf758eb702d488f8ae9c61e89b165f4b1e4090dba46713796dd49866585dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00638,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75957ec2b9f6cd5f4e74a8f9c7f87432ba90888af7eebd1cb621b4d8b002d113&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00639,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c4f218a868ac866144c6d3d76ce9418c7674546ed3dc36e8ef313dd58913d6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00640,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cdc61329614d0f9f495f56c7be93a89783786ec23004628348b62819a5db04c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00641,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x471f9e808ae0a317cce604dd035331ef6409ba0c3b0b0bf36ed93946fcd0fe83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00642,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x551764bd61137d2595500f29b441cf8588f4ed1f7e1023182ee72656ad70bae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00643,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x368d4f6f887c76cd7416b91139d0613952a137d983d7ade47602ea026edf5e04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00644,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81a7c3da06068fc345f11d7bc65b30d249f3bae56c476ef2c16a2d7a04e19112&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00645,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2582b644739c464536ed4befe7d7bcf77bba70a416a74869934701eba0300a4e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00646,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7fd3548a22eafe728cfee056c100c5ec3622ee0280a79be7b7fb5cd1af2499b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00647,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07e93c81557232d569357182dc05bbbcf7ff3f5b3786163cfb5df756e601d9d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00648,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01a981a6bc6a5c30e9e24acbd2610094f612785ee1da40150ef6adf7759418a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00649,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05bf160d3f11c285bd8d159e9a675bf04b17615fcadb4390e8f582246d52a263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00650,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x119bef0c67ab4480ee8952c208c75959a4a98db6b646410d4276c650e107354f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00651,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d3f0b82017c63839fe95826858a18ac4ae5376c004d04a23aba4d6d7a32b96f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00652,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x730975c7bcbee5e2bc9299e12abb46dfc7f5b94416c94b6b103ae22d4a189049&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00653,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2eb89f05e222461e22e437518949767e25e432862909e07df410c6ca237cb567&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00654,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x51b0bde3cc9eaf4d7ababa77e2e06e65b262864cd9894a8f9edf4b3483ee1d28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00655,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x06381406a98b16d278488bbba3f91c0ec10c1ace930d75833f15ba9c73500a2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00656,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c07242390289d92c0deb8bf23da435720a753a07822a0bde0bfddc258c2ae90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00657,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b0dfe65c189822fa4cd1648d3fbb1ecf75b8b5538383cde1b3f899caf1d1bb1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00658,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeafc91b6b61da1feb8af3c78fc9b7d01239962fdbfbd40c920a55f620ff74351&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00659,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49e7399f27b5e26165b5603002b529ab4a974346259ba9aac2128387c0b6516a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00660,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x376add4f0e8ed9e97c43c5e439d90b5742c913908bbd5ff6da3ea59ac381da92&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00661,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8a70e6e484c3180d23874a903ba032a1377e3bd53fa9818d7c11dae93883fa5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00662,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdffecb3c77a67ecd4d71ef3d16a47cb27dfeeda34126567620ad4bc0e6ff5961&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00663,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6c4ef261baa1dc41e4e3f559e686ce4e340cb14cebebc5ec6cd2d8d11b4bb550&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00664,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3eb2993dbbfdd451bf6ee204a1aa8363bccdf05442fb2d37283d0e9743c9548f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00665,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8f4067864f02001aa64082821d09b6fa8bd4f08eb10a97f2b3d725988dec18ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00666,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ed7ee7ff95fba3f7e26f8ba3dedd661c29cc693e39ac180fb1cf51cf06be01e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00667,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6b898d4e160d6568325e5178aad53d3b1928eb26c0a6983e2e564787cb59169&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00668,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4a9d166c6bf0bf68df60ac3841b9dd7643261a1f680ebc4a3eb1e78a2bae263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00669,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8d978428ae77afca8ea889e5e315b4840b2c03a2f9cf046e6809ab3cc2bb50b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00670,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe3afc5ce9e69625defb1cef154c5ed21bd685b3b444f0bf18eb578438483e84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00671,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbf138a264139a579902a52806444d5b72e5a7d700b441fb3e48007d1d96badb4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00672,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbf106779ccffef7ba05420f4d363f699759225b5c63c0570c644684ed02a1a82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00673,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdefe7756ebd4bbb46d00e6a9ec83e0b448ad30cd07e8140e8d198a762e17bc9d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00674,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc6dc6388bc26f755dbc33c06ede33976846dc45cf406aaacc275f36bafbeb8a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00675,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1e729aa1a7eba72fa1b394e8e02ac0b11ff5b52c45ade0e1dbe6cf94133d3d52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00676,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5855d981860b945790cd878ab958c0c8f9d634e19eed4ffb6f2b6fb0bdac0b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00677,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf3e17cb0fdfb1b6843f71e8371f3ec7943f3fe8c336f50eec94be6b3d7cc74c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00678,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42e737249c54ec77b3e92f6e2ad6cefa998f950a04b6e86467096abe91018de1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00679,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf0fc97a52d48a5cd63c3a44569661bf5d52b37631aa5de0f9c43bf9fe2ac0e54&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00680,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6045d364b325ce7f818cda8750a79196c59419e2be015438e097fc8b52dfa0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00681,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x247222f0af90a8ec543ba8c04c847b648fce30a323ffb4cec28f0c1571f878a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00682,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6b3aedbef826280e9fb8ac59718ab16e5369cd11be51532675fc454d89d533a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00683,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x19fcceed6516cae75fdec68f8d34a12c90b64c4d140c4576e724251e6ee6ebed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00684,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x388b0bdc52a25713bd30615e094a873e633092c199bbe247c96c32a61fc12263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00685,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2bcc3ddd6f1ec7a0e90f3faf0eb8418a297538a351f16523bf767951cdf179b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00686,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf515337eccd495de4a93cfd27e7cd44bfdaaf7cad84ab831255b232d9c3dbad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00687,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8977442562e00f0c2d71e621848a4ed4b54dc37900075e31d4e945cc1ff9cd5a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00688,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa979df6fe13d81c5777eae13b0416a370a2c631c41446e51ffb060a8a6a71452&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00689,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33e5fa30c4826bbd3448bbb05dd7273639f122e9c9cacaad987e1def1daa7c80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00690,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c95061fb3cac78558039c1cebd4c7e70831f6f5a7906b9faa1a7554cbb43e28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00691,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x062b4177522f6cbaebe9e708a4717d0f5218b21041f84b7eaa13293477135e10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00692,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x945645ca1e3e1c23eade81c2c8e0a7cd428d3dc875b15fc9bbdbde163bc742a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00693,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c6754fdf4780c58461bb089f7d5cfce43a0c0b527b7044e27eda9852f34a7a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00694,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x222e02bcbbe7f319c293f0c4da042bf7cd9c3bf8c953f4319a14191e4f005966&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00695,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcebc5a0e235e81bd4488436792b62e736be4cdbcc60f200326cc91b436808baa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00696,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf73fca1b251055ccf2966f306db54c0201bea107de603c1aac0f7b2914386dd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00697,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc3b18315c91ff81f2f9c76c74c0aec6f4bb76fc6cee9512ee81026de4f687aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00698,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x062461dfeaa7dc2a5a6e7149f2ba928b78aef2b9958605a31185bcd7f004522c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00699,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7dcae2e8fbc54bedb91edeb0c02141574a70e0412b2045e311330119491c2129&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00700,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64f029a915ad77e37247bb296e4e3eca49dac180d5b91d5b9e1366cb5d02df74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00701,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0ae757bd5b3d4a2a87884cfe45bd3ee2f11239b51f9dd5cfc05401c5c66bb8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00702,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xabe351f7c2bbfcbe08dc7bcdb0eeb08079046bb9f2c94a80ed7bf8e51bddeff4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00703,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xddee734cacc8d4ef083d67efa4df54519a60e0101c0a43842eaf93af88ab3377&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00704,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ea464e978346b97200486d8994e77706f83622452eb3850a745b215b6351eab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00705,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9f0bc9d6161d69f28e3f342553c62fe53e281dee8c05002bd562b964c7abc1a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00706,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58568eed1ab113f2d3305f595ff6306f9bd4a20dbc168388afce22679b648ccd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00707,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6aca18990b84a8ef483d70e93ef95a3fefd969b44162724e8d205b2e44a60e09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00708,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2478502ca3b5bd3787da2b2702e4ed470abc698594043bd7eefc6b0d200cfae9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00709,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07426af091dc9d0b455e6c0a6de13abd24f3eb3a8e7763538159bcd1bf141645&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00710,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa70b753c132d447457a4a4c500a03afa9fc5a506cd08966303adf5439a183fd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00711,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1146e2f9e5e7d485c0b97ed15f1f6a5d3ce2b829460d37cdb9ac49d7f6b2ee08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00712,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x560a81199fb507f115ab5c06337c8c4dc0fe38d991a0057b88816849e2899ad0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00713,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54d9396ec97021ae660990c80c6a06075f9e7e2cb7520f242b8c4019f29fe4c3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00714,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8979cc56b72d0fa09ab853f0c94da9223e371e4e3a76d085a8d5e0ccfa812c9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00715,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a583ca6146142cd35125be61ebecf376f08db4cb907d613d8877b383a961923&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00716,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4850905c37251bdd1612b0948a06170a335831bd753be7c62d0d50a8f10bfb34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00717,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf510edaada3d10661180eb5af717d93b8c5e39971c0c7b82245958bdc47d4359&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00718,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x511c0a35f990cf41f851e42863956b7fa20eb133503b7f5e8b7dcfd42ff57d8e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00719,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x14409e14f0ae0f18d080c8f6bf0ae89e4817e214ac3b2c3e7625266375a502a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00720,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf91e8a7472e27a4172246ac5c5a761575f2f25650a2284ea607f8b607ece639&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00721,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaa8695870b38dbd336c12ca05e61ae474fc3540e3780da64432d6cae23de1ed5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00722,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96e85fdbaab8e3e96a18a455b6f7c52dfc256146b15b4a17cd5349a1e05dd900&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00723,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78bf01d3000e5bf37d29358748ec99c6e4eb1d6e3203dcb914b0b7009bb475b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00724,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7c27830b175b06d64f2c9e7f6533d396a6527aa8078030d35e2997805031dfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00725,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8859c97fca028d013b18ac01644d4070df18cb369a380207c646808ee242d99e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00726,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa705da9bf450e3f38cbc0916a3430caf7b7c2e5b84b0eed30865c21417a787e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00727,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58d8312647f7b4f93bb4e166ebefe27b4031924f7550d9ba1d2ab7fa58fbd547&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00728,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2daec9311d82d342bf0a5f197beda1aa5bec47277d79baccc91d033c2151d583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00729,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfe141ac786b2e586770563dd5812bab7673e4939e29473e6c4a1a75d5217bf13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00730,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ab51ad5fce5b07c3935e88c8a21e911e30fec10a5066b79e0d01df2737bd613&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00731,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11b0f603bc13ce8a712ca6ef749c8c923097c455c6b86386f166b1e47daebfd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00732,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e648126f5543d814037eb55ff7d4079433fb586ec6b3a2bd0ed968f8fed9603&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00733,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x87195980bf623a55f7bb30e396648aecd839768429e6dc5ecd3417dc44c6521d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00734,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a924a1baf8970146ef21e1ae77cbececbadcb975f4f950314313381d50fa823&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00735,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34d9d6a7333d35e1f16458eb9bcac884e81f93dc421c3ad47b7a46ea6f929c7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00736,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1569f88b5514b6f98302427c8ab4b4b6c020b517b290b2c7b1e8b6b9ee2b74f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00737,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x288181ee87c7c1f4c8052ae1692959d57f9f4b123014deebfeeb6df20dfaa424&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00738,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28dbb0e5bd25ae20d92b68183f093bf002cb40e2d0e7b9597ea6e58478db184b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00739,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bd79b88bf29f2048cff7bb28f048b67312009bb49d5c33e0a8df28fb26de7b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00740,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc84ee78099163d07ff47d4e2f864338e0fcbdaa1298b6fa71352e6896655b918&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00741,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2aacc622a545af97bb40c4d5decffd5142427c482ca5bb8ef7f29951e1807e4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00742,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x165aa7d2b8608774366225bc7252056104da64abd35ddbd1db832ae375bb6031&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00743,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4505bedc2d45231f48b90817f82a686da0f8b362a79bb0d774cb396288491461&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00744,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08785ac95582347c80d4321d003a4c31d343effc0cc8e8d4a32f8370996123c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00745,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ea3cb82c7125522aa5fe08d65c4edcd10e1823d312f13288c5ae9b69b2d2935&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00746,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3ec58c854981ed2f44dd8516cf166b12232e5e32d2fbeddf070fa45a1d8cc638&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00747,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaaaebe5b4f04d2085247c7c9855d1add2e8f0d7e545c532cde20b6145ea711fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00748,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ab3b22293636bc4bb517aac1a3c22fd297cdf1c8da5cab2353c7b657208f1d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00749,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27aebfb9c574b6b4a90161369be8e3361b887534f6031f35654424c9d50e3efc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00750,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc08abf8cae1d37837d395bfd9094e01b70dd66c8cfc9800fe8fecb4b2b09599&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00751,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x032ebacd972a00b4cd4fc81ee4e8499468ac379eabf1de2762e98aaa957e4cca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00752,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf09c12bf003999d4e98769faca1a7c12352abd26bfb290a048b846c669bbfc89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00753,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x876733dd576846ad12f5967b4c131194b19013232b270faa88f816795c403e6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00754,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf50f5eb285818911c3fc43b60174f25a9e5b9dcac9a5f3e6914d8b0af439234a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00755,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d52bb12e70194eb981ae85c08a02d16b7e899262dc34e7b028eda0a123421a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00756,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0af4e42bc526ccc68e29d057456f30076323afdb70a6aaecef47cb316a689c88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00757,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd1988f793da01c8d63bbd508befde9fe8ccc1f2f5974d9bdf0b2d8afa0b9f997&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00758,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc66fcb070ebb36a3ef93360bb74079d15f8c4cad6fada6a408dc33f982308279&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00759,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6242a1ccc07f0b240026340ccc6d91d99396732364858d8dab438965f90545d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00760,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x824af748696096e08232cea82a07f15a590908d73e4b72da6733ed3dce3ce648&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00761,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76b41584de30eb80fd613f82c44d7fa70aff42a1760221e3852d8865923ce75f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00762,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb3ed5869910b3b75a102644af13fb642991e19aa885848ea9099f31091cffe0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00763,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x713aaaf6faa21e1ace76e89e35cb9cadc04e01a6808e264dc08075a0a4074e09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00764,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a6de7d91da79fe7ceb3f9ab4634e88efb40832ef2e776624ffde6b3d37b6443&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00765,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18b5d60216a44d195c8c533a95a82c1cf17184393db431accc269b8f759f6341&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00766,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b5ade6c06f8ba9ef42f64369a90145db95ee3f84c7ef2f4cc0bbd088d400287&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00767,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa008476355318634f1f429e5921b41860e1f2b84a56f25bfc4d1bb3ad99e339d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00768,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8dc563b6cdbec477ab54634e7dbe0a986ea6f745e81d1fbe2d9ee2036222f50b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00769,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefd6696f77b898d126c7df1d9f481853086479c17279d5d138348e5202bce86d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00770,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9db47f4de8d5d1c4700ea620d918e8ad0877e06d40183790fe55bf6a334748a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00771,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2aa70a70c541cd444fd2caf88968d737fa7df568af3e13526cb9efd7d0c340fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00772,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44dcb9abd03e34d90516dfcf01de57529d8e5efe899d526fb222840547e98dd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00773,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4dcc8e85df47ef9e3e5ca5d5fa8bf8597cde9c9234f6ee5020260e69e911b2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00774,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63f82331a80309f20bd3c9500671446c81923ce5023224f9502343c7db25d83b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00775,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf24f282ea23a59a5c6451e66987eca682686d8b5df910676b2fcac68e675a3da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00776,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x382525f177efd6e19eb9949fdf8f31802f86c7754d43898dafc36eacdcf72db8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00777,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d3a5e7ae6a0aa3498ff29bd9c01bb50be16608071cdc311690b08d54b81ceb4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00778,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a24e96613beb77c7482edb95e3bd149f3a95df7fde1e01c23eff75a71f73dd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00779,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0be7242c1c73f21c6912fe398bf625f142d4b00f260cd0169b82162c7b215da0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00780,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b8c7a94e807b13c8053ee0c97d5f38f263e31d9fa703d9b11de00c7d4c7945d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00781,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e9ae0809cf9e38136a64b629b4b58f37bcbf54b6744ef3121403abb14b1582b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00782,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe888e6c289f0734c57b9c61c1b6798e5d94139252173305a7764c8c4cc9da157&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00783,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x03027295eb991e1dd03d652ebc3ac786ee4c263504a78fe31398341844f235f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00784,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb6efb516952e014d0e2197320e521f15d58f6eb8c88bae72fed90c570ec3bf85&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00785,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x79728b75e2cbcd3ec3a144ad474dd75eac9e1dd898fb3c97023c4edfe7d91890&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00786,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0586eef4843820a247d8f8201c6b77e828096bc02c4c5bc3d2c3b83bf42ce549&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00787,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0d4c8c20e3a37f678959b563859677050107b0e63d043ca1930dd48a93c0311&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00788,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa55feb48d4922a3189983989333d70c7fc6b18656446bce243eaf77fd21c54bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00789,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9b95d3aa1408771b1e1e743db3216bf9e512a1fdaf6035f7a9f40e3019e9134c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00790,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a62280eabc47623a8015bbbdb99a64521c554491b9ca4baee28def4c857cfa4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00791,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x064776dafa35a56678a5574157b74c8e5f1433d823f8addfacd972e0d2dfa90b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00792,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe9a295429a1b3fe4ae05e4444fa3e7939ee234416505e5bb12533e45204ccce8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00793,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x93ac12baf1d3519d2d6db741537a098b5b97e00c7044e96eb2c49900a7d3c3f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00794,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb199a3097a3b71bb74286673315795e98805a6951174ec6957b80bcadddffe1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00795,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x284915ec1b0af683caaf90546c773bdb1e950f8923f9468192e160aa757a4869&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00796,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80b8a59801157a40d10e17c3915a16f78eca8b03998466f59ce4c4f910ac0760&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00797,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40e902aaa84d1fa5c8cfc7ec95846be5b541c785a9514f6886257431d7c7d5e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00798,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25bb39c7596cf80eed1af44ca924abd9f738b386cc3604beb0cc0e139b570a5c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00799,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x565a1bf8ee5e84e7e9ff397ee36a656ffa670321bacd7533e77eaf91ea104561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00800,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6723d6d967dab127477429efceb7f975d2cec28aad8ddb603fef54cc69fdc6b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00801,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c9057ba31e7f3ddad8a3324a066efb9353cbdce8e399ba3061531737b118713&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00802,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75e347ad895b4b6dadad02d048f988ec7298298756d55d924a6605e3ce2bc9e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00803,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafb8c20ffd497fd6ed9ce26ae25f7a83c66e30bfbae612cf83dd83972a75d7f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00804,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x472b0432e2d130803fee6986e35c0decf8989cb0d0645cce4848848a30cc990d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00805,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa00ad7738c5a78e98095ad2803f5f02736ddf5fc471940d4d01642317be7bafd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00806,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fabbfd520862fb8c2a3cef755e30fab50f8e235460924f43eb239e3276738da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00807,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xebadaa845247da44fad909d4bad16b43a5e63c6f48bc3eaffe2b98b27f9e1c3d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00808,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71a5a039aa5425f801492260210074426cf5deb420cb2ddf9defb3601564f0d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00809,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a78afe865f39dadda88e3d3d493b6be19af8374a62f0b48c3cc8b41e28227aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00810,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xddc911377e4dd2291f709e0243a6cc7331a49aa27aab1ef211470f4662c8e460&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00811,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x47305f69611d5c09e9f302c34c1a491b8166f950f14fa56ed0885c11257f0224&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00812,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6492e81274651a77c064ac8a6cec00c509e58de9a951070770cab002658d662a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00813,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ccf4c433a7e66762068756cbde59d2c603e1dc1d64cd0e61bd39bd636ddd877&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00814,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02f878d63294625f5b8e01973359df0621504feeb548141ee1fabd1747bb2f4e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00815,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe97a4d00ec948995c670a9c30441ca9f510c6369f00ef2fb38624f14d8531eb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00816,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13c60a90e71fbfa321264b1dfbcdf76d0b15f3adbed05f31b02848e4fddad79c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00817,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f8e5552d9e7982de12d6cca3368f02671fa6b071f0618876d4a1e9a4d79a3ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00818,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8143cae1101045cfd98b8202617280228a5b68c0d4f37180b79327d4fd555a61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00819,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3894e28cbfa568d39fa7db232e4954e9c14f36eccbcc4c1d35cb8562285fbcf2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00820,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97b69aecc1068e3d89e32195d6b0058b13a2b762cdfbecee7d54256e67bc4b81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00821,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22732c1861dceac8803885adf29e9c9b7758ee5c2de3660d175aec67e0deb2d8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00822,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6977fa0d3194c37772fb68df9929cc9974fd9441cd4881adf20e17408465d544&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00823,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d164934226bdbae6b1a9c2e284a02bfe3e7552ac901576e33aee614f8f4d9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00824,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0de9eb6ca895573dc439ff773e617cec54c9a3e83c8412ae6bed73594f51845c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00825,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x14eaae6399e76bb8c66fbf9cf4333701bfeda482cc347590402ba802332e5610&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00826,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0848f10dad16982805b6bc7f6151605db509bb228fc49dc647bb472c0fdd83d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00827,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6846201d042855e80cd3e2a1b2f5f0a6360d499cd803900873c1900264e45448&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00828,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe89c0e11010967dc5ceb97b9ef40a45f36ecd9390c82b58d95592deb04b6e746&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00829,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3096af7600019e93e14000a119faa50fc3c60c4fedfab2b65ef7c5e76c40dd2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00830,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55e8b4c2d3dc809690f3276cd43ddb11b907c7a975de41041a1cf47e6fd535b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00831,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc501837ee2c215da498b734153628de1acc5d433179078696ce82a4f2fda42c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00832,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7000808e45b53416da880d5a8a6face40cb10a55fd1a9f4c07bc125da165ea6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00833,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5d73b97ad48b73368898a1e39b0f725c43ca3757b9224dacd2f8db81b90d6807&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00834,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf240decca5d9b9a21a75948716f83b68499f5f260fba9e535320d7ad2b8f654f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00835,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbd0a3686d9e771cbe2410e0eaaa2535d140a5b5628d2dc5b79afe2a54da0255&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00836,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbd2c4fe042a2c0c30942153fd2b2a148fd11275cda67d7e945ea50d8ce9588a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00837,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8bdc330460491a8d07586f41f6c980500b273533b9a98d0d0d180230a35abe43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00838,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a2047ce16869ba58f7aa520202bc2c2345fac6bfca50e06194361165cedc4ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00839,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84c88273e2546de530b060ff56c8c9fe3aef02cc968fbeac333fdc4de9c49cde&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00840,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb96ae20a3f7c6cb7890d5f72037ba8a1a8be4e4f758be430f089ba62c9886887&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00841,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cfe6abdb5b075a8fc721d49e76d0c136de22d165ff61d27a7acf7050d84a31d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00842,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7d8f3a61da1cf210b8d80336009634c26f97ec52375533406ac0f0f7e22f5fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00843,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc14d7f51eb905c4e662965caae40a537cb7a85d85458a5508e91a2498e479fd4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00844,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5eea731a2a18fbbc08066a06515c8f05d8838912d961c32b31ac31736d8e5df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00845,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaea57615f40fa35e4c73f273cee2b1f077838a18001e8ddb9e87d28286149014&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00846,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe228f4af7a96d9c1cbbd4e76864e68c332232ba5ce81de3e11c0d8b33bbf1ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00847,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5721c5a99dfa32e02559d43450e95be7f59d245160fce626eb8e5c81c271be87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00848,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f17a7ba2d98477f2d2b3ade28f2107d35516e8f953b636ac1f6014f4d1c2204&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00849,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81731fd5dd5f8ba504c4c3bd1080eddb3e400e8655bfb1e93da5450177923ce8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00850,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc8596aa574934f8d7b7a0c938ce736d7da8c63dc40bda9719b1469d1ef93ba0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00851,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9d76d294b8224a90bd65300b2bb1c3c5e53441b3182c5b0d41011f626046a9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00852,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3db9cab96ffd143cf6bf1c330e6cef7467783d82443e5122006e5d2fa200f1c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00853,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05eacb145ed3b25a1949999d28e34eaf4aaf8cc033cea6569f8b53a4d49199cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00854,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x787444532a61379ba993a92688941b3fac90f64fcf9a32d022ef0cd78544f813&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00855,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb042cdda0306e8678b89046603d24839002d4916d40849b5dc9e65f3124952f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00856,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3dd963be82c9bd8bd0a27cf846b0fc901d63b7a5de84844305385a2de4dcb57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00857,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1caf90ed8dc29fba89264af3ba07d0874e2f03c223cf387fec52bb0b7c4c5017&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00858,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d89c8e7e7bb553c60a7fff4c056575791ef965ece8adcbb8923c17c2ca42403&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00859,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xec9f0685cf4c7e59b45c2627b98afbf56f2d113415af631bd875962dabe376ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00860,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x608f5138cd3fdba7adca86cca1623b02d967a4ddfdabc1626298aef841f06e98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00861,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbc7139248334659528164fddc3c05f6933494abdbee4e82b5c16960461fb6bb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00862,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf5d2654fda6b2a14dfe9f390fe8464887263d7415ab839418c21db6d00b75e02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00863,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x29f0d1bd4ed36f2a8fcddc968249af476e48f49eafa8c1cb3ddaef3c9f6fbb5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00864,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba09ed24136ed4ecce9e3aca125ba9cffdb949164e4ac0115a7e5636bae9ff81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00865,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef98f25e48fa78413bfcb8bc7d7bfede024ae12b74727667431d0b7b24c88197&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00866,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62ec875a0d3529f36a0559e183518082de0a399e1b4840e3d5d23b4ea1e6adcc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00867,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e38f92d9e902c7c4e46d334d8f15126fd82a220c3529cecddde6b7892187ada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00868,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xada339e00fa18f5a7a48601c4d9db77332f4df313771b2a166bcdf02c07b5dad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00869,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x687f70ac1c22d04c591b239219d4cea3fc899e22a15656cdadbfffee43900445&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00870,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69305b6644efa1ddeffdbb7c5fbd55450e67237a3bb38fb8f08e81c567952569&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00871,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdfb483577885f06bf36bda6c0918ddbb8ff30612412e6b4a67cc4bc867f2c44c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00872,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1fe0bd683f075a332f51a8d355282e02186aaa79a97f75c6a317dea751ed8b30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00873,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6754774ca2adf65caf7d126d0a1b7a3a9e9385968e96d8ed20389a3c3a96895b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00874,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x89ed1e981eaab47a9b1afe89f4d8fd3eb60d208cd9cc2cd3c94c2a5e784f3bf0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00875,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x918e70e47775c40e4aa6674b40d2f502e26dea08e7fdcc95fc612f9411268617&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00876,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb174fe364a001d733d0ea0de0724d33c30d59ead3ba2f7c318322935c17b9027&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00877,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ee06c6001f96af9abdc53c79801ed63bac846f1de194b8e31fb0e99e6cb2dee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00878,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xacf82dea7eff2b6749a07263ad51979a18d25e10191259c97531804deffe5f59&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00879,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x194ae19978f7ceff5b951ccc21ca69e4093db9f14b3dd735675b658614b50163&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00880,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88dc77d7fb4be097712c34808ae6bb09f4adc13e82457e2bdb930cf79cbb08d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00881,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x291ee430fcbda963ea5ab68df639ea92ce325530844b6e5b43a306fbd3bf86e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00882,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0bd01b96a078f578b599838c06357e455d023c72381c0c9d96d2a57099f038a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00883,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x24ee5653b2b7060f64b723f52723897140c6a39d07a35da8b362335a12fdda1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00884,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf46491735b52306f745dc8a439441898c7a9dcfe6301ef0cb0f933c55d8b9432&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00885,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18be58079d1320046e689e4fe43cc04d43cfa1794999974288fcf3625e6411a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00886,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b8e7f87674815b502a57c0797eca3288e0b5ade2a8ca7f78dd7ba632b127e25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00887,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xebfbdc0207cea435c10b7052a0937c699721b2e7e41a2d925d0eab2ab81e9c8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00888,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2911ec4630e2dd25d76cb86d8ad8427de4fca247c5e641ff2ae16038edb9ff52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00889,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7bc66f0a17605a2e0a082da2f3f99d6d424efa091d15c856e0bab50875629e07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00890,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde4cc0f167df6278f89a5cd047e8079d7e9368fed79d2ecb3e8b31537f744260&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00891,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aa1a5b9610ffa5b41fac5bd68fcc7f767d3434baaeea70e20f738d369a44315&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00892,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5354846b7a3b0764849ba2c006bbd7ab19d10f2479bd99c822442214eb135aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00893,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75d76eeec8dd8ee7b5849b76e8e3c5b363adbf59fed68f0df8c89ced4106ff94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00894,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81aa556ec3ccd95dbb8e26a987f6e0434ca41766f68949258ce05f805f74a808&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00895,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4704352715ff20066ba6150a55318d0e9066ae548b4375e4ce9b31e530598c61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00896,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ab5749f22bdf79c27d6a073d93687b6e375b33f38cda1d8ea1b8aa794c0de76&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00897,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb81f63bc9725916a88ddb5a5a6d7b7d558afb1d55bf29d57952da749e99ecbb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00898,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac96c90242fbe989a37f1711dfed7051aaa38a13d8e8bc3ca5a518a90713cccd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00899,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x922b1cf4946990d76e6aa05024474ffce4b71c683db79dcd7d08fdafe537d04c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00900,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f8ce28573d070b2160ba328d9eaa3d81af5b60443acea676cee7cd234f0dc9a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00901,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6f06a90999d172458e44c324081d1ee668709a2e4273a35fbfcf1312b913999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00902,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65bd2e95f8d26b9e2b3360b40175eb62b0881772fc80085a3d872a533362f5db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00903,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3b916edf62cfaa0bdca3d8b3f13b9654ace5f3a1c6c9a787dc07452b69cd985f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00904,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ebf7c0d8151e785e5eb6ffbda1269e7d9d7f36545711099119ec1d486642994&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00905,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e7868aa92b87527f63245914226d675e3d09172ef63e3191562d1869ccfd5f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00906,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6fe8a5a96b514f6763167cd7925516af89e4014baae26d735fbfa65dc9ee1fd8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00907,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc681d3f63c0705f771f6f7cf8fbae11076db7aea57e4aa4db082fc82324eaf4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00908,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x65f7339775a6fcd357411605348f51cf908f2a6bda04b392ce76132c1fc5a40f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00909,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38ce4f9f511d38303d855f92e28b6e096b749211b0861af2aee292fd34ab3af6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00910,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd44a929f41f40d97e7767775efbcf22213dd313c0bbbecbfe6130712b28b2fb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00911,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc91f464f9eae7f2fe1844bcd1c304c8467227c5df40b5518f2d262e14aeb011&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00912,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9acf8a7ebab7d5ea23e59c7434b854b29d79a7d52153264f96886051df865c23&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00913,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0790733786688f30e6d7d11388f7daf100afa105770f218e84321adc6427fd24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00914,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x822dfb1aa7d617e0cdb16f997d992e643890aa048e9fbf89051e42349602ace9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00915,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62602cadc14d41fb1a9d1c682afdbdc3a535828fd89ab1474040dd571631207d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00916,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b6dd223bb5846cf7af3766332bb4a3c7d0075b350f82c907db76a2765be8dbc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00917,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb309c46944a731132a289569e9cf52c57e9921b99cb00d02926f93fc83d6e86d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00918,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8974583a7b7ae104b867fa6ea76b999ddc399498dc070cd622df9b2eaadcf4a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00919,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd139d7b42b3dc5b0316ec6e718f6ed470c2b8063357ca6a5525eaedfd77fe93a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00920,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b83da490a1580b57e046be20c03b6f6b9378cfb8b8313a2d58cd10bac12884b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00921,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7a62f3b8756e0b45061ad40d0d08a4f400abcc7f8f9d21c4eac35d5eb3c69032&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00922,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x30f2071bcc7e743301be529cce48170478cf733c09f76bc7a007486e907b8d42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00923,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9f05e1511533dd79377f64581191380f2a4414538f9812bc978575ade32e4747&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00924,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d0da5014bf3664e6f3ee37a221447169bc7ef4cc2a98fd8141462fd4e6eeb28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00925,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9de1930ee287c457d1d7e31f789e7d73dbd9b2ae0b1db00a74a8ce7dcf8b022e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00926,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac17e41e8ebb278089444caf7fb6de4be8be17e0d2737713c19ee56e233b8052&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00927,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad6865ca7acf691972f0906fa666ed8742cff9e41ccbf870f1c2e6c8566e1597&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00928,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3feef311a950eb4f513f3f125bf4941b2664e7696c637c0998aaec146910944d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00929,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e2d1f4b1c5ebbb67159e8db1774180c58e50b633117fa630e99025a4b648b12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00930,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x228684d7571e71ed0dc00adc98f4ed6242dadbc65bffe61c131c91e396206d0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00931,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2485471e5350c5da449bbd5b6cd731be0a47123f5b26becf1790b2a65e8ea608&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00932,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2f69e075dbae9462a935692b7dd566909e2d95734929376b0b7be14e0d42fd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00933,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44eff5aecb4e111871225cc1b58c1c04786b1a4aba892784b7551b9e8ba90595&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00934,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac8cf5be8f250e984277952c431a84b01c0ebd96e4d46cb1b456d0aabe2fa7e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00935,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc052cdd4116d1987a3939c7cbfa2f266e8d181465561a8d0ade58075cce59ab0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00936,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d1ce1ba874c0fe555d4c8d7a238c459d5cd3f93634abd7bf304eac7a225bd7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00937,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20d0836298d617aab81be691f33cd1dc61546b081a1e913b7cf34e5afcb8c8d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00938,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb915a9512d1e0bb47c535ab0cc6e7ddaa439a720c4acd6d591be03ff738a402&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00939,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d5f2cb94ecafe782fc87c9a65f35a98a38b249bfe8a6c6483070d22f485c752&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00940,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x31a360b2a347dc2d8ff1e2ee51c8d487fb02b3ba20ea86104e8c0010e6840674&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00941,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6247e765c7acc0135a2a1c8359ed9280836e63aa78bea7e5d489d44cfceda482&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00942,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc352aa92f9ed89ebfc84d9bf131e0e386a26b3e6264cf3ef6e0d3262fc55df2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00943,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8b31db995add4b70a2637cc3e46d37b0f9bb608f63ed39b1676115569cc95e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00944,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a8be08321010d8fbc280fbe2ff0d9a9102738f588dccbb4401ec722067450fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00945,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80961bb9747aa130e7b0f37c81951fb8d28bd916ac200bf5cf0ff8b4b5bb2bd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00946,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcaefe64b2e4fb5f87ec1027d5ce8c9c545e116b687657c5b3789d195c29377c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00947,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccd88affa72df06596b5ea6d9429fb5c0d3ffb7fb2ae2be3746463c4572841c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00948,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11d91c258be65dae198f1301b2b3bbefc22d80a62dc3c789577a9d9584441322&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00949,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x209f845f27a7cfc68440e96a9a05f0bf9ffdfe3fa2b77f0b66ce46de6ee6a1df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00950,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a9dede78effcd06746878f1ad7c1c255e7451ead558f94a610d64de9e84a569&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00951,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6493fcf8ae0df3ba0344e3f3962cd9cedc50b435d278c680b1ad7fe580046213&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00952,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x611a2c464cb0aed5d1ff89013df62f77a4c66a4dbfbd1310b861e17c0821d850&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00953,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81e7d01751bb41cf701d58e15e5e24af7cab732efa990fdfc807d04965a7949a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00954,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x19895bb27f335092570be78e1c9e4390bc3165c12f3b4801c3386502dc1c14fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00955,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x443f9153e9d10aa291a75482f6ccb32b7f03e5ff28ffecbc218bfb0d17645c82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00956,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dcb543b7fe04863694029ec36709cb2be65281eb77801ec7a43c47421b2f266&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00957,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2d2aa3950ccd9bd38664a108384da939a29e5bd3602b44f2e6d0f7e078f8181&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00958,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x24f3f044349785645a815ecae5ca634e5068415f3e47f83a4de78d1f5a0ae0a8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00959,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8fc647c479f7467e99986f5a67aeda9ffc96c49cc3b2d939adf2e02e6cb631f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00960,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x680241a45f3921d7038f95843ee7c15a97fac6acfffad14edd0b80cd52525b8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00961,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x759690ad2ec0fd1d75ef612e00b72ba25bc5c2cafa795df819ac5410fe245a45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00962,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12b37dfb28e1b19692de0b9ff9e4564d3712ba1abf0085cce006e61354f9b7c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00963,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b4168b786abedf1fd231b205fd827ce376aa3dfad7df2e8ffa37559c8aaa489&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00964,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa7136656c0ac8a32a5cacdb85d35f7b1cfbf46add043b65d63870b7be188e662&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00965,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a62b4050b97c853f8b86c1a27865c5e8550689c699c7ac2cf18d534b4bb523a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00966,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x73e45b2c1971c37f6bffd67467b444874a0168db85f916c4e1e1cc0d760a48e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00967,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x399424597ccba8d81b2fb6d2f5b16a310e43bbee1d546bc0a80450f7ab202a60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00968,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdce8aff6baa754aa1d9c385dfd56b5d0ff0c9644cb0756cdecf9c4b1dc75396b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00969,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49be47569890def0996f17dea252bad3c05e4f90c23a6b441e05db55deef4df3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00970,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68c57c6ab509c836dd5c5c0ce07cb41070698639ea7ea4b9faa07dd05d9ae9b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00971,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4f6b046bf04ee48a7360f9271b8507f13e222b37deab56d84090d8ad7071e40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00972,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13a7fe3ff99f61c26ce53cfad439b83aa50af5659ca5095a1666106ae43b178e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00973,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x135d2ae11ee8c376d2ee5ca54ebe8ce915d133c5c9330f9669c3f870cdebe438&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00974,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x922bb3c21c999cafa708dbc7df398abd83cdb51aab98537adceb848b95b0531e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00975,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27b6441bb01ad4bcc2254fbbaea88e69e4adc75d9305a086085602eb971306af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00976,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63eafa02faf46070cc68eff888506aae7e0bb2a4ef9558fa2ab095bd30b95d4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00977,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05bdc732d86d690e9fd8fe7fa8ee4077e92535202176ee37b9a2f124e7bd4212&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00978,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95d7750a07f5423f61cbdd6797537c1316d250854bd865639df437ca3c70cbb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00979,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8cf0d6245c51d3d854eb5a77b46562c4416f5dd64386eb5254036e44e189c9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00980,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8768f5c3b2f7d860b55b71d01ededf8c4925a13c4f6eba25d2f1e9eb5232965&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00981,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4e8ddcfb6cf6972583902cb5e2d10c8be3ba895b076f7ba8e29c09de1a5e512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00982,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd4ecd7c319b9e27e4929f7c0e3ee7baa94b58604b55a0684832524f816124f41&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00983,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd39b640f89b8d62e6a58bdda604a6931e5a97494270b8c13639c9291152a856c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00984,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22592d52da8f0eed167b072bd3f9d68708ac37af6884b76497f518e419efc4e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00985,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4e144f9d02c04d79c9d03a3141f6a90d3a9217d2f348a8b5f57ed50deba907f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00986,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5e7db59cf4b1329d19cd7dec561c3eb7353eaf71f3f5eb92f1cfa9525425fd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00987,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9316c767971e58e2fcfd1bfa386d6d678f05194403a9371194b26e160614f57c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00988,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x871302efe9a899f706e248554a0a7834244e9b94db1aacad82a96f70d50ce3c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00989,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c3a761603d969947df6da3491d18a2f55dc67cad3d7ae813aca79089e8e4dee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00990,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa666b3895ff153f24a671fb6588494111eecd4c4482379b6bd662361f955de46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00991,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3154c955d0dc8f9ed8f5e7ebd476b549d5778600afc737a213ed6156765af846&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00992,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd078def25dcdd2df52d7e37bc2910e598ac00c921473f8d93137a07d3a403edc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00993,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b2615f1fe8043e3f4f06ff4f918c0b34bed01cf776b535a3a16530b81fc9d91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00994,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ed3f90facb487fa49945d0ed5f987a03b8bf76b0377fe2980bfe9cac2a5b6dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00995,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd3223ce7a69afde216dd1c957c6116cb76bc2d70895921c2ccd6b9d4f79038f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00996,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x016c769b453ee0995a23b0b20bb83c3870ec7754867b8676da1c3e4849511160&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00997,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe19a4c9d8889c46240475ea0e669e967b4ca09dd35085c327dcf75e127093d3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00998,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x36c9ff39ced94ac5d4ce3c5d8ce14030ca154bcc2e99abdcbd71344e8b0fdfce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;00999,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83c72fa27934098dbf8aea00c2491a9dba82ed6ae6f116f12ef96404f63ea6f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01000,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xddcc603638d6f6aca751013a22d42f0b3dc9e55794978e37f46c38b622fe0ce5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01001,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d0fc419efdaf8f46067013cf528064da86116db18b5382289afb4b6e1cf2b9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01002,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf69f7b396a816ec0b8a377e3e75ee054c47339cce83f24de1453561c04f24789&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01003,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1763271040eea5424900aea6164448f842f699eb662f8409d95e5a5635cf20c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01004,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfbfc02162b85f7c870dba66af17bdcbad0f5e6dbb8c7b0f2ef936a0858595077&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01005,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x584687a4b29aad825e7a6f106afe5f27a97ae104d3cdd7389fad0f44ad5cb101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01006,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf8970e84c6c9134c98a890c83c4649fbae258db7cc5d3b1fc3c63cd6ab64708&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01007,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2fbbff929c09f13110369d940831fde47cd6eef07d5449d4b3f9d353ca155dce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01008,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x235c9a91c69ce2ce21267dfa82b595caacd3f9ee09d9ad725e5913c317a05646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01009,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa09b4f1cabfd5bf65704b38982b06a536e316ef4b533db69a73ce2bf88a571b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01010,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cacc95c0a0f16f81baca64b7331b81bb577b2ce6d451b9b3773f1770fb1a948&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01011,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdbcb3c6423aa05a61c71ddbf3181af582e525b5a72a9ebb8e44913bb981acfb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01012,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ac002dda4b8f105f2bfcfe0be9f0dd8cd543abaf99e36340397026f68fb1210&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01013,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdd1763be363eae6e854d82cf948ce79aa3903b24fb1bebf83efa5bb9ad8454c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01014,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4e0e059fb5489787f907324c81a46a400a87b3cc056601f8a9eb5fc88b1d32a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01015,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd2d13e5ed7819f3841af3e911c3516211bac48169a52d6c0f0525b94af603d61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01016,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa93277ff5640373ca1446607c231f0bed5bd15a096142e7376580f3fc78841c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01017,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x019e6db033ebcb56d9d51ba309d4f010fe79a0df9f6f3114b052390e273ec750&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01018,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x763ea921a273d3b92099e451f36949767992111073117536583f5fab34dff71d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01019,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45d2795144aa708f2aa6d5016635c887f97c9e609dd7eaa30fbdbe04ee2acfb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01020,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37e8f37e7fe680451499d4cda814162837dd4e60b9dbcc1cb4a09d8aad95cb5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01021,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6654a92dac9365e122dfbf52b5d2134dadf1d638aafa879893e50ee2da2152ad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01022,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb81a65c13cc3d54b281e9ad392e8792910ad09b39b8dcaf6ae8e3fbce06117a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01023,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb72e8700d81b2d7c322dc74a3f37dfce6f3b08a487a92242fd0ec2b8bebe21fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01024,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75f6d852198927b79d8ad8bd5505983052e9ac80b80d5dacebd4687d60d549e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01025,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcd13479c8725155feebfed83954d53ffcb6725683f43c866acffbc6e9b97ccfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01026,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ff6a9b9fc585560ae6780a7c54170e8f501324a894f00f08828697d661ef0e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01027,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6c76c020b3f3f95b9c50a8d6d7949cc9c9798522070f5e35e61c6521473e15e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01028,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x78f9905648fbb6eaaff40a458301f05a7bb753a6288eafc141c797ca01db044d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01029,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dcb5e2a8b6791f5141c8ff08ac59a36030c9436e6ec6de8274be01fb81112c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01030,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x373e75f1325d787a5f7e66c6b888083a7b1b2e6250d2764bbe1b4f1145dd9b72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01031,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf06e62b5bde482371af35d2b3eb05bc4e9f80da90c64f9a36c8405bd0779f123&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01032,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f19793eebeb6aabbbaa055ef131d73f1186be249bd8bbe2b11af0dbd783cf7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01033,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa9765c1c7bb916043bb42b1572cd96f905c3e2f5fdae49010a5102a9eb4a700c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01034,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1dcfe01766b650af58d6becf6de168e7da980e7058c7b6424da1b0c470a7ebca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01035,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x946b550f1e19e68d272a10be6c0a1f9310da704cdbdf518c8a90b694748a8c29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01036,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb953b4b78c6b2446d60625b65ebdb25165d4c9a46916ee303b5daa16029257c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01037,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8356dd445dc79c97a83819c8538aab5176664d436bfac3e9971b1c9cea78022f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01038,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cefbeb9ce2ed071c7abb2b55fa1f8ced72cf1f2f9bcc24955a17aaf1eb99c29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01039,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4765ee428148e60b0038ce5034cbaa7259b0d85403d37936cff1f1f220c09419&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01040,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc559659c692f7eefd643fcfdebf8697a04634c839b6e1724382b3bcdfcb15170&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01041,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b1f9767d845eef02506d6a6c54fffcce5bd6bc59b41b00f17ef06e4c63edede&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01042,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed5a8fb5f2b0ab802832bb99d32a9ba463945ffbfce2f56f26e9c39fda1c3fe8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01043,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa396fcbd5b63936ec43b6bacaf2b0236783c638eacc72614daa29e792ffe1ac2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01044,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33bd34bdc9b4c51f344e476fb8c97fe80cfded7c90de437f100505b17823c66a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01045,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe62bdcaa8531750ae8fc247c76445a76670077643060efc80323e864c2c2c480&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01046,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37db60cdd4270773f870c9cb8eb3368d0e1443789dc44cd653b0f423addab3c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01047,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd02ff344a0e66526266e7ac1ef9269ee132e793c2a3eb2c20c95212665880232&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01048,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27c44206ef714c1ebdfa21cd959c074063432f3fdcd7a3b0b2ec4375e12ba53e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01049,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd74dcd433ceba7a2a6702e807c68470b446772565b466b0878d4518983640500&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01050,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x583482c4b0a752dd12430176b663ff8ea5fd11f2eeebd8b956702d0eb473a748&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01051,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb1375fb5970e469451f9e7b9a29f3b20ec0c583ec90b79fbbf38f9e981d9a9ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01052,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc68a5dbc89395b13fec398a9ad78b00d813fbbb259f005e6fba1eb1bdc7f2cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01053,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x038d0dc543117df0c46ca6cf4467721780eb951017373d51aa88ece1a380f56c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01054,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc630d10c00e0f843cadfac7d24f8ad02f7603bc7555efb4fe7e6a33d42d8fca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01055,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdc564afcfef0c40d16d7fbfd90afc419bbc37fc750f790130acaffc32f985dad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01056,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75fba5d5c98ffc1f67f8a1ea520808f94a547003fa4fafa34ba7f9b2dfab7383&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01057,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2a347f31fba049b5994122c3d6de4d37196ce8fed6c7c7b5c2c6926c28811c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01058,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e00f70a6b91f77cdd78c01ca54d506dcc25f226fbbd13d56b0c80e8c80c2694&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01059,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c557845f4abf757fef7dbbd11b44e44c92025733d16b57ebdec6ae10f381f38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01060,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd6b988695e3c2a57b1d3038de5262349766cea46600f70b8cda2998ae395894c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01061,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7edcc464ec0b7bd04070e80a4795a4d59581d9d6d53756eef10ae5a38b40259b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01062,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84fae3dfe3699b7ab0c58b47c604799d1fa7a0088138efd63cd4603e79cae112&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01063,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x97a50adfaebf0ad4f60329d82fc6fd897416be8c698e6a6d3b6e7da8934a2f97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01064,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25e68a390fda36ad8fee616a22d79cfc531127e6c8cbc11710e8f5743399d9bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01065,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88ea91bdc01e8bc0fdda51dd2abbf05a92a14c20052dcb563faef0bcaaf5d161&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01066,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77a58ff5479dab194fa000221e98fa4e6dc77aec51aed889bcb852db57db3d03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01067,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x95926dd93886d32de8692bda38da9e4ab10f9026ddc5b9ff69c30f55e0915ebd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01068,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9e4b22f0088519c08bfd6cefbe125caeefa43b83b451fffba1a87223dfbcc62f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01069,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5451d56c823a2e8d42ad39859e0758b8a4829a11daadd96ceb4ab2b29874c7b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01070,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdd746cbf406b80fca7b25d95961640fb0ae5d411468001224c3770b2554b95ec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01071,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7162b854ae8194deb0bd3a34eb77be0bf539ce76c566ae2e05207968a908b95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01072,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0266c3199c30bb4c8ec4b5797d112795c89dbfac6478dd5d3b772a14158fd69&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01073,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb390415ebb31243ff63e550cf27cad325550dfee0b421c1c1be75a845319585&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01074,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d668fd503ab1327817d49218ba493e6174918a03b3120133126c453ca345e20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01075,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38bef7ff6fd5999f6446ad8abfdf10a24045ae1b837b0ab70e1db500eaf4cead&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01076,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55f5a07a76490536966de1a99fee90d723ebae9e8d0806d9ed6f1580b2174db7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01077,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x61a13d92beef22d97be7f3c1656cae6760fc08e36db7d381d5c96222fd50f864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01078,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x227e71270b878bdc138b23386bb7b33cec9175875b461b04902f4af708c31580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01079,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf1a39e59434a97dce0d30cae7bd6feb571827cceb3ba57af6af183e953c24b6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01080,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b7d09908d41e6463da4ef25bc4a7e2545528671a510352110cd382f5b300d8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01081,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x679b43594ec30c0fde26f3a2e05561c7e110ebc15cce1ec5b6d7da2fc5a415c3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01082,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5e7dea252df625a366ac47bfcb1e8eb2df49d44d0be463f98ba95d256d6982d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01083,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdcb8e564e8695a687939ac1a0fd1a0cc5dbb352f9cd24427cde8360b2a9f200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01084,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f2ca307599872cfc55256ad29009b53f3303d024b5b782a4abb591c8cbe5a57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01085,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12230dff9cefa72d522ebb791d84eee3ec55b5c4a4600209cab7c376171fa159&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01086,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6eb5d461ec98068957cdab5b2028bbd8b1b2f7a221a8ea9c8011071da37d7b2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01087,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45541bfe08784bc6d1298d97e0308241efaf18a47bffe4894dcc26ef776b7b0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01088,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x09f2f43ee828665d8d45859b5e36a8b9d31283550eccf4f73b1a87638e709803&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01089,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4519917d2bb898a1810ede8b13275e678198aa773f7eef2b2c05c129942cb259&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01090,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x506362e6d66ca9341da4fb5706d690f94711b6673ab9b7d7ac22dbd39e0af8db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01091,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x408e7c249b773c396ee2a412fdd8ef7e43fcb5538e026aedfd34d7b9b721e60d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01092,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f1216d3d70323582c6544bf9c07bc6bf3582ddd01a52550b257b1e078dc12fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01093,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7943fdae6b71a9c1a6d7320a61ebb908c32b91e8c9679808b09da9f28774225&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01094,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2458aba8fb9a34aa4b4a5ac20b23f843e8b12929bdbf793499c0187de963643&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01095,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc3174a59e85dd195642088336274f531f551c50dbadf407323d0d1d5ef961bff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01096,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5475a30e12c46b42b661a0932c94efe35bb76575dc0030255dae625933f32712&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01097,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd2ce1e42bbb308bb9e0abb971cf5b4d9ab1cca8fbd73d11b3cfc19dd0b3b235e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01098,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5fb12ec44e61e8a76d79d4646c09a67627cccf3576e52206f580364cc03080de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01099,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cd92052c419c186c329a14c7bab28a4496c23e243635d5a263a3ba34d0052c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01100,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x22b095d488d0fbd0f10e209b322ca59ad319975d6d3c90a81d1fd9b6d0243dc6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01101,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x844b63b3997c0468086656f4733991f97ec42d5fb1b65c050113d515117bb756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01102,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbcce4dd3d6cd5b08a76bb8890eef30ad7df184972df8a271648de5269fe1ed26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01103,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc97117921c0dc002265d161013da1171084008fe5b51d046c695b5e626c9994b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01104,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5035027c4b5ec5e2df56117a2e012b79c9aafea7bc89a3015e9061e226893245&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01105,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9331be3bcf98379d8a0e2f65a70785c10fd620d3fad050315c2a1e2f6c8bd6a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01106,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x901078cb9b1d4516ecbda207acb6e6e2891a134b0c80b647240fd8ad50016063&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01107,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8edc0d4190782ba1a6bb98105a33cedd5d71c25b22e0138d5bc5d902f9f5a34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01108,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42362545904d6792bb88ae2a9f7d29b10623e58260d0ec47749781227123a2d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01109,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbc521ceaa2bd28faf23c9f256b2b24c98bfdb90a020d25216026f95d065eb0f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01110,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x199eeafe5585e55674bfa0a341988e470b65ef78061b3f20eade8d1e271ef3a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01111,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd34462829eff8702ce5561c6b1b715e63c8a89b7f5eb274e8c5588cd15678ba1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01112,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c93ba5b0b9c65421fb9cef8cd24cae654c4ba7d386a53b6036e4019eb517c55&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01113,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbeafcef83fc5e6769d82b3c304c0cbd5a1add1277e1ac300f0bc5c7e2822f2df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01114,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71ec790b6d9c1f8e40159317162256dcd6f52a700215fc61d329587c64b248d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01115,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f6094bffde8d3ae31ac86b2ffa489481cb8b4b440d4613edb06f5e40f0effc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01116,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x053afb71d72d02a534cf646231ef23fbcb10a93ffbb85b43bf6364a1b6cc2015&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01117,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x98396ff4fbee74940a9a03c33032d84f7285608a0a3ee7c58e016ca8c42157cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01118,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5747971200ae6086c2054eb6a3d0a5307b84a2c2e7ce4dd0b99fcf278b5b066a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01119,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1554c47385b828df19e22779047108210de2c8a34fd0346f77b9a80c630637a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01120,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5db300fa117451b25a6f7a59a55e33947378c5216687ed6ba23f38a721cbc21e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01121,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb9aeb88a7f2c33e5ef7b0eb9e4001ce50b96bd4576f174ff5fbaf2aaa0ca3cff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01122,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8849157cde19e3801e69291365f8fc095855ea313f1a6cf5b39d1f117ff166a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01123,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b7bcf33f4e42502cf5f0c981f1103bbb8f9c98a0a4a02f3ac10baa8328906ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01124,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x224f4405f110ce6825bab6f6c209a4b5518894bf489795e92195a87013406ff6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01125,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b6064b3c367b296c0a422c00bf4606867164d315c7ab16d89f1ad2957a4734c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01126,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc7344cf278e4f244a49689243aae7f3fe30e1ce07e5aba04ceac1cc40fa922cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01127,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad12ba3851456ed8b37c7f21c8825c885a767cff2bb776be648cb8356946cb0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01128,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a386e6dc1d155d89af575c544cd88581c7d178bac55cc44f63b2ee888223764&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01129,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc77dcea67936565fa9d9eb078ce575698500dd17988daf0a7a8f246ff5508833&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01130,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa25a8fc183706411fa20ed4f3b2a68d96e0b161fc09468f33beb434c48f58bba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01131,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0225209e1b7c3463f869898432742732f32fd1e7c5f64e5ed74adaae2eace9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01132,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ba9f77cea8694123218706715d4224221fdd5af2b022d015071d6443aa3a1aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01133,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e1c1d63b865ae597bfb51c82899e0aa4107a88dcc6ab180ebb568c6de993700&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01134,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3197a1d6c72f1891609283366e120a1f4c61412f83835684f28901d35249a04a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01135,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd28f2c9f79253b151384e63f867a55278831d92575d63ea0a6b14f39f373161c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01136,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6cf8d26d850172c2e2bb9629792fa93afec55de913957c778fe0895734ae70d4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01137,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62215680c0a6143f5f66137de7a13356a0d1837fa842aca997aa6d4eeb1bd7d7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01138,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44e4142c95e4d04f4b598a4146c0fa04fde6db6afd78ddcc8be9fd16018ce72b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01139,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a70666e7cc7d475d738b07cb5e2984097e0e30df160b1d9b0698f33a9048c83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01140,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9bef85d30bd7319c6ac73e9195d2fb5a87900b61f09eff71ff9aaf6dd39d6c8e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01141,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x48066cf2b5c1a5a553ecd2ca62a466bd7e462a9836e3108fa9b9c50084109d71&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01142,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x112745d12d9f1ffe670ec1b1b1526ce0b586f0348788742af013d8b5ae8f1e50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01143,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc07f562554568dd0a8d7d83f4151cfa979abf944c364f627daacfe42d6c8e75f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01144,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff3489f3959c367261b35a4a8cd106e9b8e504da8f95c752126874757a68d8a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01145,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaa9a507ed68dfe695d15723f7f31e32977b1aa74bb8a948c2edc27a55c6b377b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01146,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae05fa5d0e96ad9e6fdda36bcc44637b1a4b9822c275dd6b0fbb7471715fbc57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01147,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dca795f11fbe372384ddae72721019ac51bb29767f1de14c808ca5278015b6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01148,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb970027bb776fd436f03d55bfc77b43836eebe0391f2f2673a794e5d9648ab7c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01149,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb2f6f5174d78083b50511b907c2e86378294179e05d89fbd98baf0996055f8ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01150,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae9dea31e94ecadfec8694ff8db30c1527a1b4deaabc042794cbf0f7ba068fc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01151,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cb2b8d45a6d2a7a1b43aacd57d78702ff161f96b9141d8489ada32fe1c8a705&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01152,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x28b41e3872cd3343b0901208ef472e26d98ee3facb64d2787e6f1196cda87d09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01153,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9cc1f6f0ae4b10e85063dbcd30cc2077a2eff89daadb9ee3391e9c460e39d1cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01154,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1d470ae11e0f409328f29e315a1881c3eae67123d48019c748a01f4e4f381aee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01155,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb516307f14425bd9ee0434ccedb692092eff147562ee7805e0c6e0df0a475d7b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01156,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c4c11190ca958c76cad26d8514fb383ee51183c49eb56ab2aa41704249b6ddb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01157,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7bb8fbd3048f3b139a3c64191ecf38bf1a218dd9544903b8ef3d0e546cd8af1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01158,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12ec0becbbf83afd68392f4d9b67d5a8da89979557cce60530735a1465c0fc6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01159,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fafaf52d0c069b6f587ee7a519e715604f4de04fca1a19e726671ac56596b38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01160,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0e1b363591af53d56c1c6a146bb78ecdfec21f12b34759aa832501c89c26a40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01161,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcaff530399938686e3364b6b228b3ac59e3b22f21b1c2b3450118170fb281836&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01162,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x070dea605d09f3096df0b0f76948df8a38831c90c4581ffcf6fed7bde0cc268a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01163,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd285b66ebcd5852a1911fe5599702a89a0dadda1405cf84dcf6d55bcfe0f9578&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01164,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2eb4c50feff7659cdd8f3ef48b6f9175a2a4b891d09af13bd0b414bff9b0bcfc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01165,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff4e71c2c49d497341e7386bdca329ab892c94197d5fbbd18166cd48843de333&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01166,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4116850a1bd36ed591c1e95e3cb1aace3675a61d1c86e1660da988d5faec71dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01167,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b6986455f3550b4faaa88fdccbffaf90f897971254d9b8f3ddec649b5260b5d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01168,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa23912b4a361e10bdd6093479763b042c8d09f8fc8a5909170b57b6aebd98339&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01169,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0737b4e5ab8f9071f44e61b66da61df228dc0414f3ba5dde12b7a8fb10b2e618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01170,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf35982e9c74b401291f2ae70a09ea99766219008b0e01880cf6302e9d62b60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01171,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc7466dda5723a0c33c326d1596717848dfd0256867df4d68deaa8adc3f61db9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01172,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9abdb4aeec79e7dfe79fdb6711da93c071c9099542344da75fe1d968009f98e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01173,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdbdfbc64a23515c0dcf517dfd71825cbe5d9fc98566f9c6b02f733e8a1ba3ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01174,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd79c75b859479066f9caa316c37f67fb7728dfc01a0d94f6a27ef126ac0692cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01175,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d2dbfd717f62ea857069cde24b45df8fd214ef044057175265d747411304051&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01176,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x94adbb4c520dffca694df807f479af7b035da83f3de81f014e28ea2d34e70adc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01177,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd5e0dc5aa1b4441e615373ed2c8782ce41b20b2a7816e81ee4311c243d3b7be0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01178,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c34962d525fd40d9c8bc44f522af67fd89111d332eb9ba5cc9b0f138a4059e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01179,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1de75523ed57212207b3227983ba8bbed7607c3574300abdf11cd1a372136e40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01180,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaac82868aa7edb8173d1d41c6b0745b7eee734182d4fdfd54e6043350afc116d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01181,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5899663553cb5e7842e72b43a64d86113a4b76aaec2b0774021361171aeaee29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01182,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x74b8aa4405d31335e0f8eb310028c7d05972831702b931b5f28d5afb3d52d854&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01183,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38d8567174aadf1166952a632dcc85d4a4b8c20c946f2399878183141a10b561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01184,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a82d902f0d2aedb663fe6998f7abaf0cd666aa3d6bea64e81d8d83c92b0351b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01185,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x528d123a4c8b57d0b25864c5b3f673c21fbee2a1826dab6cd6ae9ee0024e85f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01186,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdcefe6dde10acc340d071c61813392ec065800ade9040e5b721fb20fb8239a7e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01187,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25b5519cbb7efa28ff1b23d0f46e38f7b3b2c3fd96d493c5285991894e371f40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01188,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa8eec3288b23734dd343db2bf518380753dd2f602d80584c1a8247f2e2e3466f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01189,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0912534018135146db16c094d6a7a067062a455ba846f44be4d79e2c47094417&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01190,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x13085b0bb2b86b44d0fd7ea1476bee11b641b11dba8005afbf167cd3526855eb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01191,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe8d4138f22d8fb0fcb988bbded449ceb966203228554022e6e0564b9ed6ea1e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01192,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7a4ee2172c8081d3f6dddf4bb6c561c8ce3f1af703ac6b591e448c762b8f1d9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01193,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c6dae3a659f3b4fad0b797c457a546ef174569dd60a71b6a4fc1e66d1e1f268&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01194,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7d063ead7a3d4d51dc59256b72738faf2171d7844da6d5be42af7023f690d979&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01195,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68a0b792e3b448d4c36f26611d9b7652585f23f216785bb73d5c27c0c0aed493&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01196,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x94c969763e706d0e7fba95c4c357b0e855c68be2dbed2e9a7cf7b5daaac5a08b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01197,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6c39440cf6d60b35b0ebc651ab80a101b0f57d9163379474ccbeac8827d5fd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01198,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7a5ab53c462dba797a3b06ab177ba42b11a370240ce077b03fc1fa2b107f4ea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01199,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84b9e12ab6e9c0e7f41dcd01aae0ae2357ed252b3ebd78c0b2d95fff5e032724&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01200,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6b6a963488c4633e7f3af99047954e1c15fab24793fe43a4c9ec2c933031f01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01201,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a0c7f03de3cfd31752d5100b70f028c31856efa2fd1a3b5a8cec4a342500d34&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01202,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5486c645e895bc1bdc91291f74d5ce702e1c2c4d37f005c6c1968c96c4798a0c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01203,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08a5313b986a0428d49ab7b7f6cda4ede434efa3f6a69c5140ee7c46c977c30f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01204,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x975103710d4d4cc0c9b337decbad38e6dd42449ad533b3c464801bf10a0f7f8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01205,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7bbd5580e1faf3394083ed3a12ecc3efeec75b71b52f3c5d2527306d47d46c9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01206,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x61e11a8ca3db52b16ec4c025165e73542fea9eaed696dc528b1fc7d08bab6871&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01207,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3745949046134c86ab95f8da5fac1e0b96e9146b8dfe976b95ea8adfdeb10fb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01208,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4d0cc348ca8825a306f854475c04b618a82336c06150b936407f793bb132e1d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01209,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2008dcc12d9eee29e24645e17c3a32c8b0fa82423b230b1bca74982ff32499ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01210,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x842d419500195cf77644f8d7f656e9e0c7044c7c0227eef116f0b54bd52b8456&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01211,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa9c1369756e021602515ee071013086b92c4050c767db4f6952a5e875dc74415&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01212,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa6435d49ee936444ea5411227769e4e92c9bdc5e353fb90feda369d0b357ca32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01213,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71e5659c8984140dac3efdb27964e2e36dabdf863d34d9a44509ab28ff76d3bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01214,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1791e683cadd2556b588f262ed01f10dec8a17d0fac17264cde17dc821d61444&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01215,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb250520d667d2585a11f8515bbc942dde5271dee48bb2079e94fdefb4cd12db7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01216,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa13eb7c2b5320556bec64b033af8d17d73880423b1aeefd6befe0a80516cfff9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01217,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c83a392daf6735cbd58715ddad8b5ee5ffab29f0d90e9529cca55f1e5a9bf65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01218,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc13220ead135c3a3c44eb1f623db0231af2a830eba39328d3b0eeddba6590b32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01219,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f56b030ea9674db988e0e19b92ca4f4d0172eddb66b88d1421b761f43f430fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01220,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x512900cbb649da6361f264485c211c79688543284d48129d978f50ee9110ed54&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01221,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x90c06f460cbaed5f47e45d4761dc4860400fcefcf38a4adc8dac265798ea82d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01222,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x096acd8679ab399726890ee06192292f292205150e75a75d8dbc24fb5b5c4e95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01223,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a1baa666116d37631224699f89e17da92ae1d5df34857e3429b0eca71f473c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01224,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34f529a2f72e1e83cd12adeb4dea7f2bdf3d7c96ff50249b27a0c6a65cadca90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01225,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad7198e0def6e143734a5dc947221958a8e506274daa782383fbe833e664d60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01226,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d858029db92532563a3dd2e05e63de9600abd032bc3402b598df65b03b96f45&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01227,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb9ed6f343eb8d8aac3a7190c4327752c136b8d2d7a9cc4cd58ce619f2541c50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01228,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x024d8b0934652fece1c1009e992ffcd5a39c0bfaf4b9e464b492368fcae0b44e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01229,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4fbd23d89d82ef4034f1bdd888e2b20cd2338e5430326039cc82a8ee32242e3f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01230,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb70e3603aa922716ba38abca5dc445639eff218cbc2ace3e2352be344588676c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01231,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76e468cbc19d282a6075b218eafd19f63234beae51e46b0c2b81bb0b707b0632&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01232,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7cd7b651d63b2e5a4f6684ae77ab9d3d913449a92eef5a716ecc947ba553b724&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01233,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd077ca788a7927c7d2f8ca57710139fccb6e387c563fdc34aa9c8ca05ae0bf35&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01234,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccf5a0f7216ad6bb2ddc6f59917c9d33ef237a7813b09052ce349a26bb21fb10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01235,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7666847f3b02e9a581f7bbd41e906b894136b4f98503c2e2458718f08d319b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01236,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d10b1757feee8ce9ee56ab7d3e36b34895674fa7c6c90b2636e85f0a9e16368&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01237,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcfc709d64aefa7fcd84780a576f8d229f3f093993a38b6271826efaba6b55b46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01238,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf6f1e083e51e96a0b399e5878186085e9ca7d12512822558c2ed1e156a72404b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01239,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbeef9b07ca5099aa5f6bf79fb7d58a0e8418af292e992b4c1f1d9bf43f12aec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01240,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x02688fe8520ef9c0a4bc424936bc9b710a973517598bf394274c2a44cc848289&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01241,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20ebd6528acd0d0e507af27f82db0aef20556c9dd36f482dd78e12a39cf5855f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01242,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xceb89cc1fff1a05d00b8cb8049f5ba68b4e0fc338a5b7593e1bbbbbf4fe7c3b1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01243,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ca6a14a6edb58aa90fc386305b46048d24dd9b525e204b503970cad8c8864e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01244,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40769f6cedf1218dd656126546473cdb24657724170f0bd71c0ccdac1edb3e97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01245,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf2f56ea6ddf8226f222ae389816836c60e8fe9bc55e630c93e8d6634a2babbe2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01246,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0e897c05df5e53027934987158c81a2dab1a62638db704cbacc8a2eb0c3931f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01247,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58d2fe58f1fc86b6ed0e2f210e13723c8ed644dc8d32ffa4e55cc176b7bcbc3a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01248,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe2cdcc7c61fe867dcef5ed3854538fecccc3ee1501b6e66f3132596c79c41a93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01249,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x379da93b0902e34eca8296446820ad2e24d3e4feebf1f0faa061e099bcca3366&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01250,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafede008f90c6812f90e9cb5a5462e3dad70fe5f0d0fb383f833845659bf25e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01251,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeeede50f94cb63b7e19cfddbcc3f25e3c06dc4c3a83b001804ca440540d37d43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01252,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5b81847b51e4e59f89d6cf2361c42f64dc760fce9f0bbd332653de1f7474ef7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01253,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96748f6773bb94d740ab82734c26ffc9daeb4c87606403add65897512864e693&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01254,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5c3badc9304a265385eba2afff786a1f9464737b71d9301035b758820354da66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01255,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2599ae05afdf5e1b2be57990d21f985c0133406a8141639dbf33d46e632bf6e7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01256,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b44aee4e83d46ed4a02abb9ca11c1630073fc6b233c5aac3730f8d28e695859&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01257,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4952c5127010c24a46460214617a2cd34a5430ec398ba635392762668b21a64f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01258,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x713aba14cadeaaf4ac33853d6a33ae19c0ec40e02821d467577b61e371a53ce1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01259,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ae7b5ef37e8a2151263bd517645f1336e0907ef1c840b41e8732369ef1d3cff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01260,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6f90c321b6915a06965c7804e6e28aed175cd6d62162eff3fea564fda50fced4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01261,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x61d416a84d212bea9580d2eba99ca6cdb0a45ea809d540b49ae52e6a2d9c5f84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01262,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaee21385dd0720113fea63062d20dc69e979bfcb5f295131694752dbfff3dc97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01263,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9fa06b72e89a042853139708961c7114d3197bd3c98c1cef71ca0b34c01652bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01264,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x53a8cc3b6aac658c3b80f92e99521056c4035fc053b6abbd4068e5339dca35dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01265,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1366aabf8693566d39e974a595eb7e681f57170fa8d98c68e1f7a4397a6f4cf7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01266,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2631621efb6f486a6c82b58c7cba7c37dda933bee528d982b1c25570a45df03e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01267,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dd94158da7fecd20d03095ac40774de44befb72fcedb2f94ca801619b5aaef6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01268,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed99cb91c4babc2b4eefa48bfc1ab03f710aa2bd4c6e12c60e0bfe78e6a774e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01269,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e65584f39c73ae662991d6d27dcfe9563830c5210ea07a12bae36dfeec36436&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01270,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69ccf142f770f0bc36ec796d3893b895d9b602100a30528dafa20e5a2c28da1d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01271,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66fbd4f182ada36bac2d86fbdb791807f55f3c2c010c79d8fab7abaa404fb002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01272,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f448c5eace75539049635435d61193beca590922f7255ef040ebe6da1f29306&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01273,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3db6b5ee4daeb3747abef5998ae0ec1def30f96ff98043bc40dfce86966fde81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01274,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63adf378c2182a75a6bbec3cba265ead7a1d31cfc37324a5cfbd44e70d3e2392&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01275,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0c89bb3e1a35dd2748bec8ed667b9345d50726cff25f170637c86382abd82135&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01276,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x399bff6479203b0d07b9409e2adbe174c602acc5f4c2368b4fb399dae9227b5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01277,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b14df373ee827661a2c07e3796b21ae8879dbb62ee89588bb43e2843c70b624&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01278,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7bb5b29535784cb002cef2e3e34d518d7baa14aa2242dd3cdfd9e6e2801faadb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01279,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ba003f31b565407c69e13af897dd4acc225a71ca04599415f68ee839e34d799&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01280,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ab6865f17d91c52d0fe177d6b465575f83380ecd7d8c7f9bf31b2377ca0a1f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01281,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa55982471099400711214ced393e9909d0e04c35e862b6319ada8e63fe9c5457&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01282,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8357bfd95a67b8e01b0530b10daa926d6368de1f37ebb787a24893a1813d61b3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01283,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb502eea2d534a1d9646b8cdf01a0021a2fac7b298ae298adfcb18a8adb51bf09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01284,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9cc24977a6a162a4f21fea4c588d8586d5cb96298a95364e3cb1b50f1878fd0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01285,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ad4fdc89fbf4b2817a64648f37a14ec2908b58b24a621a12f941d7e3d4e6a66&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01286,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4de64a70d6df12d28fcaa8d4fed874f5aab3f070552189ce5e24582539c9f875&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01287,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1cd8e301efbf3554bee4a3699272b01033f3a1087a8ea789132a07e1d08bd20f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01288,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x461721aa1fba0486391f01c6b60ec368e021573fcef4c62a0d91204470a732b5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01289,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd776cb85c9b392f75696d6bb5733b4aac5f1e83a73719620efaf40a385468200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01290,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x873eb969707feb65aa18bb94c3bd32f40fd891708a0977ede54d80ebab7e17a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01291,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3466a3703a10207162520e73c9350cc646eec8158a0f5913345e0232ec37fd44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01292,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7c7ef3af85eb27ace55a2b8174ed8d5616f3d6d8457c51678f8c5ce5ff6df2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01293,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeab36fbdb3f08b469d02903085a59c455c1f8693e76b7005832a872fc19bfc3d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01294,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd38b96b71d18f88b5eee096a8affaeae086170fa9636dbd6d81b7f0bf03d34da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01295,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a8e547ac87505373cd0a850b2dbcf87fd17a958e86b91f431dfacf8faa1cf9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01296,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x044263f35cee7bbd103e6537a34ef16fa8075121c6b2ac6cb9ccc932de47261d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01297,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a6fa8404ebef74fb534dd65a52008d9c451c8e133a111118c38b238963d8c60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01298,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x25e8cecf4a4009a8a3dfcb6e414a52939dd8f0fec0cdfa43fbb88f6d93e84d90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01299,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4783a5b474945636c48b35187b5236790a932a6688eb9d57663cedbfcc35e96b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01300,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05128f5669874610a201918ac659f325cadd39c596246a946c95c17899f4525c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01301,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8ad3107c0c201f6c9c855fa7fe31ace8ea37cf483e4466de7ee0cd8d4a1961e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01302,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x564f335c0b20dae960b81c7fa6715da2a7a1f32186ee0d0fe6fc162f36a3630d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01303,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dd93fff7d2ebb6031ca921ae529ff7f0fa881b0b64d0fde89b532250afcb3ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01304,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x20eaa74f7d74b90dd75bf7750d80ce428e75745d60b92500549b4039163e674f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01305,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd00fc022fe14cd175a8a593bd0fc6cf8076872c16fc3672313415760c659de09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01306,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f67a41c83d8ba9d5206bd10389cc97b98c2b2b50d46c845728f67421c9a8b7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01307,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f77e7c868bfd36ad2e2b0864b665ab2ecd6671d8be22c1738d3c01376d0b34a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01308,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8eaf029a66086147ba2206ecdbea385029fa3ea27ae9d93be466ef702f9ef909&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01309,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0e9134c94db5ca1f3f8df20c06242afcbc7c099282c1b5662b7528344fd49f83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01310,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x36d0712a3ad4551da02c8fbcf6ffb7fc9105d8b651095af88f9168884fec0ae8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01311,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb196f52df231958730a92a4cf0468e2648750cb5665142e160d881bc14e37bfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01312,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x052a3539fc9f8bc4d117b49c1e06b3c2f6ff129297b39d25174c8f0b8144001a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01313,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xed3d98e8ee4b3ac94e1bf4f158c783a8415ba5f497f9e33a32f1800d60cc524c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01314,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6711d975c455a06ffe37404f2c044b0212d05580535f0b696e01c40a38ed2e15&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01315,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc90257ccd4b09a7a0b1cfafa86eae19b648f0f9ff4d5f9d935b45179c45679d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01316,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd23ae50b11a0b68e4233b0743b3ba73f087d2e8d9e73f74c100faec8838bf4b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01317,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb2c5b1b5c44801e3d93702395326af0a9e333f6faa72ec9836bc0c6da90af82c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01318,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x803d224bcaa3b2d5d0ba2de2837b8b808215de356282c671fd92e94b4970bd37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01319,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf7082c225833a231427c3a2809a4f77fd79ddf88a94991e251336feba0eeeb89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01320,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66c7f0046df871f8a674e08f13d66ace77969519f44ad0eedf44bee0a543036f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01321,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x04af06fa9d5d1b4d162b96a9e979d61028b349d2c474a34d16d0c62761252504&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01322,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44c4c046785d0a1596bfa34133b74b47e16a4eea6607b7633d84e90ed816d4b4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01323,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x570d0caa96bbae3e4b2afc7f01b62f3d90fe232cb3797cfe54b52c3840bba0be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01324,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd4cb7a0d9740bace6d20e145e01f654c3388393fbc655b41d8693de6bb960506&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01325,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb10b22ec3ae6d7252bd04d9bd6f2aeb5759cd1c33df99d43230b5dc2812fb5cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01326,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xea52129a4b82c6183fc1713117ed5d1803135642c2544612dbdaa6fd06be1b25&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01327,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f88b08507b8fb608565635faa36f8b09902017b2dfefd8091b05cc698e072a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01328,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x83f1204e20b3770edb57289e7f64401d79365d0c0e02a84c9c2c33ffdc496693&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01329,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x572dcecfe36d6a5159f90810209186d900bd940b27e56a8d1150aa4760e5b99b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01330,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45db98fb860512b9cbfce82e225581bc15103e772c385102f63aecc98b3053ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01331,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x79ac113e80705dc36acef32fd3d844dcda82fde0962d92da38a07e585edfaf40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01332,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e02ff938a46434155167db8bc7aab30bb1380b9e3e7a61605bb4b98312305be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01333,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c8da535daab62298766c9eedb38110eeafe1d6c2fc0a6fe344486e50d23d57e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01334,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9983596d69c4ca9358001d6e1569a17f8c35a885ba9dc1629aca595c0475af7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01335,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4143f16c56cdd171e39f8a54a3bb2d2dea69490672df9fa7e30378def8867730&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01336,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2c80acab236f71b43e253b5268c172dc3f413cf145e0216d7f6c13065422a2bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01337,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x70afebf06271380039afba9d7b5157f905d89598d03042f4bf4cc827f1d7b200&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01338,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d957f43c8483a069456ccdf1c44cfbb355796198e5b35eb365d66189c934b07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01339,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa954d4bbfb037a0e8f081be2b609544df79fc5f84f346fe687c83055e86b785f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01340,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd259e3dbd24e5d08dbc1cf127159be9095f93cb2e035fc12cd4dd9df06ce4d91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01341,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa393c46b554c380371d5f395f99c878959168fb83b010ee586dd627ea5ac81f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01342,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfebdbdcdc98e1286f41f504e2457d4b9ad17d1747bfd60a3b16fba723620efda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01343,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc205cffc694cd333edf5deb8023b04a96ae6563e1de4acb4d93f34ce095a50aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01344,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe55d1bc51b81c62134e654fd69d9c13dc329454cef1328f1579d034178625187&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01345,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18129517d6e589a3e497f93dbad3e63b013dae40ec88ef3e1f3910b655442848&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01346,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62600923c76a890ebe7b693e545c5f316a329cc622325ff9159159322ba772f7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01347,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7bc048ba653fbc6fa6590215174988a56bd0615952242f026700ae0ed9e44d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01348,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63f08fbe35edc8666cd54f8b313029ccc744b622842266a11085320771a781f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01349,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd8f90a763e74c5cbcc2f745cd41dfc34742eb9d91665d71b201e8f8d4cdde52a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01350,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3b7ca4efb889b761f25df46f30cb916074f5f80e5bfb4a500896747da243b54a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01351,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5aeba3be9d1c93c5d8cf0ec419893fc0d2fd193cc9d60b52d2fd7abe6cf4820&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01352,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x75faba094a42b7e78000daf1ed774e8ed6ecf34bd142470238d1d16741003ae4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01353,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x53743d70a74f3b85815f71200d6c3c044df0ffc75fe8dc56a8f9a3ad106d880c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01354,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdcc29cd5c2804269d16f68f212fa4318cd10f686761ba1e012a2bea667d8ed2b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01355,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x73301488b070bb8268c358f07b89b07cb19d2ec612edbd30c10c7c83349f0439&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01356,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5358154fa2c30230dcb62a3ae16f03ddd07e3fb9ecb53b0813ba432aeaa6743&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01357,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ae35c6d816695c2e73892ddb5fa55282a108796ddfc1059a60d14ee87ed06ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01358,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40401985fc52c0c38cc1951a0079728513e34711517fb89e8c8893f889f834a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01359,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4f6b265815c3a8d1595aeb9e2039c9c73e06a69e746d06d3e4adbd09ade7ddfa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01360,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0b1559c6907e19eec7b32ccf02f63bfe932f3ec95d28de33250f0e2929b18dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01361,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef5b459d7ac7c2743f4c0fe6adee0d06a89971dcfb7d959f087b7b57f12c5d1e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01362,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x08dfe9e3cf1e444d51c5a61d42a03d90f974513c237d2f9684995f399ce35d56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01363,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80f7dfd0b5347cde3ebd66b78dcb3cf55cfcdbbc019c75e2f69bf9f97e393263&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01364,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b47710e8532de589c562f34bfa75a8333a26937ba10f86d7327afcbf0514cfb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01365,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc79e6c613537fdc17caef5f69d705741d3ea81e4bb6d277304d243aaae7f3c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01366,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd76553f60e2e468719e30bd8cbfb967a00cf6841fc520c86d0aaf400db5defc5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01367,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7efc68f4fdd73317255edf40a2be339ce739e5f0911f447511c763a494160b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01368,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17ea70afa701eca1af56e1a15f3d1604a3fa7f9f32e8a60b52d41708d15d8020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01369,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf4a498dff013a59d243cfc41a176d2e7584d686d4ae44f6dfdde575d88529fe3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01370,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x027e2a2d5bbcb6fd1867eebf440e44ac1f7ded4acd265d97ab1db0e5a1169cfb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01371,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb90ef17e2d9981a11ef0cd0a735c7116d9a233a825903096e2cb07ea8597ef0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01372,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb47194832a5dc01344496c495b28e1d202ee22841c8ffa1857d05ce0944424cb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01373,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb999269e83d06f6df620c6f5f94964f5a643fbb64dd2c4d7f58eed88798cbd6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01374,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x662f1591b37f2982f426f3003ed9147f96014bb12963e49e63ad1b55e2cd78dc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01375,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x108ccbefa9906c080c5115f77f9ecd63381b9ffb0930227cb2630f4b08d8a090&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01376,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54d2962953fce8d8a641bb8cd1c9eaafe89f9ac9546b8b277d9b535fb35a0097&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01377,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d7bcae503db8d3f3771cf9e8038a1fdf3987beb6212755704560a0404118063&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01378,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfd477f0bf18d87a2bd3ae3c329e468a7bb16a363ec3fbf658f55ecb98fc16d17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01379,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57b72b9a11da9b25c2bb52b648db7870e039a64439fd271fa320bd2fe789775b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01380,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbeacd779ff788ab12f79382ea205b1b180c7e43302e902c32fa577c0925144ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01381,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4b6c00275a131aa994d1e86e9246196299930ad5fc218d09d0b66265234e32c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01382,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x485b0ed3728e693a618ca77659c55114a8f602ccd71fa6138e87e11b49814289&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01383,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x402cc664b8b4b8dcac9aeba636f3c902a713874d9fc6bd6c7dc338817c1eac76&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01384,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x547da0f4446ebbba63eba970ec761c7a08451eb11251c91cd6427cdf475bf00c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01385,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x058c55b0a6a077ed8882d135e4cb364b250d392eba6ad4e578fe910c8c9f340d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01386,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x951ddf6cc9c8cae358c63a8a8b5037a970cc5a3e9ad55fca7e4c85bf86c935a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01387,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85a7797dd4dae08cae7218cc8c2497b580ad037427bf7e351f20f1edfd695d57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01388,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64376e672282c2691f4dd0a88ccdb12d561cd88612d689f2802744490e275e10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01389,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58445b6bcd79648c107c45ccfa2c2246b0bffbfc0c9c8750b934894144105f87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01390,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6a2d6ce478b520818b85e08d1beb56fb4d6d656aef8f26020cc9a1781a4cd96d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01391,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x330e88ac3fd46d3b66946b2bd2e342e0906769ba42be06f01ed224dc7ae90640&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01392,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3bf42cf0cd0e8199fffa9b453dea46a65409ec5430638e189e8f60132fbd19b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01393,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x239fa3d0c11c26d29efac03c04735050e83c55686975a8753bbbc83349316a48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01394,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x76707dbf2c1a10e6f1aaa37be9374185d3eaa2253594e5ff3482e436841e6b50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01395,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4bcaea6c1d0723bab48d33acf6e6bcbb6016c405f710f19e8542290568510ec4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01396,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc5b5c9a71d2e0b16153477cdb827aaf6feb3f0758218dccddebcf0e0f0bfb1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01397,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xce3fa54e8a5338bf4a395b0d522e35d60b473c9f8507d6def5dd7da739aa5317&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01398,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd06c9a048e07da77ad07dfd45f48cdcab8eac2cd6ab44fe9db7778498d1200ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01399,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe131599e0fa8cb136a8425b02becb4d42888bde686d9d88b6248216a583dbc87&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01400,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a628757bb1610b0c239ae56df58324c7cf5b5f3f18bbccea4dd67b1ff9be9a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01401,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe7d4a88015acd605be12a616c899590059d306c69aff9a1876d47c276ea96231&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01402,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x85d3f3038ba81ba3c5c5a86cec0e55ecd3865f4bcb2e7bd9fb8390e06278ea2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01403,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe1e41aa6c6d1cc5313c8f2a0ba5c50098c30f49b4a8ba5ea8d89e334be0ffd96&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01404,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeba27a233d1a0b76360d1ec6793544482a197f01a47d29474b64982d043c9807&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01405,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb0ddf49dcc80359d5bbbd56b5a1e53a8fa78fbb3563c806f1a8a91b51cc8d082&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01406,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x651ac24a55b66ed30dc6b260af6a9b6aff2c1e0e8433534a353d2b9463d650ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01407,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa76ac2e092a5e5db97ef6af6656dff4aa47fbf036bfb5ca2dea8fe0dea9635e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01408,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x209624ba6ce8936b8a37223a76d35394b8a3e1c55f0e23dadd60da82e867fc81&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01409,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf729a25d80ddd3c0688e76207ff9ee0ef4960a696061fc1e32c39e69b40289a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01410,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa53b25ca9678e87be1fcef929c93d97ac456308f8405be0910fc8e917f264042&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01411,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00cba9ae4ebb3a6e3876f16c22db9914e07a4a175b582fdeefbb60001dae465d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01412,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xda3d50bfc90ee547701ab1777f4cc626aae0183fe5d1f42df31048ea85c2a626&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01413,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfe77f727e1f01d1287955db0e75a11f8f1077ebe78a7c96ecaf808e22009fa9e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01414,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1053d23c71dc7e09a2250926009b353ea3f44a599953e347de0fd8347d677762&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01415,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f9ee40833afefffc10bd0f240252f1fc70ebd6bd9fe7894816a369f78f40940&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01416,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x162769df545470c247d848320910bb169a9c95859e676d531bcae4ff4eaac292&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01417,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6904f50508e80bc3f8fd40550fb06c98df9da1f1fce47c95e81e47a030917002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01418,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x668379548128b70fe1b31b174c6daa8a0915557d1769beb2bcfab9f95884baaa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01419,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x55bb8c9a8b55e224e139cd6f93893700ac261f27a2eab8f2d493d734366d1749&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01420,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37cb2c92be70871a49bcea2f3d90a6215a72609ef728c8e46922cbd6737c2c86&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01421,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05b6cf1bb6f912a9a46dd729ba1ea392e517ad277bb69b758dc88ffb08313288&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01422,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf2496163a204528e56831eb7cad31b71b85aee9c8d584270c9728154e6a0bd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01423,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8500cec01a3af6600559bd3f68e2607eeacf62fc773fe4ea467c0592c9cf650f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01424,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf9b23ca9378f773d6ce3ab66eee7f70e84b52cb82be13876d2cb7073dfc765c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01425,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2e9e77d2e086db1a3b04a73d17cc79247012b93c4aead1462d688857c983b16c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01426,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c07100577d5a565f3962df52798a8e7c74eded7237c57b6287308e30693fc31&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01427,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x53b8caf6ce7524bd3161dabdee75a7948cb6813045b9422f0243b91d1a8046d5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01428,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68be6c9f0b492c78b2598baf1e5a8d8c45a7738d41afd795fc57a6b9e5acf34c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01429,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x12a34f393f9f0f3e7630b128ba992bcb8bd211f817a4e14869d78cf465aebfcc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01430,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff0a7be97f4019b220ec1afd81839cc10dc9c9d897a7131fc805393f82f998e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01431,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64d4fc5bc06327b48928cfcfa93581a8f840c950551365ab35029583fed9b421&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01432,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2205cdfc0fa6fd60df16cad0281d1321bb0727e0d9dda4e5695a415f8b0d25bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01433,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe4ccf7437255286798c6e3c8181f1d4981ea17ba6560bd9e25a86a4a558ec60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01434,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7720205861646892f7d4f654cbfb82e1efed9fa75fa779614a2d7f71a6a3546d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01435,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x467addf009150a231cbf58b439c8ee6859807d2cc444b5391288e84b73437e78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01436,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8bd916a854e374573059266dd6eccc83a260c544a246cd8df022c12864d00a4a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01437,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x332b343d821178fd9f67670662e7d60926135fbc724ac83e15f76ac77fada151&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01438,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x595d9cbeefcaf6ef0d0ca2e5b5e221777f7fb99a07f07f398759960a16ffedc4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01439,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaed3cc6afce54a6dd6c0b6a68532d860d99ad64abb3550594166f2a5d1086b58&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01440,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41f0520f9167d87677b563d4652b1929a1cc45d49f59803bf30d288a1be2b06d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01441,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe2a38fbc4c762ce28ad95fcd0b38b461fc43cf005e1c0efaa1a95e8b08496fd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01442,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef37dd9b1d91abce595f8e07f4b8200ff75af7d59811d7c222ddd0dcd5657b8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01443,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x145a661e91fd5f7e7004a06124642067355ac94d3812c17dd7e28ab63e2b3bef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01444,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9821beb8f5dcea100a98816920637fc5644bb4aae4d43e14056546177db2d2ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01445,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x728597bdf315ebb1b2ab95a2cc6bf7b4b4740e6e6cb73be78c0827c9791d614b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01446,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5ad80991f59ab3c3f5d9e4b0a64a0d1622a6f7201e6b4c9ab17425ef0e9c6328&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01447,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6b884caccbb53424351a0707fd38ec1780332432704f637261d061ce81669fb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01448,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x869cb3c70c4fbab00ea39f9b8954bd0efc32ff9386d347d7731b482ea2fa1035&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01449,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5cac1bcb33f6344780d0ae7effa537b4597e788655c7f0ca76f6427ee6951593&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01450,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb92784114f94f68de5bc7ea7ff301e8123ad1ae21211d9fb843a809198f34732&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01451,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x32f5e0e5826dcafa56e2102e122b65f91f47edbe4fd164774c5db7b3163d749f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01452,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb43138d20c9f3a4ad12f1c6a14975528e934c45e0821fbbf924bd0e97c7ce091&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01453,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34bcded8fb20b97fb638a8f0b0b88da53ee9e9ab8e31c2ffcecd7cd172532e20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01454,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x11f80fd32648f792ece5e55a241f473f2733f6b2801df8be9679896d18947871&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01455,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18ea77d047b2a9fb5aabac87543ec56952c28aac11ecee3af95a4aa559bfed49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01456,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf1aadb7cf016bd145d3abaaf1a285545e331a9878f8291692df22fa7ceb34ec6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01457,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd00e9e6ffbb61a46cb574900034b3ee2e8ab614b1182d29fb228603016385094&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01458,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7ffab11d609947e556ac0f0aa0e92c8d1b7daae7c691e159e31bc2de3090e2d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01459,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6039b280fddd6ba4e398335bf0fabb83cd421c12d6a18f18b9f60249e3456e65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01460,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8e889e14bc66328b31238cec0e5ca5de362bf8d995519de91c4c14a4f6dfd6db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01461,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x773c0e114f7bb0a7cdca0a604b930a3c77b35d4033a7eebaa8d380121a2441f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01462,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf1babfea1ab0a8d9ae94988ffd97916576340ee9f76a697b4d783074a15cba8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01463,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6d328022fe6152777777c85775f267864398abdd880baa956659469fee4c22ec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01464,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c7eb43c12aa64d6dbebe5f9946254cb7d4960e919112034b25cd78ba4c7fbf4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01465,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x10ffef9e33b607326adbb5aabb35e832952a99fca4662af142510332b9033a16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01466,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7785bbd4cc92a53101de632d4335e09d7e3a7f8b8a2e5263d884c2e02f3541df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01467,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb09a9b8e7e62a4ec64bef12e9b6467b0f7276db516b270cfee9b8f30b59e9349&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01468,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1919baf88fb35ea864c6e86c74db4a93ba81d8c573d53716fe6cb56804bb4c8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01469,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6338bf7f5a36a7559ab4b7abf0b3882c81aa369425bcf4718ac690d237d6e53d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01470,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x46fb7a9b26b5de93dfe8027aef0949cc8f81c523fcf3e578e6ac296acd396296&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01471,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x18fb7c8f934ec0bd79726a6dbcf9b1949eae47eb8e8a59fc60821d374e5cad5b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01472,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x47a32b9d02c3f8fe8780885803d922d76e5ba346335f99c8b46bff9d33530a57&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01473,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x333b7e8665b4aa205cc4136efce2add43fb3803b43a7f33e9386790b0846dab2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01474,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfe24e3c1483ac948bb8e3ec3ace550f72726f2025abaf97dbee5997a2d7798f0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01475,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81c78370e6f8e1054f5492a086f354fdbbdee13fc5eb433d5b70f6bde808feea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01476,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x857187a16d206dcf5ab6d0f375defe4689f638952e7be7e214a18ef95f612588&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01477,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xad00e0b4f49ca226ba794de114b83f21049c9678d956ecd0a9456509a4d33b65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01478,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8994eaa1d20c7865333115069f8f9b5d500b0ac5b77759a7938c4a9817e8a864&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01479,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcf4abf0e245ee8096e0a34974636acedc772135d2f99a493e78e84171c30d4fe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01480,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xae5f5367ea0f5fcae4b0cb50813b16611d4348211979e922c039849237dc7e0b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01481,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa121c10e9e5b9ebfd54ddf768c22b1f9a0d99b1d002f0c14133b9069271a577d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01482,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2110d171195a2de44d08df4b38a9ec39242e74e177a9a330137d2cfad24f0e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01483,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56ec2844150d5baf181784999e0f12eedab61b6d106be33e2e5f4ae7cd9923c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01484,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba8ad4f1b96b86c81781dcd63aea4d8c817762f8950ad31b7b516ec86dbf9c56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01485,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc56c3ef61383b31fe0426d4e7e6101b3ee93e36f8743513d6f2827f6dc7443e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01486,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x57bc41042e73f44a9ffe5ad0ef0ed6a750b254d6174182d31210ec154bd5a6a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01487,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x122d8e0fb38045e75447d5d4b098ded50d3519ab133f407f16ce80b7811f59f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01488,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x42b25fd38e95b67a02cf2d2420f3baf74baf05cd3daa21c7d8422dd4ef082073&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01489,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb1acea4e751f8ab84a1701a3810b7425d7bd25b9a11191b8439d9ef021a0ae99&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01490,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34280f11add3d4fbc26f35a2bc3163e20bd68b0b2c5f5c977b3c5515f7f89c78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01491,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x503bfdfdf60af3f68c00940ce18790b5a4b27708860b9397c247b65ea306f9ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01492,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b74997d1c74b3925d68bfb59f89532c82f8d40442462a20b8f8a247223217ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01493,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xedfb26fba9e0f118447e4f1a2f427cbfe9b42bf74c74c8c347718c2bb25de638&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01494,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xda405d1305cbe42530cf2a03f23706e2c2f0d5c4a8e3fe402026ac7cb9e00c7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01495,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3efe0cdadae9231c400665a65dee22fccf36020f991fbc5fc80a692a15e04100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01496,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x809b00b05e0da5745ec980caa06cd88004cd61873bee830f9da8d9cee061c0ce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01497,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc6923521f989fdf033fef5f95561230bf2bc872c3be7088a3a0986f40417cbc2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01498,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2ef9dbc94aeec86917f3545afcf139cb1092ae35566cb03667d71fa7b4a413e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01499,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x23a65ef9fa71a5631cb9be2f1108a6ae5a52fd9123102d43b167267c5c0b6d86&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01500,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17e97c499981088f01ee7fd4110bc4e39552c70c535b2c01bfb825288c652cd1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01501,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x38815f395760557cb4ceaf43f9bd59d7f3ae3438d98e2e8e89a1a985d77def48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01502,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc31ef6bf0361e3147b5cfa201a4296245cb801a4933e6e3c7c4040789fe39ebc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01503,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc5393ba2406bc0b84edc863f36c63116e6f3ce5b3af9063cda7516ed664feddf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01504,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb478f53b462aecc80018fc12f270409c9c21616d076a98f26dbb6bc76171fc03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01505,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8013f87cc39daaafdcd88f6338920b22c471bf7d7b589963a6ada06bfaea470&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01506,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf23ee99501bb670f523caf0761c956324dc590fed811bc4f6471b6c458805e5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01507,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x21b534cf9c9af1ea839aad996558e17bf8698d1c0b6d1ccdb858fb19bf78fdc9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01508,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9fbff7e7dce3188b5c5503deaa65b47c43c304c52f3f1f4fa5e8221759c75330&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01509,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe5141a21f39698a7b78ffce400c185d65fc6145c08b97e5630b16fef5cfea317&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01510,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x87aec91b6b6a9b92dba7163b403a463f001693df580b79d1b630413de7c62540&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01511,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb041bb19cce32e94aba5ab72f8b325fe14088e933331cb81c090dd64628e3276&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01512,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe41b5ac2f66221e3e7486d2513c67051afc5530af04715e37c144c198240eb5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01513,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56a669268cf40b4111afe73a823da07e8a09f6304f8ab890b4645d2dfd7cbb24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01514,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x898d4f37bcd23ab1762aec11fd937e9b9843e74b3aa9c0b4ed5645b03fcbaf98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01515,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x935b5d7aeec407a6cd83f7d0dc160edc53cc8b7f5f2e019c05fe619226a5b67a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01516,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ad5c3e371e953f644173a234e019d8e14993f21100068a439bc901b164b0713&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01517,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe94d5d09346e617ac54ff3494a7923b43d7ea91d61fdfa4a1185af83e73fee0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01518,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x40fa62d3a1d198625a85eb1afaea58c9644194914293db1246869aa4b7fcf547&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01519,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x110e8af3acb590972a4f633434221317d3ac98b9fba73452c02e9a88e9de32f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01520,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6e412e20bae396e80928f28ec0179a1be7765947bd7e4765fe3b20524f60f2ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01521,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8ffe28ad29fdd6e42ccae7faf81b1715fd4df21451ddeb305a3eead7a514a17c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01522,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe93cd0a078a29332cbd05e1570a988ad748db4a2b2f2dbc2c6bbab0bd3c8302b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01523,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77f19add028523159fac380f499a2193f29ffde2ae2eb043719b798e272d2b3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01524,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf583c72783c0c5b90ab3a01c84eaf9ef04620259b4c1ccf074c9e74a22c98460&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01525,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x326bed4654c8a2f1bf96d345ef7ac8eb3868861e561603b5dc50c8f623cf6333&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01526,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x558f5bae98e6ad2e383096f2c381c126bdccfaa0c90cbbffb7480426f5803396&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01527,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17af0f4e322b322401ff5f1c360a93aa4c14babc71203e78a3f9df4cf56f8f02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01528,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb3d28e9ba92278e4be3110b7813b95e05243fb026f3442e6961e686576399e5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01529,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ce3df5c684e6d291db88d672af9848f1c597d58ad4aeb154d7d812d69878e22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01530,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x70b295e43e231b6edfb2ba45b14964ca609d06e596f65438c816a8919a141d38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01531,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5694754d0ac3a99b57cfa34aa9a6f37d7749675127deb9dd45d920a767104724&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01532,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb7d62fb8035796a876d44ec6b484ecafb225782c12885d4cbd8768bfcc8648c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01533,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c4ea22b6b5b40c697b2048c59cec06701c032ef4fc245402d68ab614ef4749f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01534,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f50bd7f0574c667cf8d6e4d96e8375e845f1bb58b5458a96fa4f13400978139&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01535,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56e96bf3a208e13326e3ae64501a9f8aa2a2306551a22729f4cdc632a316dc37&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01536,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c0b5a25c4a9f692cb2d1d97cc2ed3a9c6be0263543702df9cfa818e67792ad1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01537,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb84376f6b504ac6eee8eb390c9431dce6d21ba91bf66860488b267e140503df9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01538,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa859e797a3880fcd290e20193e80d4cd6aac09cbe285520972863a0496ba9e5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01539,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb8f7332814753428b30912ab8eca0e635d4060a7ef66fecc91b9963f0d2a9b5b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01540,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5075b4c47e8e56e7f17022c6c00170a30cdd7cf257d893dd917b6ae8725ef044&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01541,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9a68897ad38b7a6b7948e66b75312956c32f2d8e2b27fdf3df27bb1e523587c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01542,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c44c323f56a00e42c55f8e08134019f4cfa635e945aab057be327146e41b193&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01543,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba0d8406b4b7bdb1f2a3c8bf6cc79c49d1a1ecb99e9a289ac2febb3f062a31db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01544,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb730d9fb4712957266c8134e8ad45e064e9dde91be74a4bdba289dd2c1cd3b7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01545,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a36dd0adc9b0a8ed517b92ef73ee18072f2ad87d992eac9b163ed13701c2d40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01546,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcb6390d20de04adf9ca127b68f73fbbdde1ae451d3d5dd2e9deebed712c49122&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01547,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7be294479d6f126c3da2e73d6ae008ba912d377135e43eefcc6ca65e4e2d9770&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01548,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd42b2e596c43feb99b1a292cb65108e4d159699ce5399331ceedd101b37e8aa3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01549,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3259acc6ebca1ee7695b4748c89145bfb0962571f616b5e2da44ac571746369f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01550,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x15c4efe66e352107540d4c8ce5d800c117a599da83ad34388cd17510682942bf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01551,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d99a1dc1815eff9f0d697fb3c79a078645b573ad228ebe569384ec8f747fc98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01552,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccd34c1ecb8f3444c21ad2f645b5909fe2c44e9f282706205f45c102d68bd3b8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01553,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f3371da1271d47e61ed8a04772fd68751b8c7ef16c316b8f4b1491449354a47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01554,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6acbe79cf6301c23a1202198de9abad6c1cf67718f48928176459a2e195839a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01555,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x975db585f0f663c6e62d41199c823b48e1be2f596effa9c56222d3b7fdd48d40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01556,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf8d968d981abe306802686c870f2d6071547604228bc7c8a9e26600cc13fc18f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01557,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5250d82f1f9476a10e99a6b6c8d4664c52d206286eb62e544c4d93b6c8141608&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01558,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8817dc1dc6343f42591204b1036b8e8b9ac90aa6be40647b3c13fc48256b865f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01559,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x16cbfdacbf89ab417c81734171a541d1ebf55b17e4d62474a9883f9aa3b9d992&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01560,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbaf55ad5cf0f88bfa5be589394b6a7ae0907116fdee9b447b4110ad76356049&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01561,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa12fc593dbc327d7a61fa0e695f2e6bbd10b70ae3dd87d32802487380d67334e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01562,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x310c6496b06f98c1553f27b9ef878db3e6b540a4008fb4de7d65cbb7b431f324&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01563,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5345e3d4fb9fb5cfc1e3ab07b7963c5185b3758583fce54826b59c8f59fc2bb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01564,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2280e4c1f8c9444f8a85a63a744b4d9cdaaaeec6c27a100b704c36ba1b27607a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01565,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x893942f1ae02af922386a011d94aea458b000e6ae58ac5105469f15ef5ccb00b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01566,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x237ef759964133b24b7d50fb860d3ef49f5b5473a5dfbb4deb12a9ee75e9d3c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01567,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aec3b6ed606a370df07ff07933d708e4b30892c5b34eb27a3c179089ff70c24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01568,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc92fcf640f5c001fe4c37de77755ff442f5753d9500aba5636cad6cef432cba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01569,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeacd9d2bc6090407814082b59e363afa47cb9148ffa584c065136e11c62413e9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01570,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa22bf28892d91ec239139c3c7bb07a32887d7d42f9a097ee919e8f1333abe8be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01571,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1a439d0701e901619bf55f220dd81ad945b75883f0832eb9d1ffad360225825f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01572,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x947ddced110265caee947bc7d343bafd17bafff910a68db5bcc0f46f0aee6fc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01573,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a831bed82ec33cfb63e2489ca28d1dabcab3326a310e117ed3ff4d91893ad5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01574,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9028d18bb6a6f17c7d25c2c76c6faf7a9df0913107ee429b1cfa9e865cf3118a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01575,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x598f030e236f72cf6eff6d43fb7f974f911b9fc603980b37f15614ec3cd779c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01576,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf904329742dc4ffc14c96a9917c54d18a6fde0cb98c47d211e7f7ffb83956ae4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01577,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a587dfcf7eaa992e28ff6c3504df916cd4e01fe66fd293129ae957fb4426425&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01578,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x43c1dcc3d038599b653d4863c7c9bb7cad97e7b7961695e8956e9bd42f2dc0b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01579,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92a983f23849ce276e11172312cf40a7aee0e9bd34c92f66f95a2b55ea9f3cba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01580,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1c243107c6f0b4ef1b64cb91a8d1abe0dff736faf40a28e01448477799d7223b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01581,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1f943824eeb9f6e597dd06662f22d72c259fe15ca30f79f85108fce6f9465c80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01582,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde1cad895c807ccbc04c98614864decb0b4f438b79772508210e542de31a80d6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01583,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d72b6e45e90548bead586dbbe36d30832196b923fc15981b7a75b4635835cad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01584,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x393498cdb070387b507967acb20ca81ac651fc0112e6f8bf4275a998e87be113&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01585,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa098e6dd3f968cc805e7e32e67beb12ee8d5791c9ad3f4c4f97d8090c5d7532&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01586,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x379cb7fe8047796010944629cbaa6009c131882ada4df80b344f674a209a02ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01587,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62641130ea31f0236a9a003332e891538e45fa7190e93f9af17f15fdaa0f73e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01588,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x63224c34401bb9cfd504b6527d4005cbe3d274af04571902b23f4623b177a276&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01589,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa972b2e4d5472258ad38813f7ab77a0daac4a0796875b562a65a989c1cb57dfb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01590,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1370376c417b6f988efc6de15723eb81354087bb24b5be9affdd536f7eb5e878&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01591,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3c5940a5c4b1ced8cfba620ef392e3bcaea154dd3ec56371ebb50f7d3955488b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01592,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfdcf0f058fd21fd4db98eec51153f4bc489fb41e08c1a8dbf8f1d7f3ffe01a0e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01593,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7779354bd2845311c515a0f22e8f032d09e69f3d10a14a013152ae46000edfd5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01594,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfc12f95bb18ce0bce9db6efa93b555b6108fc6f3241d56a25a2c07d8e18d4e6d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01595,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2118c3d09fa86752bd92dd89053b9afb26337edcf84098361d149f3d9a8eb9d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01596,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf94bdd17711158be2e5aba2f31d933bca8e1d608a0aaee8d611255e5822072bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01597,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaeb7c436d1407307f9daa397e49a35bb39d2b7612dcf4a40639643fdd06185cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01598,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf56b793b792ea72e3e3f8c92ac085de3c0b6e2a04a11486599b92a86c6abd4f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01599,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6cf982a28fdaf8ff3086f2ab622848b9a1cc92e347202b0c3b5bc8da8669ad9a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01600,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc6a9ee35cb2a1e7ace08025884a30c605db736d1b026cbca495b623cef531c78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01601,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0497bfd92c28ce3e12442ae4bafb6b8bb950448933fbfa5faf307a908385990b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01602,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a50fff5ebacea0ef3d7d163034333d6c0c133718fae765896cc19513d0e3ed1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01603,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa1d88a2633e02e2c4e08d94c97fd1b76d7003800f78dc3323f9bcc5af6d00bb2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01604,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x00e0c17d808088777af62a97fe1e63d0a1ea1433c5368c5e7427bde3e7677589&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01605,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8fec155e0c69236d83d2c7039e0e904d800eba28c739bad9bfc5b4c3e616b1a5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01606,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7642a7d34a91eb38072e60a0b44d304de3f84d42928c44891b8768a2255696de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01607,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0a337fdbd42c275522b604f3cf7eebe86a7876ba0e93ad89fc725fa37bffa4b1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01608,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b8f0227d5c0605529146c4b66cefdef9fded753b2f496b5d2232de3f0f0ff0d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01609,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xceafb20105e86dad0aea7a8cd971d4960c6e675d677a4ff5b467c57072e1c324&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01610,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x99fdde4b6905f88a904c45a0fae519384c35cbf770ac691cc2f972bc91c9e92a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01611,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d642ed657bd7c7bad338118f728552422e9d918fc5a6d45b276be73ee489fb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01612,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01a109f9c1765421c41b740a0beeada7ec1527a116e075768051a865688abc4a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01613,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x409c216ecee281bfa9d2292d1483c07a83af57ede1d306c3ef1357e6207bbc38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01614,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x608abfc5fdaed326966359b7494e26fad1a0897d36404404cdd1e9d760a2cc63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01615,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x546296f9bdd48f7a10748c5685047652d24ee0f5d9d5d39d00c138b5b72963a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01616,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x210f4a03fc1ad41169c1a2110e9881cb518e3a91920784a93790ec49b14ca899&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01617,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf300016daf617180a864891d6e395a1d693586922d87b42012be8d01f21a08c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01618,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd126355b8481e0ce290bcd7d8e59ea88d84464af126c0711c4aace2295d81ec6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01619,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfccf39eec398431f05ecebc058d0f7451b0601e47c8a32403f430fee1fa91b4b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01620,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x62719ac2f5906f11574a39f6235b3d12052d2df36855880901e99ab7dc7671da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01621,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd410e2d782f4489c884bfca0410d81ec6376b2558e2fdaa4329d57739155b4e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01622,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3a2643d146858acc75041baf09f47c0f2d25d4f102c12fc7d3db22f670be350f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01623,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb86b68f188d4f0d56f35bd8df010b9154c282c78ea9604ef6e94084e9c851b8d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01624,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x79abcea66a1e7adfb03c8c047ccc1823881335a68f7221a13f057b9b812fa6eb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01625,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9d2445ad11ecdc91945bf0507eb97181e1a8d7373c3f68b0760959a45a32fd05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01626,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa0719f0293eda9efab5b6cd4fbe9be45f707761d77e089ab27c965058eed2737&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01627,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3825eb62719002200fd1b8ece3f1fdcf80705657d68e418366eeae57b14acfbd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01628,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49d1a71da4a7a27348aefd008cc5227b28544ee604eb242e1c2b037f67c3abdb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01629,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1ec93093a36a54010ad1302caf7c5c24188c3d668ccfe895972a57ff6587850d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01630,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd52d9f3e99b17ef53cb1045db3488f149feb348547eaaa57f54bf7aaf6d18957&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01631,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x438a5c23f506d979268a2884664886c208526d050df78870f68c331625ee95d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01632,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb811a1ab572962105e233bc72569ef1ef980ffaec0c58c62c0e08744fdb23a7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01633,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2dba253d07386a24dac2fc5c78c557e25f4e521c2c5c37ebf514b9bbabd9f4f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01634,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc0975217f67c73ea0f22c7475233b64524f228a7da61e6c531cfd932cee27109&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01635,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x926f0429fd3f751c428e5501e7ffbb006ad7048930e1820455b6fe404b7d8a17&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01636,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x88bc22af6003d122e5ac2b7981aefe48cc5e787777a77364dc12530b35d33397&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01637,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd10229ae7c392518d3bcaa15f43ed0c2cca4f235cbe009e1aa711b109cded52c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01638,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf60a479f9ebd1a81e807ddaa404c8cc9b855eb08efa4481810529674214b8c84&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01639,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45574d293ed9b0ade09f8b041efd0f9be629979743111520a7c0224e41c36213&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01640,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf4d925c6aaeb0d96944b66a46324fd09815af73338fe9c58c332f77869473fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01641,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x055616453b16d6ff8caa12ea67e2543aa0fe47cb5c610699d5aded16ccdb72d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01642,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbffe5d04ec76b2d00ec35af8ed488116f1d3d454b1476db9c68bc62590b91b62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01643,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb04ce690ea5b0472a5f3d630336a0977e19517bb6c8443876e76d49f5876c98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01644,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x836dd3c2e51dd27fdfc1aca4839218e9a40390bb8966c257d470c5e13d610d09&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01645,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xccdd4d3758c1b860176290f80a588cf9f8f257ee6a094019968b645969039e52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01646,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdf78d1aa527997f2f34dcc3df048e8273d4c2147867b13f009fff3fabe1227e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01647,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbc1a2596d167f86f145df1c74a4ce5cdeb09e21c4f9077a7b7a75a026a9cd7e0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01648,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xba4445506249f1cd7510b1159ba679867a8a721810502db35b871131a52f6e9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01649,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc772985ee13356a7519f619cba370e0d30b2b17faac8e8779b34e77f319c2f21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01650,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0cd44f84d292e1d1a88b51fb885b084cb2e3e4e9ab284c6174e1277fdc808c12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01651,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x108b81392c28178c4f4fb98ed3e03860ebad588e089fbf85a87ba9988e27c055&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01652,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x92dc53a4408de761c673c56bf0c52c88cd2cd65777b47f65ba27265dcf5a4b2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01653,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac1c8ccb958d598d2591f82adcbce06cd05c5bc8c7714195f2808a42602cbd55&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01654,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2f466ff62e6b2eb3193683dca7c0af52da1825c22cae69cfda8b187d2d719bfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01655,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4dc5edd2150d175af8dd28927a1529a52080d0e0d2075d0c6f703ec2a527ef03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01656,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x72d321b5204000c80fd39ccf2fe72a17cac0eea2195133632b987461a4939c1d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01657,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0684723c2fcb39b6536736b92d24f7ca1bbb6b64c51c69ed69eae1ab22c83c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01658,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x651f1c70b5bd5638c095aeaee6313f1d4d2e28471ce7ce98aed045cec480d016&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01659,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0013c08b64bf7e3afab80ad4f8ea9423f1a7d8b31a149fc3b832d7980719c60c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01660,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7825d5b222a31cadf8cc345ae34eff92e4d617659c3f630037821d5acf6a5cfa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01661,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84e21383079e4674dd0c63cb29cd89f0726ed8895aa83aa99febd249dc9620a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01662,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa5681587c34c7e8d143b6332a98804a6940655b08c9764ee13f8362b929f15eb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01663,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc84283fad5c6405f6c9d51c0597b9908406ff09772233255fe61a1494e09cb2c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01664,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xab3af7a0e7c174b428f865f4fbe6d49aab50b91a0cb5555687f2769c6c874836&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01665,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0adeec06347b843d108e4d349b50156dcaa131bc27c7752a1cc3c3035b230d2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01666,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x827de27e4fa09f2ddd98223a7393881100fd9c533b55416b3839ad8f3b6835ec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01667,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x558e21250bc559d5e9cbf0b5c9787f4607cd769a3d96d4c174b769907b8032f2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01668,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d75bc100e6afde488e081895914ea1c5658115a0e028b439e2cb2d52c02a29c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01669,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84ccda7e5a2f253fee50e47559bdd8db96026897cec18ac128409ec405979de1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01670,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3490d679757169a0132ca44b3c408b53e9dbb23dfde34a6c8ad34ddd0f88ce78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01671,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4533f7b3dc71406ffa10a0af1fbb9b2d5cf61f7ae1d7a58c57734680984ef875&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01672,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xabf106295d76c72cbcc2b778712a1b954319d1b4a1365e19cbbf9ed0c39d7445&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01673,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd67018bd3f840799601c348f8d2a55eb0d46ece00688a3ae5d7a699de71817a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01674,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x16b9e8771fd65164ad5b4344b67bbc519da70ca263c562c0088a9c30dde29cb9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01675,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x35b0af7b1dfac60196dec285536cee1ff48d20579fe0df117be9566c78fd9404&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01676,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2753d9cd14ed65494895baf136feef1f4c0096ac569e856a0b858c43046dbaf5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01677,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe40b2ea438c3da468e62d736f576e9c6bf89e7b2079569b11b7b63ab6b859e53&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01678,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfcbdf0e3790abaa1ed31b64333b348ecdc15a15a213488f46d753ea77659d1b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01679,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe5f342e28cd6a85862e29a8bc6ededb8ce9e5252f02db387ca6b27f234a1c8c4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01680,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xaf511202a03e86af88d1a53657068bad1682ed4d3c3d446e4e553313c4183f91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01681,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd0e6d3d3842257da332754ff2e0ee2f28b630041e206da98093d60fd29cb2494&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01682,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66ddcfa8295f3681fe0dc6fa254f4a86cd25127f247cde63ea7b310f8934f163&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01683,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8887a5b6add7aad0916907bf209931a98364a7c2a74162ccbea586d2c95fc4fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01684,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb0ab38ced9c5de37409997ef703c79d0d0273d0599436d79c86fb19710f0580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01685,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x64bf045d836bd1a99dd127859286752a1c09c20fb5b8a70d2c238c86d6565640&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01686,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7a8fba5b00f60ce646da4ffa64981c334b927fbbbfa037890aab81f2ae5c65fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01687,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x26481dad4204488c03b357ab61f70c3e214800bd461be5b14a758caacbac5a94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01688,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x05f0a17478f22868e8c1442a512807f1ba0f0ba7d2452c2ada4b0626b23b6019&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01689,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac53e2ecad8e9ff6a20cd863627056469d0fe53c1e5ec3b590dffc853f36576e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01690,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9dbcd976d813101a23ea057a561d714c26264f42fec6b5f3dd2f06708423867a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01691,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb315f50f96b903776ae3f1e1cac5b683d34104953c62bae500aa4b2a29d8a4e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01692,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb877548bc73b777200804316b2cf7081152f0fa8923908b8ce8715126fbb3963&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01693,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d2c2aad64a353e2400dd1141f9bd7bab23dfa8aec7c2e5c42a1c52c58fd7cd5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01694,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd42cdf89f6ddbc2f8a8bcd4f6786cf73b985399c41328fd76c08821dcb2cb39a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01695,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d97b21795f44f7c853891c4f8007e2b9eeb7999c16ff0d81e744742f758dc7c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01696,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x49e0b594a63361d8cb35b386558238731b5b206702a2b68050290948b97a2b90&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01697,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01b23d087a4adf659d9a5f4c65eaf4a3164b46a7398dc516a52efd4f2f8ca77c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01698,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9c316b67ce5ae45a6ba25c46c1720b77741ce1bd7631e5da01fb509ca50ace2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01699,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcea5c210e2ef00d919631ccb5e68b178fb9b480062d13cc8604ce3845d950362&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01700,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3d9833e9df7243daa3904d9a41d3808841ba7ea07998eb140d63ad0b82f49d5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01701,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x073ad3dcaef6a4e5c3deec4d10a9795592dca55108e7fd3cf274ada351c290ae&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01702,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9c454cbcd610aa388489e7db1f4849677840ce1f0a3679e88d9e102e2b646aa7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01703,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0d424bdb826419a44bbe1435dbf09f15e33b105a97d0c11741401fb5e151f306&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01704,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc842662446daaba43a5dbc82bb9bc5735a21aba5fa7c6a0642a2a645d2fb06a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01705,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x850425a72ebd6cac965b15c5411581bb261a58e2e9f304fbbcc1f6ec56a3689a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01706,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5f7468d23fbeed676fe8188c346cc24453860c8e265373880ee3ca128e9f98b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01707,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x68199dcdf8d631885b4e264ef8160a64551e500f2f49aaac4e2966d6b42143fb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01708,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1bc39088aff2c8759c5f61190c8af3aeb48cc644a57ec061b6547c97395754a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01709,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac6bdf4cbd7c785c68ed288da6c280a6d1b7340e882e1a71688e56b31d237970&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01710,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x616a421395c539814d92259f0dbdccc436b6be78d1ad264305abc632fae12c63&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01711,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x675a2efc56ef5c385bc82bd826482cd8247801e0556f38182d2d396d7af13474&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01712,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb3466ce1c9c6c1f1c5c8681c13442c053bd73443ebd60b0443cccf95717fb756&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01713,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xefe87a15350ae4b7ea6136f27efba4c610f7d260cad4188771530e46a85d96ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01714,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a93b06d9b9e80fc6e21443ec976bbd3de80fa2ca50768e728598d44c6fce197&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01715,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc53f6fe8560e2c1f79a629b335139dff42a166dba3a3f3cdd8b9f3c45c482cef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01716,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbeebbc85402356009b2eecfc3e808aa7d6b671ce58430bada153e2678890476a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01717,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2daba19a743ea4ca797c5c20fffea6f79979ebd83d0606fa86a38c02709d0425&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01718,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69ddf701e288b58796af67a303745d123486204a9a7e0ac18b2afb25c4c9b61d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01719,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xac2ebcf440ba3a2ef280e8004918a9b6d849e19b321823a57132d7799c21a147&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01720,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc428eb527615d3acc4dbd68d2052fe6db27152c73bb2b22edfe4d9f13fd67ecf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01721,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x940116cedc675ccdecfc2ace0d21817c7e13d57154dfbabd0ac759cb68fc7aed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01722,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1aff873b75f990bea4c06fd212d2862a06d28047e47592b8809eeb164826bdf8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01723,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf19dc7c143cd5aac499bab456496409958bc496ed1b807c209069e5fb78089a6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01724,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x50ba9e2446defbca234aba740d15221152d261f9987e24f6e9ff3833d2422c88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01725,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6244c9ba553c0a9fdd9985673ec8dc94558b1208ea0b2c09cae8baec14ef04ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01726,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd9ca0531bdadeb4a42bbbe600161d3bc0c29f6de35c37b584d463c87cc8929be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01727,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x019f04b76df87f056d3e85bf6100ad35611dce5c332f9c885cf4ddf9e4b0df05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01728,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0bd9139ddae4c9e202aa11614fbe037609445363727e6057db969600bc442615&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01729,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa85a5ebec5a89cea73285765cd253a54806b53af28dd7577198839114fc037a3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01730,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe07d8fc1ad730fc509989b081ff643430c4d25396853553dde4bc01e0a5c774c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01731,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdeae685f4d356e7c5cd458638103aa02069a6ca2d8c459bbc49b9e3ac9f302f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01732,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd4b05748bb2981bff1958a4dba0b0f59559bfd5f8fd4e32b1d6c94d0902e1087&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01733,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2b75c3c9e417a3ee775e3f6d8b333588c4c8eb482ad9c611c73b8de9fff3403c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01734,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0b51aa4b64600138e09022ba4fcd58449faf43f4b1f8a5e82d9450fec703516c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01735,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5b7da9fdc48dac8163f0a2620536639c95e1f3c35f5d09442cd077900ba3397e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01736,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d581b4305c5b54aa72fbb2dea7f95fcd7ecd06dbafa7d1f52197cbb86cd7275&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01737,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x053468cbce94fcb5f0170028e0a585bb98000c005cbb0f9d8cdc0274cc3fdcf4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01738,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc4ea73550a711a24cdb631632d8b9826098f572e1dd0f5d338a7d571e40a0670&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01739,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x390296d239ff8e7ba83108c01143904890332e29c7fb89f287be70d9e446a4af&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01740,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0bc99a43bd74f339e60b6cb7235925e6bd78a56014979d6dd161ad9e2f65c9db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01741,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x831ca1406a51f08d9e8b7f9b4ae4e9b1562ec6b3a965e648f5fba403985d7c5f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01742,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ea854bc3a2a1cad0e25a07bc1a13146837088263c4b906a86f3aff87748a250&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01743,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcbe74e160ce637284edac7282156fd9a04638631e32dde566ef91abe19e9d7db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01744,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xafde3d1a0a5c90a5b6a8ace6e0c51f287a7baa6cd52fbb530d5cd30d77d1a9e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01745,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x265425af9916bed0dd62a2456e7c7da2c9c0f07a25c8974425dc0f116865942f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01746,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xffa83edd16de7ec3db737cea195c255b9711b59c21b1497e26747bed2e13f943&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01747,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2d7f0f5ad114008c8bcb0c95c1368739149923d73651da238d74d6e4f2e3acb7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01748,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7b69dcfeced3aa613f02ad7933e543e8dd53bfaeee20d90f4f1bd38429dfacf0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01749,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc08c96110c4d40c906c9f31d2d959c22201f86eade534578a58c391900fa278f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01750,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6067e2dac2ea8b7d928570e0b358cb2bde6a09b5169325a6d553e6215ab5b5c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01751,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x50262a09aa1822e9da30e2dfd935d89e012d1d336a88f24d8db38e4ec1608284&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01752,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0488926e04563f273a6ad741c30908764e8dac6e38d7032eb8d398a39b6e0f42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01753,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7477c0a14e3afe6b1210829b4fd571ddba704e062565ee06f8fc00631cc348ba&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01754,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x646def35e15739fb4e6b897511c4a71c34b323e0107a079a03ffe1be11480962&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01755,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x84f4fc01aa6c9e739865d63f71d6860875ba166ea67b4aa068de28cb1adffc8f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01756,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x308e058035fe5998006d16d2b6f6fb289d120e402b96d10100c98e92efc86619&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01757,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8b98854f27b4a6d80d520f8fe71c52fafbe55252d3df554a907a9c0c90f1de89&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01758,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7c7bd9920cdb8efaed244a333152b7f205bfee6f2eff4e0da455d882b070ab6c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01759,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xef9dd1ae52176b521f99f60ae0a16baa1832aec7ce2b95c0e6b20cbd0943b218&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01760,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc908c0cba78857bee8eaac7c241106164154782cf8c712987f4b6eb687161ed5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01761,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4c223079fd963774b68c0c75835a4f73a591a7f6647c09fa5def8021344fd209&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01762,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x58e9482fe6e25ceccb977c5945db92bc2ff9fd044336dbfd13714e6f84d9c99a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01763,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe9b64e4399b811a832bea55ce15fb1a55718352899e8fed5cba324e196b4004e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01764,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69d58dfd877a727ac73429279bd99ba2562eb358598d6c7f2941cdac9f3307bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01765,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x565089600e60764e78b07382ce1e0acc93b255ac0d9e20b4ad585767be9e8ab4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01766,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe47ad77ca6b9d30cefda397443229cb1df5561c9a436fa9d94d3752dbab1b8cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01767,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc92526a4d2bacdc047f4e86f6a2b159f6c72df8157178c4ca89cda1780245b1b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01768,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f318bcdb0e0d78f54276c87b5be9aa21919381bf2e82205072e8c10cb8cbc21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01769,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcc56b7c7ff7ead6cf9f72199ed9ae0a94d5afcd7fc25ad93275a37cdde487e62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01770,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8a0d9bcdcf18b4038a4df3f96e0782f2bb1d4d84ef4932b73dd0f2655f1c9187&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01771,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8c0c7922138320604c1287c6c0f87fdb37566752373a62c150c06653189cf070&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01772,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x490072e141e5099852008eb31e3b432bbc2d71cd988dd62a6872bd723f4464a9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01773,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x441a3c8c2fe28eede2b4ed609cf3fca8740cac9638c5962e2214c00365a3a787&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01774,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9d3c41ed132dc44de0d39c9d3dd4cc11c1e8a7f8f0316eb774991a9999c0f372&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01775,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6023b5ad4e7a8f918fefab880f48288bd8e0da6b9e2e3880f17ab96e3ebcd618&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01776,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x848902b06524297d54f30c1ddb0c7629c03fb1ba49464244cfe8b198ff99dc26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01777,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56f9c62bb1fb7eb1575c94cf34a37b136b82db0979412504812d7bd21990d5a2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01778,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x01a7fc06f4248e48ece709e46292bb7e0a69317fefbd38215c4c093a0d42e425&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01779,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ff0b05413db15b73284db1b8d1702ff095cce5810d44c6457693516ac3e4d65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01780,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0601be62d83f52db2fd5baa50940e9efb464596f0ed80d11722d2944f56bc38b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01781,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc73b916a7b1049230c965741275142bf554805f395feeddf9a8a84934fefce35&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01782,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4ff9deb85b08cc30d36d12e391e9ee9bb72a7db2cb52679b62cbae6059a67a46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01783,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6dcf0704c8afbf5b87adf316a01ebff4f641cefff7ba33d672ed51f477a2cf8a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01784,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37725e0bd787534538108e890787fd1606569bd4db127d22da37f2a4f2373fde&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01785,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb264cc368c6866747b9a711e14933f8d96f905bdb0b25a07cfcfd2b094a5fa4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01786,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8f3dccda34ec0838afc97c36da3b66c7a3c804709ed64b4725809ede5248dbbf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01787,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8cae5bdc47bc087d43c41f973c4711ea0af9e5ae53fc5a2fa3ff104070524401&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01788,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7e1c1704cf56b2e8cdf4ec7af790cdffcc0cfb3fa840a43ffd46d4fa0d0458a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01789,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdb34d4b8ff52ebaaca16e0ee46cc56669773768e2c2473470d055004825f6024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01790,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0e2fc599445336cd593fe78469762a0eaef058edc4f9a10a7083b42578eb6b18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01791,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0dabc8f4f2cc029e70b238f3ba3f2478038729cbdab741e25e934f3828891e60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01792,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x648d0dd207d0201595e12a8a30b247f7d51ee8385935ba68393db91c846459b6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01793,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x77485ef35b5343f0b16fab3492a9565a3fabb6b97d3076f2877c489b0a808ad5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01794,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe291673e64217556218b47874f5d9d4c6bf392894f6cabd9f572cf4750bd4d47&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01795,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd1d496b1a49c1b8f9e5a7e1146dca4e3c28ac4be22ec0d8764f56ff3ccda0e69&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01796,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x33a5546bb26b46559e6b72502faf6dfa1060fb41a69bf9fff988c463f6132aa0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01797,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x34123297e57b8a075114c3698558387086e3a4b2acfdd54041901f952e7afb91&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01798,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3ca0aeadff3449302ce20766cc4dc0b1628f85cbd26665a40b0f509493428f08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01799,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe949b50c73fe40ff59ab7e8b460a5c81a411b02931151d95eba96ba7e422b731&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01800,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07cb6fc533ed260b5b01e470e4d874270270fc5332f423e620be1dd92b06ff6a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01801,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8edf5827b93f9dd727c25e4cdf558bdef0c8d1962c993666fb469082ae607e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01802,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf95306bb3bc429f9229f80e3fd50446435e98eb615bffdb379d202abcad65f98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01803,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4e1d05e25890a1b0b1f301452321893b91ec09ca755dea16b16fd8eb0d02a39d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01804,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa24b5a4a59adcc97ac586cf83a7314357ae74c48d9099ca9463954f8ca24db24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01805,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x81d9a9522808c36c1845abcc5a080b237f69ec54c4f263c31c3fb2738bddbf38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01806,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x66534ad9878fc2792c46d45c62a93320cdbd40c276025bcfb786dda3b53e775c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01807,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x37ac18016b4a26060dde93000fe2b5614ae011c506725b391bdafaf9d613f8fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01808,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f1a883d82a05988793b449444221a6baa67a0975a8bdc20bd5c8044fb059bd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01809,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x45d0f53f5567f627b64e808129a7730badce39d542584ac3b4e392e549eebe9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01810,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ccaab76edecb5af607c5f4a741d30e9b9762ac77bfcac89b087ac9fdb51727f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01811,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9ab98ad907f0df327b31733e17eca703d44c5315e0f3f381dee38a6716e9bbb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01812,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x80d86e96ae3c138cb93d8b83e1aca9930c3aef9845f19e164076a319c12b3d29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01813,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b4ae400e53cfcfe9027f84324909f496fdba244a748a8786a8b6f30126bedb6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01814,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0064cce975cf20b2bf11f501c61e1cfc5df450c0231fea9b29df7d134b1b5cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01815,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa2d0424093b6f41d5bc9c2d6bc63596e722f91e214f3453d692e27404d58cb31&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01816,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9a493dd73536b40fe784e7710b23ead682163b5c2873d06fb634b41821df1d12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01817,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xf534c5f3151aba70c4902307fd1d8cb8a9227ea3bfe00099879f9af4458f7cca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01818,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc34b86c65e0db470eb8f644fc648b5520546535adecff743126a2bb394fb474a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01819,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x918b86fa5fabcbe1535ff25b9cc6bf18399033a10feab07b1b2a44e652c890c7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01820,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x17e7111cf764fe48d55ae33eb9992d4fa0c443e17aba5ed8121665d09e719642&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01821,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe118ce724863baafe5822a6df3eb6322f52b0efac93df5ce30f2890249a5301b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01822,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd7b7b15d51895e067d217712e532f4c1ca318bec69483371d584eca1fcd35dd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01823,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3fe7a945dc87c69c3c018c68cc45a5ad9d5c76a9623a615305eb03b30bde5286&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01824,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x6ad87d358fe720d6207c7189c458f01246ef8fdbcebe5bf977590c5053395226&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01825,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7f98124406ff6a0ac572d6cbedd187c905ab77a2957904ba9df742ddd37616d9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01826,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc17dc5a387763a48690eeff9f15e2c8a17d46585c0330f855207bf83db5ba7ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01827,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfa5fbccba9509f70ed5a39bbc8148708230e37f26fb18b7a74aea1616e3e4609&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01828,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x540009e54254fad311b1b69490c7587db7dbf71ce7a15e62f94d49eaf22525e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01829,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41ed6fe79b33dc5a32a019496131ea6805aef33a6aaf93982d37dd7653decb41&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01830,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2afebfecd0c3c447d920747a1346c865aa846b0ae6f7eb900e25606c8d9ed725&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01831,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x7289db8d2960f6402252c8699465253d4e3efdc31c832a9ba82b535bbe39dfa1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01832,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb1198d248f79e07609cf29ef8984e2786258b474c17a982d2e4e9219af3d6592&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01833,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0bef12618bd2905629f0c9d7427431884e203e70d78f5c9308a3215d79a28556&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01834,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfdca337f0afcb8f508449dcfebafb6de99c44f1a468a0c162785b36b20c01446&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01835,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa45d06eca259ea9bf79a23c0a8a50cd784fa072330050f7da63a0e4acd14b4f6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01836,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x87fe297ba8e996cf2b1fdb854e86b043f485149eea31c3c74187402b58892cce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01837,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe26e40bdb2425b55bd59c814f5839f7ff9f74aa1aa86d23e95988048d319e64c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01838,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xec6b0c035002b5d12e30ff8e3f97f281f562593eff842cf8905468c3d9c9777e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01839,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x07950048304ce616f23f40789e4f7995ce30e164dc5e35d97ab241998924b825&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01840,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe287972bf569570a6f2f8d3dd01ceebff3c9c849706e2ebe133ce72dbbbadcec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01841,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2a6039e5b858d952e07cbc9057a4506b30edd01944b253c0bb68fdc9e4616b6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01842,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5567d80f36494b4f26232e2a26f06fc382bdddf8b9eb7a20d56087f13e1cd561&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01843,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3153e10ad6830573f85e149d79579aaa27e4161239b5bef085dfe1c86d2d04cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01844,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x03b0963dd2f6917a141dcb843dcdc7b8fe71ffc51a29cf86b7f909ba9ff178b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01845,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x03b93b158737ecadc1a498bbe78e247ec652f5707571512674bb231e4c35593f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01846,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3e05673eeaabb4293f6eba4fc8597b21e935e72e7d614665480e881bba552938&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01847,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x2de5f285569a2744c7dc3b94d992c655037d370f4f8d8ca04a26b4f30ccbf5ed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01848,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x113a0599656907adc266ada978194806c922455ded32bdb8578ddedcc0e31d8b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01849,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x71675e40a1ede46ed372c411541b1a66c4d76d33fbfd97db91b9a3a96a45e669&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01850,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xeb0e8dced91d0329228af294e8273236ae0a4e6f8590ed770ce6b8ecb9d4e9b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01851,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x27b488ec8baa7adbc492e5c2311f57d1bb025e42fb362933096f7dbf66112277&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01852,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xa405f5f3d7c35326f18a1a85fcd88a897d5e3a31867791cee9489042b950375b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01853,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xde7294f59c86cf434f1b51c11d36eec758c73de3e0cfdfb0d88f7ef4e6aaf946&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01854,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b3a9f72ed4d4521657db928917a7abdd71f4ba2cf1fa4915b68d1c840fe3eb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01855,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbb9869151522b5034619c9983d1c21d253a8a46dfc03bdb7c4e8771faa4cd31d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01856,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x10e8b0ee7a9e05e342cbdf4cc408d4d207163bf652e9d45a715f63a14079b558&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01857,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe0a70c38b92eb6cda8f9b7e2253b88bb8a25833d34f1174e9d5a3dc11d709fb0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01858,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x96299d525632a3677163bc6f18e98439e410f1c3f0a0e561bcbb63ed8022b860&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01859,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x056f7f9b622e013fd1a31107cddb7843babb80ad494781ecc0408a4551a6a04c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01860,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbe17dd25f8ad8b238b69e317126128e379aa87af72ab99cac240b4d6362ef148&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01861,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x31641a0876c1fef62d170f84f2c6113d88d4d38ce90538e30bed4565fc6a3027&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01862,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdeb651e11a7f6e50e2c2adc32ec89af247c4c71763ab3d213bfca70b0e26c311&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01863,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x500103a06c6cf65606e2c734912c6448844b87904ee9d68c7be782ac5f6188ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01864,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x168be6df9d2a7ba553609c9235d1cef41b783323f60f7c59ca210f3e9db4d764&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01865,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd69771c57985c9c43d6195e8be9d199c3b3ca206a682a0c6c2a274b8294b644a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01866,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3cf6a306ef85f605b6b8610c42f3200bc04bf7cfd1b325b8574ed2c28d4ffb62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01867,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x69891a16fc79a0e6fd885f23b106806ecf71ad7b3e5d51a579193c4f2583dc5e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01868,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xfb7b596a80d0782f73d11fae09d7da314be8143b471193a28901a36d6b58d8f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01869,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd864488dca9ec72930dbba8d9f554af78dacec003a6f58fbe05cbeeaa8eaca21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01870,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3dc73a6d1c0433c0d98800a9877d3e0e9651e6eace71413ae0f52a7bf58616c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01871,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xca53dc21977789285d08334ce43b0469a5bd54cf890a4ed1e0cf4543b1575457&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01872,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xd571c79ae2f0b29d334f8c33b14b21a83491d21da2650ccd9d7e3f1b307ca7a4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01873,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xc71b3cef8fd89a79abb07c140f1cf9b90f4afaffa3d269ba2dcc9e2831cd0c3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01874,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb43aeeecf3e3603fc7f82cc03948d50a9cab2c30d26a371afa8d7b0526c20853&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01875,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x24fb77820016a3b7ff7cd3ec7407364b0b660fb2a6bb0e26e4b8da1deb6275c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01876,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x41ac34f85491e5d80275e95298185b3df6bc6e522b1b6e18a81b4a954573d27d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01877,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x54983d685feaa65ccbaed699e5c85a9cc5fb2275ee5ecc15295fa056f35dff42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01878,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x56db2145e5e6ffb8f46ab7fd0bf8192af4b7ee8701fc92e3066697fc7fdab1c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01879,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x793c08df7c9a354e39b31fa213f2944ea8361ed33203f0e1e438351e185d241a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01880,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0412a89eb5bf0325ce228aa64f66dcab0855c002db872dd94f3ee97496d41a1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01881,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x8d9912853e99f373036df7a07e47eff4dba631f7456c6fee1bb79a292f530c13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01882,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x44df0aab52827e4608b4fab902457682fa019ad5cbbdf7502bb1ba74607078b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01883,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xbd172681ef1b3e781763591809db8067a65590760a1a823716d2afffcd893492&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01884,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5732d988076cc1fedf316e07aa3a8567fd55a04ca989876d4bdc63681cbcce48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01885,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x5480f07444c8ba60faf8b853c77b72b2e0aee4894a176f920d0965eb92df90f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01886,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xb5e8b2b00ba1708ec31ca0a7e64540c1b02d837991d4e12cdb19d6c75ed0da6b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01887,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xdededef33d83e607868d87e8f058511a152de71d8a04b12499d5f1666b89071d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01888,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xcdbce5e36cfff749d0ee9ccb6dc344a822ed097e4b8eb812ada19521890d5663&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01889,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x4a09fe43bd97064993f18d214062005a1ffc76d03495b2b7c65c6137d3dd055e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01890,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xff7a1b1127af6429b799637ff6cffb9169aa5000f01b67a54e2c7f9a155e7027&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01891,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x0f7bffdd015be88c78d30778d5bd66b75e86f9867e221f857352d0cb95c927a1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01892,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x9671b1edc7dc58206e18de1e4d107bf2e8508483017749146ff5c82c674408e6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01893,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x1b07973b9e818e0e014e52c587149c9775fd44bd5ccd095dee3221ba7c7a9efe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01894,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x804008940c025a4e8a00ea42a659b484ba32c14dff133e9d3b7bf3685c1e54de&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01895,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x3f81607c8cb3f0448a11cab8df0e504b605581f4891a9a35bd9c0dd37a71834f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;01896,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0xe6ebe562c89bc8ecb94dc9b2889a27a816ec05d3d6bd1625acad72227071e721&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The accumulator root should be verified by community members before being
accepted. Although the accumulator root can be verified at anytime by anyone in
the future, it is likely clients and other tooling will begin relying on proofs
against the aforementioned root in the near term.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optimize EOA EXTCODEHASH</title>
        <published>2024-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jame</name><uri>https://github.com/ZWJKFLC</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7637/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7637-extcodehash-optimize/18946" />
        

        <id>https://wg-eips.ritovision.com/7637/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7637"
            label="EIP-7637" />
        

        
        

        
        <summary type="html">Modify the output value of EXTCODEHASH for EOA accounts to `0x`</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7637/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is an optimization for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1052&#x2F;&quot;&gt;EIP-1052&lt;&#x2F;a&gt;,
For addresses with a balance, but without code, the codehash should still be &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When an address &lt;code&gt;add.code == 0x&lt;&#x2F;code&gt; and &lt;code&gt;add.balance != 0&lt;&#x2F;code&gt;, &lt;code&gt;add.codehash==0&lt;&#x2F;code&gt; is required instead of &lt;code&gt;add.codehash==keccak256(&quot;&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1052 was proposed to save gas fees. However, due to some flaws in the set specifications, in actual applications, due to safety concerns, they will not actually be used. In order for EIP-1052 to be truly useful, it should be optimized.&lt;&#x2F;p&gt;
&lt;p&gt;If someone uses it based on the proposal of EIP-1052 and does not notice the change when &lt;code&gt;add.balance != 0&lt;&#x2F;code&gt;, there may be security issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The behaviour of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is changed in the following way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;When calling &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, the codehash of the address with balance but no code is still &lt;code&gt;0x&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1052 In order to include the function of &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, let the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of the address without balance be &lt;code&gt;0x&lt;&#x2F;code&gt;, and the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of the address with balance be &lt;code&gt;keccak256(&quot;&quot;)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract address can be calculated in advance. Whether it is  &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, it is possible that the contract is not created but has a balance. For security, You can actually only use &lt;code&gt;keccak256(add.code) == keccak256(&quot;&quot;)&lt;&#x2F;code&gt; or &lt;code&gt;add.code.length ==0&lt;&#x2F;code&gt; instead of &lt;code&gt;add.codehash == 0&lt;&#x2F;code&gt;,, which makes the original intention of EIP-1052 meaningless.&lt;&#x2F;p&gt;
&lt;p&gt;For example, uniswap V2 uses stored addresses to determine whether a contract exists. If this &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is optimized, can save a huge amount of gas.&lt;&#x2F;p&gt;
&lt;p&gt;If someone uses a &lt;code&gt;add.codehash==0&lt;&#x2F;code&gt; to determine whether a contract has been created, due to intuition and the lack of details in many documents, they will not think that the codehash of an address with a balance will change from &lt;code&gt;0x&lt;&#x2F;code&gt; to &lt;code&gt;keccak256(&quot;&quot;)&lt;&#x2F;code&gt;. If someone maliciously attacks at this time, it will cause some bad effects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Using codehash to determine whether a non-contract address has a balance will not be available&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Code reference for execution-specs&lt;&#x2F;p&gt;
&lt;p&gt;After modification&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_CODE_HASH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMPTY_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_be_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	if&lt;&#x2F;span&gt;&lt;span&gt; codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;hexstr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Source code&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; extcodehash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Evm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    charge_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_CODE_HASH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;env&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EMPTY_ACCOUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        codehash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_be_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;keccak256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;stack&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; codehash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Using codehash to determine whether a non-contract address has a balance will not be available&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase calldata cost</title>
        <published>2024-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Toni Wahrstätter</name><uri>https://github.com/nerolation</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7623/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7623-increase-calldata-cost/18647" />
        

        <id>https://wg-eips.ritovision.com/7623/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7623"
            label="EIP-7623" />
        

        
        

        
        <summary type="html">Increase calldata cost to reduce maximum block size</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7623/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current calldata pricing permits EL payloads of up to 7.15 MB, while the average size is much smaller at around 100 KB.
This EIP proposes adjusting the calldata cost to reduce the maximum possible block size and its variance without negatively impacting regular users.
This is achieved by increasing calldata costs for transactions that predominantly post data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The block gas limit has not been increased since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, while the average size of blocks has continuously increased due to the growing number of rollups posting data to Ethereum. Moreover, calldata costs have remained unchanged since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; introduces blobs as a preferred method for data availability (DA).
This transition demands a reevaluation of calldata pricing, especially in order to address the disparity between average and maximum block sizes.
By introducing a floor cost dependent on the ratio of gas spent on EVM operations to calldata, this proposal aims to reduce the maximum block size to make room for additional blobs or potential block gas limit increases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STANDARD_TOKEN_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Let &lt;code&gt;tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;isContractCreation&lt;&#x2F;code&gt; be a boolean indicating the respective event.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;execution_gas_used&lt;&#x2F;code&gt; be the gas used for EVM execution with the gas refund subtracted.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; be 2 as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The current formula for determining the total gas used per transaction (&lt;code&gt;tx.gasUsed&lt;&#x2F;code&gt;) is equivalent to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The formula for determining the gas used per transaction changes to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    21000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        STANDARD_TOKEN_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; execution_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        +&lt;&#x2F;span&gt;&lt;span&gt; isContractCreation&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITCODE_WORD_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; words&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tokens_in_calldata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Any transaction with a gas limit below &lt;code&gt;21000 + TOTAL_COST_FLOOR_PER_TOKEN * tokens_in_calldata&lt;&#x2F;code&gt; or below its intrinsic gas cost (take the maximum of these two calculations) is considered invalid. This limitation exists because transactions must cover the floor price of their calldata without relying on the execution of the transaction. There are valid cases where &lt;code&gt;gasUsed&lt;&#x2F;code&gt; will be below this floor price, but the floor price needs to be reserved in the transaction gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current maximum EL payload size is approximately 1.79 MB (&lt;code&gt;30_000_000&#x2F;16&lt;&#x2F;code&gt;). It is possible to create payloads filled with zero bytes that expand to 7.15 MB. However, since blocks are typically compressed with Snappy at the P2P layer, zero-byte-heavy EL payloads generally compress to under 1.79 MB. The implementation of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; increased the maximum possible compressed block size to approximately 2.54 MB.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal aims to increase the cost of calldata to 10&#x2F;40 gas for transactions that do not exceed a certain threshold of gas spent on EVM operations relative to gas spent on calldata. This change will significantly reduce the maximum block size by limiting the size of data-heavy transactions that can fit into a single block. By increasing calldata costs from 4&#x2F;16 to 10&#x2F;40 gas per byte, for data-heavy transactions this EIP aims to reduce the possible EL payload size to approximately 0.72 MB (&lt;code&gt;30_000_000&#x2F;40&lt;&#x2F;code&gt;) without affecting the majority of users. Other adversarial block constructions can have a non-compressible EL payload size of approximately 1.26MiB.&lt;&#x2F;p&gt;
&lt;p&gt;Notably, regular users (e.g. sending ETH&#x2F;Tokens&#x2F;NFTs, engaging in DeFi, social media, restaking, bridging, etc.), who do not use calldata predominantly for DA, may remain unaffected.
The calldata cost for transactions involving significant EVM computation remains at 4&#x2F;16 gas per byte, so those transactions are unaffected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Wallet developers and node operators MUST update gas estimation handling to accommodate the new calldata cost rules. Specifically:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Wallets&lt;&#x2F;strong&gt;: Wallets using &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST be updated to ensure that they correctly account for the &lt;code&gt;TOTAL_COST_FLOOR_PER_TOKEN&lt;&#x2F;code&gt; parameter. Failure to do so could result in underestimating gas, leading to failed transactions.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Node Software&lt;&#x2F;strong&gt;: RPC methods such as &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; MUST incorporate the updated formula for gas calculation. Node developers MUST ensure compatibility with the updated calldata pricing logic.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Users can maintain their usual workflows without modification, as wallet and RPC updates will handle these changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As the maximum possible block size is reduced, no security concerns have been raised.&lt;&#x2F;p&gt;
&lt;p&gt;In some cases, it might seem advantageous to combine two transactions into one to reduce costs. For example, bundling a transaction that relies heavily on calldata but minimally on EVM resources with another that does the opposite. However, this is not a significant concern for several reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;This type of bundling is already possible today. Merging multiple transactions can save the 21,000 gas cost for each additional transaction beyond the first, a feature explicitly supported in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Such bundling does not compromise the block size reduction objectives of this EIP.&lt;&#x2F;li&gt;
&lt;li&gt;In practice, transaction bundling is often impractical due to challenges such as trust and coordination requirements.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These factors ensure that transaction bundling does not pose a significant issue.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF Contract Creation</title>
        <published>2024-02-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7620/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7620-eof-contract-creation-instructions/18625" />
        

        <id>https://wg-eips.ritovision.com/7620/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7620"
            label="EIP-7620" />
        

        
        

        
        <summary type="html">Introduce `EOFCREATE` and `RETURNCODE` instructions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7620/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;EVM Object Format (EOF) removes the possibility to create contracts using &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. We introduce a new&#x2F;replacement method in form of pair of instructions : &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; and &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; to provide a way to create contracts using EOF containers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP uses terminology from the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; which introduces the EOF format.&lt;&#x2F;p&gt;
&lt;p&gt;EOF aims to remove code observability, which is a prerequisite to legacy EVM contract creation logic using legacy-style create transactions, &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, because both the initcode and code are available to the EVM and can be manipulated. On the same premise, EOF removes opcodes like &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, introducing EOF subcontainers as a replacement to cater for factory contracts creating other contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The new instructions introduced in this EIP operate on EOF containers enabling factory contract use case that legacy EVM has.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Wherever not explicitly listed, the rules of EOF contract creation, as well as the &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction, should be identical or analogous to those of &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instruction. This includes but is not limited to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;behavior on &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and address collision (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;EVM execution frame created for the &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; initcode - memory, account context etc.&lt;&#x2F;li&gt;
&lt;li&gt;nonce bumping of the account of newly created contract &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;balance checking and transfer for the creation endowment (&lt;code&gt;value&lt;&#x2F;code&gt; argument)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;32000&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;fork_types.py#L42&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;1024&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;interpreter.py#L60&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CODE_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;200&lt;&#x2F;code&gt; in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;0f9e4345b60d36c23fffaa69f70cf9cdb975f4ba&#x2F;src&#x2F;ethereum&#x2F;shanghai&#x2F;vm&#x2F;gas.py#L44&quot;&gt;Ethereum Execution Layer Specs&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined as &lt;code&gt;24576&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce two new instructions on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xec&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xee&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, any of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The instructions &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are made obsolete and rejected by validation in EOF contracts. They are only available in legacy contracts.&lt;&#x2F;li&gt;
&lt;li&gt;If instructions &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; have EOF code as initcode (starting with &lt;code&gt;EF00&lt;&#x2F;code&gt; magic)
&lt;ul&gt;
&lt;li&gt;deployment fails (returns 0 on the stack)&lt;&#x2F;li&gt;
&lt;li&gt;caller&#x27;s nonce is not updated and gas for initcode execution is not consumed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In the context of legacy bytecode execution any of these instructions (&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;, &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt;) result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;overview-of-the-new-contract-creation-flow&quot;&gt;Overview of the new contract creation flow&lt;&#x2F;h4&gt;
&lt;p&gt;In EOF EVM, new bytecode is introduced to the state by means of &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; delivering an EOF container (&lt;code&gt;initcontainer&lt;&#x2F;code&gt;). Such a container may include arbitrarily deeply nesting subcontainers. The &lt;code&gt;initcontainer&lt;&#x2F;code&gt; and its subcontainers are recursively validated according to all the validation rules applicable for the EOF version in question. Next, the 0th code section of the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is executed and may eventually call a &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction, which will refer to a subcontainer to be finally deployed to an address.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;InitcodeTransactions&lt;&#x2F;code&gt; are defined in detail in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7873&#x2F;&quot;&gt;EIP-7873&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction is in turn a replacement of the &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; legacy instructions allowing factory contracts to create other contracts. The main difference to the &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; is that the &lt;code&gt;initcontainer&lt;&#x2F;code&gt; is selected to be one of the subcontainers of the EOF container calling &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; (and not one of &lt;code&gt;transaction.initcodes&lt;&#x2F;code&gt;). It is worth noting that no validation is performed at this point, as it has already been done when the factory contract containing &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; was deployed.&lt;&#x2F;p&gt;
&lt;p&gt;Details on each instruction follow in the next sections.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eofcreate&quot;&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;deduct &lt;code&gt;TX_CREATE_COST&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;halt with exceptional failure if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;read immediate operand &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt;, encoded as 8-bit unsigned value&lt;&#x2F;li&gt;
&lt;li&gt;pop &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;input_offset&lt;&#x2F;code&gt;, &lt;code&gt;input_size&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt; from the operand stack&lt;&#x2F;li&gt;
&lt;li&gt;perform (and charge for) memory expansion using &lt;code&gt;[input_offset, input_size]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;load initcode EOF subcontainer at &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; is executed
&lt;ul&gt;
&lt;li&gt;let &lt;code&gt;initcontainer&lt;&#x2F;code&gt; be that EOF container&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;check that current call depth is below &lt;code&gt;STACK_DEPTH_LIMIT&lt;&#x2F;code&gt; and that caller balance is enough to transfer &lt;code&gt;value&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;in case of failure return 0 on the stack, caller&#x27;s nonce is not updated and gas for initcode execution is not consumed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;caller&#x27;s memory slice &lt;code&gt;[input_offset:input_size]&lt;&#x2F;code&gt; is used as calldata&lt;&#x2F;li&gt;
&lt;li&gt;execute the container and deduct gas for execution. The 63&#x2F;64th rule from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; applies.&lt;&#x2F;li&gt;
&lt;li&gt;increment &lt;code&gt;sender&lt;&#x2F;code&gt; account&#x27;s nonce&lt;&#x2F;li&gt;
&lt;li&gt;calculate &lt;code&gt;new_address&lt;&#x2F;code&gt; as &lt;code&gt;keccak256(0xff || sender32 || salt)[12:]&lt;&#x2F;code&gt;, where &lt;code&gt;sender32&lt;&#x2F;code&gt; is the sender address left-padded to 32 bytes with zeros&lt;&#x2F;li&gt;
&lt;li&gt;an unsuccessful execution of initcode results in pushing &lt;code&gt;0&lt;&#x2F;code&gt; onto the stack
&lt;ul&gt;
&lt;li&gt;can populate returndata if execution &lt;code&gt;REVERT&lt;&#x2F;code&gt;ed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;a successful execution ends with initcode executing &lt;code&gt;RETURNCODE{deploy_container_index}(aux_data_offset, aux_data_size)&lt;&#x2F;code&gt; instruction (see below). After that:
&lt;ul&gt;
&lt;li&gt;load deploy EOF subcontainer at &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; in the container from which &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; is executed&lt;&#x2F;li&gt;
&lt;li&gt;concatenate data section with &lt;code&gt;(aux_data_offset, aux_data_offset + aux_data_size)&lt;&#x2F;code&gt; memory segment and update data size in the header if needed.&lt;&#x2F;li&gt;
&lt;li&gt;if updated deploy container size exceeds &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; instruction exceptionally aborts&lt;&#x2F;li&gt;
&lt;li&gt;set &lt;code&gt;state[new_address].code&lt;&#x2F;code&gt; to the updated deploy container&lt;&#x2F;li&gt;
&lt;li&gt;push &lt;code&gt;new_address&lt;&#x2F;code&gt; onto the stack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;deduct &lt;code&gt;GAS_CODE_DEPOSIT * deployed_code_size&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;returncode&quot;&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;read immediate operand &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt;, encoded as 8-bit unsigned value&lt;&#x2F;li&gt;
&lt;li&gt;pop two values from the operand stack: &lt;code&gt;aux_data_offset&lt;&#x2F;code&gt;, &lt;code&gt;aux_data_size&lt;&#x2F;code&gt; referring to memory section that will be appended to deployed container&#x27;s data&lt;&#x2F;li&gt;
&lt;li&gt;cost 0 gas + possible memory expansion for aux data&lt;&#x2F;li&gt;
&lt;li&gt;ends initcode frame execution and returns control to EOFCREATE caller frame where &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; and &lt;code&gt;aux_data&lt;&#x2F;code&gt; are used to construct deployed contract (see above)&lt;&#x2F;li&gt;
&lt;li&gt;instruction exceptionally aborts if after the appending, data section size would overflow the maximum data section size or underflow (i.e. be less than data section size declared in the header)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;We extend code section validation rules (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; must be less than &lt;code&gt;num_container_sections&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; the subcontainer pointed to by &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; must have its &lt;code&gt;len(data_section)&lt;&#x2F;code&gt; equal &lt;code&gt;data_size&lt;&#x2F;code&gt;, i.e. data section content is exactly as the size declared in the header (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7620&#x2F;#data-section-lifecycle&quot;&gt;Data section lifecycle&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; the subcontainer pointed to by &lt;code&gt;initcontainer_index&lt;&#x2F;code&gt; must not contain either a &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; must be less than &lt;code&gt;num_container_sections&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; the subcontainer pointed to &lt;code&gt;deploy_container_index&lt;&#x2F;code&gt; must not contain a &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;li&gt;It is an error for a container to contain both &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; and either of &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;STOP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;It is an error for a subcontainer to never be referenced in its parent container&lt;&#x2F;li&gt;
&lt;li&gt;It is an error for a given subcontainer to be referenced by both &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; and &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument value (jump destination relative offset) validation: code section is invalid in case offset points to the byte directly following either &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; or &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;data-section-lifecycle&quot;&gt;Data Section Lifecycle&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;For an EOF container which has not yet been deployed&lt;&#x2F;strong&gt;, the &lt;code&gt;data_section&lt;&#x2F;code&gt; is only a portion of the final &lt;code&gt;data_section&lt;&#x2F;code&gt; after deployment.
Let&#x27;s define it as &lt;code&gt;pre_deploy_data_section&lt;&#x2F;code&gt; and as &lt;code&gt;pre_deploy_data_size&lt;&#x2F;code&gt; the &lt;code&gt;data_size&lt;&#x2F;code&gt; declared in that container&#x27;s header.
&lt;code&gt;pre_deploy_data_size &amp;gt;= len(pre_deploy_data_section)&lt;&#x2F;code&gt;, which anticipates more data to be appended to the &lt;code&gt;pre_deploy_data_section&lt;&#x2F;code&gt; during the process of deploying.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pre_deploy_data_section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                                      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\___________pre_deploy_data_size______&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;For a deployed EOF container&lt;&#x2F;strong&gt;, the final &lt;code&gt;data_section&lt;&#x2F;code&gt; becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pre_deploy_data_section | static_aux_data | dynamic_aux_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                         |             |                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                          \___________aux_data___________&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                                       |                  |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\___________pre_deploy_data_size______&#x2F;                    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|                                                          |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;\________________________data_size_______________________&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;aux_data&lt;&#x2F;code&gt; is the data which is appended to &lt;code&gt;pre_deploy_data_section&lt;&#x2F;code&gt; on &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;static_aux_data&lt;&#x2F;code&gt; is a subrange of &lt;code&gt;aux_data&lt;&#x2F;code&gt;, which size is known before &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; and equals &lt;code&gt;pre_deploy_data_size - len(pre_deploy_data_section)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dynamic_aux_data&lt;&#x2F;code&gt; is the remainder of &lt;code&gt;aux_data&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;data_size&lt;&#x2F;code&gt; in the deployed container header is updated to be equal &lt;code&gt;len(data_section)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Summarizing, there are &lt;code&gt;pre_deploy_data_size&lt;&#x2F;code&gt; bytes in the final data section which are guaranteed to exist before the EOF container is deployed and &lt;code&gt;len(dynamic_aux_data)&lt;&#x2F;code&gt; bytes which are known to exist only after.
This impacts the validation and behavior of data-section-accessing instructions: &lt;code&gt;DATALOAD&lt;&#x2F;code&gt;, &lt;code&gt;DATALOADN&lt;&#x2F;code&gt;, and &lt;code&gt;DATACOPY&lt;&#x2F;code&gt;, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7480&#x2F;&quot;&gt;EIP-7480&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-section-appending&quot;&gt;Data section appending&lt;&#x2F;h3&gt;
&lt;p&gt;The data section is appended to during contract creation and also its size needs to be updated in the header. Alternative designs were considered, where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;additional section kinds for the data were introduced&lt;&#x2F;li&gt;
&lt;li&gt;additional fields describing a subcontainer were introduced&lt;&#x2F;li&gt;
&lt;li&gt;data section would be written over as opposed to being appended to, requiring it to be filled with 0 bytes prior to deployment&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All of these alternatives either complicated the otherwise simple data structures or took away useful features (like the dynamically sized portion of the data section).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;keccak256-initcontainer-in-the-new-address-hashing-scheme&quot;&gt;&lt;code&gt;keccak256(initcontainer)&lt;&#x2F;code&gt; in the &lt;code&gt;new_address&lt;&#x2F;code&gt; hashing scheme&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;new_address = keccak256(0xff || sender || salt || keccak256(initcontainer))[12:]&lt;&#x2F;code&gt; was originally proposed as the way to calculate the address of newly created contract, similar, but not exactly equal, to what &lt;code&gt;CREATE2&lt;&#x2F;code&gt; uses.&lt;&#x2F;p&gt;
&lt;p&gt;This alternative however goes against code non-observability, because it locks in the contents of the initcontainer e.g. preventing re-writing it in some future upgrade. It also seems unnecessarily expensive: &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; can only pick up one of its subcontainers, yet the hash value would need to be recalculated on every execution of &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Other ways of removing code observability, yet keeping some form of witness of the code, were considered. However, keeping only &lt;code&gt;sender&lt;&#x2F;code&gt; and &lt;code&gt;salt&lt;&#x2F;code&gt; allows the implementer of the factory contract (i.e. one containing the &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; instruction) to include the code witness via the &lt;code&gt;salt&lt;&#x2F;code&gt; anyway, if that&#x27;s necessary for the particular use case. Therefore, keeping the &lt;code&gt;new_address&lt;&#x2F;code&gt; formula minimal is the most flexible approach with better separation of concerns.&lt;&#x2F;p&gt;
&lt;p&gt;Leaving the &lt;code&gt;keccak256(initcontainer)&lt;&#x2F;code&gt; out of the &lt;code&gt;new_address&lt;&#x2F;code&gt; hash has also the benefit of making the &lt;code&gt;new_address&lt;&#x2F;code&gt; independent of the metadata section (proposed for the EOF in a separate EIP), which is a desired property. Unfortunately, if a factory wants to opt into committing to a particular &lt;code&gt;initcontainer&lt;&#x2F;code&gt;, it needs to include it in the &lt;code&gt;salt&lt;&#x2F;code&gt;, and that will include the metadata section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eofcreate-stack-argument-order&quot;&gt;&lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; stack argument order&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instructions from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7069&#x2F;&quot;&gt;EIP-7069&lt;&#x2F;a&gt; have had their stack argument order changed, as compared to that of legacy instructions &lt;code&gt;*CALL&lt;&#x2F;code&gt;. We follow the same change to have &lt;code&gt;EOFCREATE&lt;&#x2F;code&gt; stack arg order match those of &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted), and the contract creation options do not change for legacy bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; calls with &lt;code&gt;EF00&lt;&#x2F;code&gt; initcode fail early without executing the initcode. Previously, in both cases the initcode execution would begin and fail on the first undefined instruction &lt;code&gt;EF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Creation transaction, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; cannot have its &lt;em&gt;code&lt;&#x2F;em&gt; starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt;, but such cases are covered already in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;. However, new cases must be added where &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; have its &lt;em&gt;initcode&lt;&#x2F;em&gt; being (validly or invalidly) EOF formatted:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Initcode&lt;&#x2F;th&gt;&lt;th&gt;Expected result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;initcode starts execution and fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;initcode starts execution and fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF5f&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;initcode starts execution and fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CREATE2&lt;&#x2F;code&gt; fails early, returns 0 and keeps sender nonce intact&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0xEF0001&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;as above&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;valid EOFv1 container&lt;&#x2F;td&gt;&lt;td&gt;as above&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is the EOF &lt;code&gt;InitcodeTransaction&lt;&#x2F;code&gt; (specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7873&#x2F;&quot;&gt;EIP-7873&lt;&#x2F;a&gt;) which needs a detailed review and discussion as that is where external unverified code enters the state. Among others:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Is its complexity under control, ruling out any DoS attempts&lt;&#x2F;li&gt;
&lt;li&gt;Is it correctly priced and always charged for&lt;&#x2F;li&gt;
&lt;li&gt;Is the validation comprehensive and not allowing problematic code to be saved into the state&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revert creation in case of non-empty storage</title>
        <published>2024-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gary Rong</name><uri>https://github.com/rjl493456442</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7610/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-revert-creation-in-case-of-non-empty-storage/18452" />
        

        <id>https://wg-eips.ritovision.com/7610/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        

        
        <category
            term="tag:eip:7610"
            label="EIP-7610" />
        

        
        

        
        <summary type="html">Revert contract creation if address already has the non-empty storage</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7610/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP causes contract creation to throw an error when attempted at an address with pre-existing storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract creation is attempted due to a creation transaction, the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode, the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode, or any other reason, and the destination address already has either a nonzero nonce, a nonzero code length, or non-empty storage, then the creation MUST throw as if the first byte in the init code were an invalid opcode. This change MUST apply retroactively for all existing blocks.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP amends &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;684&#x2F;&quot;&gt;EIP-684&lt;&#x2F;a&gt; with one extra condition, requiring empty storage for contract deployment.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP will not affect &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt;, since the authority&#x27;s nonce is always incremented after an authorization is applied, which conflicts with the condition required for contract deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-684 defines two conditions for contract deployment: the destination address must have zero nonce and zero code length. Unfortunately, this is not sufficient. Before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; was applied, the nonce of a newly deployed contract remained set to zero. Therefore, it was entirely possible to create a contract with a zero nonce and zero code length but with non-empty storage, if slots were set in the constructor. There exists 28 such contracts on Ethereum mainnet at this time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is an execution layer upgrade, and so it requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There exists quite a number of tests in the ethereum tests repo as well as in the execution spec tests, which test the scenario of deployment to targets with non-empty storage. These tests have been considered problematic in the past; Reth and EELS both intentionally implement a version of the account reset solely to pass the tests. Py-evm declared the situation impossible and never implemented account reset.&lt;&#x2F;p&gt;
&lt;p&gt;Refilling the existing tests will provide sufficient coverage for this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a security upgrade: it enforces the immutability of deployed code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Decrease base cost of TLOAD&#x2F;TSTORE</title>
        <published>2024-02-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>James Prestwich</name><uri>https://github.com/prestwich</uri>
	</author>
	
	<author>
		<name>brockelmore</name><uri>https://github.com/brockelmore</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7609/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7609-reduce-transient-storage-pricing/18435" />
        

        <id>https://wg-eips.ritovision.com/7609/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7609"
            label="EIP-7609" />
        

        
        

        
        <summary type="html">Improve the efficiency of TLOAD&#x2F;TSTORE by decreasing the base cost and introducing a superlinear pricing model.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7609/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Decrease the base cost of TLOAD&#x2F;TSTORE while introducing a superlinear pricing model. This increases the efficiency of TLOAD&#x2F;TSTORE for common use cases, while providing a pricing model to prevent DoS vectors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; introduces a new storage region, termed &quot;transient storage&quot;. It behaves like storage (word-addressed and persists between call frames), but unlike storage it is wiped at the end of each transaction. During development of EIP-1153, the pricing was set to be the same as warm storage loads and stores. This was for two reasons: conceptual simplicity of the EIP, and it also addressed concerns about two related DoS vectors: being able to allocate too much transient storage, and the cost of rolling back state in the case of reverts.&lt;&#x2F;p&gt;
&lt;p&gt;One of the most important use cases that EIP-1153 enables is cheap reentrancy protection. In fact, if transient storage is cheap enough for the first few slots, reentrancy protection can be enabled by default at the language level without too much burden to users, while simultaneously preventing the largest—and most expensive—class of smart contract vulnerabilities.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it seems that transient storage is fundamentally overpriced. Its pricing does not interact with refunds, it only requires a new allocation on contract load (as opposed to memory, which requires a fresh allocation on every call), and has no interaction with the physical database.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a pricing model which charges additional gas per allocation, which is cheaper for common cases (fewer than ~95 slots are written per contract), while making DoS using transient storage prohibitively expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is proposed to be 5 gas. The gas cost for &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is proposed to be 8 gas + &lt;code&gt;expansion_cost&lt;&#x2F;code&gt;, where &lt;code&gt;expansion_cost&lt;&#x2F;code&gt; is calculated as &lt;code&gt;1 gas * len(transient storage mapping)&lt;&#x2F;code&gt; if the key is not yet in the transient storage mapping, and otherwise 0 gas.&lt;&#x2F;p&gt;
&lt;p&gt;In pseudo-code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;G_LOW&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;G_MID&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;SLOPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_tload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;_key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; G_LOW&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; gas_tstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transient_mapping&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; G_MID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transient_mapping&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SLOPE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; transient_mapping&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;In benchmarking, &lt;code&gt;TLOAD&lt;&#x2F;code&gt; was found to cost a similar amount of CPU time as &lt;code&gt;MUL&lt;&#x2F;code&gt;, while &lt;code&gt;TSTORE&lt;&#x2F;code&gt; was found to cost about 1.5x that. The values &lt;code&gt;G_low&lt;&#x2F;code&gt; and &lt;code&gt;G_mid&lt;&#x2F;code&gt; were therefore chosen for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;, respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The maximum number of transient slots which can be allocated on a single contract given 30m gas is approximately 7,739 (solution to &lt;code&gt;x(x-1)&#x2F;2*1 + 8*x = 30_000_000&lt;&#x2F;code&gt;), which totals 248KB.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum number of transient slots which can be allocated in a transaction if you use the strategy of calling new contracts (which each are designed to maximize transient storage allocation) once the cost of &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is more than the cost of calling a cold contract (2600 gas), can be solved for as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;solve for SLOPE * &amp;lt;num slots&amp;gt; == 2600, =&amp;gt; num_slots == 2600&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_used_by_contract = 2600 + SLOPE * num_slots * (num_slots - 1) &#x2F; 2 + G_MID * num_slots == 3402100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_gas_limit = 30_000_000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;num_calls_per_txn = block_gas_limit &#x2F;&#x2F; gas_used_by_contract ~= 8.8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;max_transient_slots = num_calls_per_txn * num_slots == 22927&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Thus, the maximum number of transient slots which can be allocated in a single transaction with this method is roughly 23,000, which totals 736KB. Compared to the current gas schedule (which allows allocating approximately &lt;code&gt;30_000_000 &#x2F; 100 * 32 == 9.6MB&lt;&#x2F;code&gt; worth of memory), this is a net &lt;em&gt;reduction&lt;&#x2F;em&gt; in the total memory which can be allocated on a client using transient storage, so this EIP presents a stronger bound on the resources which can be used by transient storage. As a comparison point, the total amount of memory which can be allocated on a client by &lt;code&gt;SSTORE&lt;&#x2F;code&gt;s in a given transaction is &lt;code&gt;30_000_000 &#x2F; 20_000 * 32&lt;&#x2F;code&gt;, or 48KB.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this cap scales linearly with the gas limit, which is a useful property when considering future block gas limit increases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verkle state transition via an overlay tree</title>
        <published>2024-01-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	<author>
		<name>Jamie Lokier</name><uri>https://github.com/jlokier</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Parithosh Jayanthi</name><uri>https://github.com/parithosh</uri>
	</author>
	
	<author>
		<name>Gabriel Rocheleau</name><uri>https://github.com/gabrocheleau</uri>
	</author>
	
	<author>
		<name>Karim Taam</name><uri>https://github.com/matkt</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7612/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ethereum-state-trie-format-change-using-an-overlay/4165" />
        

        <id>https://wg-eips.ritovision.com/7612/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7612"
            label="EIP-7612" />
        

        
        

        
        <summary type="html">Describes the use of an overlay tree to use the verkle tree structure, while leaving the historical state untouched.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7612/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a method to switch the state tree tree format from hexary Merkle Patricia Tree (MPT) to a Verkle Tree (VKT): the MPT tree is frozen, and new writes to the state are stored in a VKT “laid over” the hexary MPT. The historical MPT state is left untouched and its eventual migration is handled at a later time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum state is growing, and VKTs offer a good mitigation strategy to stem this growth and enable weak statelessness. Owing to the difficulty of translating contracts with large storage while they are being accessed, proposals for migrating the current MPT state are complex and will require client teams to undergo a long process of refactoring their code to handle this conversion.&lt;&#x2F;p&gt;
&lt;p&gt;The bigger the state, the longer any conversion process will take. This has an impact both while the conversion is happening, as well as when full-syncing the chain if the conversion is part of consensus. Fullsync is used extensively by core dev teams to test the performance of new code. A conversion longer than a month will impact the release schedule of client teams who typically release at this rate. Nodes that cannot follow the conversion will need to wait longer to rejoin. The conversion will also make reorgs slower, so reducing its duration is desirable.&lt;&#x2F;p&gt;
&lt;p&gt;This current proposal suggests to stop the MPT state growth in its tracks by activating a new “overlay” VKT, that all new state updates are written to. The “base” MPT is frozen in place, until all execution clients are ready to perform the full transition. Data is read first from the overlay tree, and if not found there, from the MPT.&lt;&#x2F;p&gt;
&lt;p&gt;Whenever the block that freeze the MPT is finalized, internal node data can be deleted, in order to free up disk space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIME&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Time at which the overlay tree is activated.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Determine if `block` is the fork activation block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_fork_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIME&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Write an account in the verkle tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verkle_set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VerkleTree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Version&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reserved&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        basicdata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; basicdata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODEHASH_LEAF_KEY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ckkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;code_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reads an account from the verkle tree&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verkle_get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VerkleTree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    basicdata_leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; basicdata_leaf&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;basicdata_leaf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;basicdata_leaf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;basicdata_leaf&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ckkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODEHASH_LEAF_KEY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ck&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ckkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cskey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cskey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CODE_SIZE_LEAF_KEY&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        cs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cskey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ck&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; cs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;changes-to-the-execution-spec&quot;&gt;Changes to the execution spec&lt;&#x2F;h3&gt;
&lt;p&gt;In the execution spec, modify the &lt;code&gt;State&lt;&#x2F;code&gt; class as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; State&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Contains all information that is preserved between transactions.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _main_trie&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;lambda&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;secured&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _storage_tries&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;dict&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _snapshots&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _created_accounts&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Added in this EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    _overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; VerkleTree&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And the state access functions are modified as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_account_optional&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; verkle_get_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key_for_version&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; trie_get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_main_trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Account&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    verkle_set_account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; get_tree_key_for_nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; account&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_storage_tries&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; trie_get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;trie&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; set_storage&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Add the following function which is used when storing a contract in the tree:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; state_set_codechunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chunk_num&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; chunk&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;_overlay_tree&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;get_tree_key_for_code_chunk&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunk_num&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; chunk&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;changes-to-the-block-header&quot;&gt;Changes to the block header&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;FORK_TIME&lt;&#x2F;code&gt; the block header state root is changed from the MPT root to the VKT root.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This approach doesn&#x27;t convert the state, which is left to a subsequent EIP. This is meant as a stopgap in case we decide to push the conversion itself to a later time. It has the advantage of simplicity, which means that the Verge fork could happen at the same time as other, simpler EIPs. It also requires no change at the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;!--
  This section is optional for non-Core EIPs.

  The Test Cases section should include expected input&#x2F;output pairs, but may include a succinct set of executable tests. It should not include project build files. No new requirements may be introduced here (meaning an implementation following only the Specification section should pass all tests here.)
  If the test suite is too large to reasonably be included inline, then consider adding it as one or more files in `..&#x2F;assets&#x2F;eip-####&#x2F;`. External links will not be allowed

  TODO: Remove this comment before submitting
--&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transition-post-genesis&lt;&#x2F;code&gt; branch in &lt;code&gt;github.com&#x2F;gballet&#x2F;go-ethereum&lt;&#x2F;code&gt; implements this when setting &lt;code&gt;--override.overlay-stride=0&lt;&#x2F;code&gt; on the command line.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;!--
  All EIPs must contain a section that discusses the security implications&#x2F;considerations relevant to the proposed change. Include information that might be important for security discussions, surfaces risks and can be used throughout the life cycle of the proposal. For example, include security-relevant design decisions, concerns, important discussions, implementation-specific guidance and pitfalls, an outline of threats and risks and how they are being addressed. EIP submissions missing the &quot;Security Considerations&quot; section will be rejected. An EIP cannot proceed to status &quot;Final&quot; without a Security Considerations discussion deemed sufficient by the reviewers.

  The current placeholder is acceptable for a draft.

  TODO: Remove this comment before submitting
--&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PeerDAS - Peer Data Availability Sampling</title>
        <published>2024-01-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Francesco D&#x27;Amato</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Hsiao-Wei Wang</name><uri>https://github.com/hwwhww</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7594/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7594-peerdas-peer-data-availability-sampling/18215" />
        

        <id>https://wg-eips.ritovision.com/7594/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7594"
            label="EIP-7594" />
        

        
        

        
        <summary type="html">Introducing simple DAS utilizing gossip distribution and peer requests</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7594/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;PeerDAS (Peer Data Availability Sampling) is a networking protocol that allows nodes to perform data availability sampling (DAS) to ensure that blob data has been made available while downloading only a subset of the data. PeerDAS utilizes gossip for distribution, discovery for finding peers of particular data custody, and peer requests for sampling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;DAS is a method of scaling data availability beyond the levels of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; by not requiring all nodes to download all data while still ensuring that all of the data has been made available.&lt;&#x2F;p&gt;
&lt;p&gt;Providing additional data availability helps bring scale to Ethereum users in the context of layer 2 systems called &quot;roll-ups&quot; whose dominant bottleneck is layer 1 data availability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We extend the blobs introduced in EIP-4844 using a one-dimensional erasure coding extension. Each row consists of the blob data combined with its erasure code. It is subdivided into cells, which are the smallest units that can be authenticated with their respective blob&#x27;s KZG commitments. Each column, associated with a specific gossip subnet, consists of the cells from all rows for a specific index. Each node is responsible for maintaining a deterministic set of column subnets and custodying their data as a function of their node ID.&lt;&#x2F;p&gt;
&lt;p&gt;Nodes find and maintain a diverse peer set and sample columns from their peers to perform DAS every slot.&lt;&#x2F;p&gt;
&lt;p&gt;A node can reconstruct the entire data matrix if it acquires at least 50% of all the columns. If a node has less than 50%, it can request the necessary columns from its peer nodes.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, a limit of 6 blobs per transaction is introduced. Clients MUST enforce this limit when validating blob transactions at submission time, when received from the network, and during block production and processing.&lt;&#x2F;p&gt;
&lt;p&gt;The detailed specifications are on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;9d377fd53d029536e57cfda1a4d2c700c59f86bf&#x2F;specs&#x2F;fulu&#x2F;&quot;&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces cell KZG proofs, which are used to prove that a KZG commitment opens to a cell at the given index. This allows downloading only specific cells from a blob, while still ensuring data integrity with respect to the corresponding KZG commitment, and is therefore a key component of data availability sampling. However, computing the cell proofs for a blob is an expensive operation, which a block producer would have to repeat for many blobs. Since proof verification is much cheaper than proof computation, and the proof size is negligible compared to cell size, we instead require blob transaction senders to compute the proofs themselves and include them in the EIP-4844 transaction pool wrapper for blob transactions.&lt;&#x2F;p&gt;
&lt;p&gt;To this end, during transaction gossip responses (&lt;code&gt;PooledTransactions&lt;&#x2F;code&gt;), the wrapper is modified to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([tx_payload_body, wrapper_version, blobs, commitments, cell_proofs])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cell_proofs = [cell_proof_0, cell_proof_1, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt;, &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;commitments&lt;&#x2F;code&gt; are as in EIP-4844, while the &lt;code&gt;proofs&lt;&#x2F;code&gt; field is replaced by &lt;code&gt;cell_proofs&lt;&#x2F;code&gt;, and a &lt;code&gt;wrapper_version&lt;&#x2F;code&gt; is added. These are defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;wrapper_version&lt;&#x2F;code&gt; - one byte indicating which version of the wrapper is used. For the current version, it is set to &lt;strong&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cell_proofs&lt;&#x2F;code&gt; - list of cell proofs for all &lt;code&gt;blobs&lt;&#x2F;code&gt;, including the proofs for the extension indices, for a total of &lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; proofs per blob (&lt;code&gt;CELLS_PER_EXT_BLOB&lt;&#x2F;code&gt; is the number of cells for an extended blob, defined &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;9d377fd53d029536e57cfda1a4d2c700c59f86bf&#x2F;specs&#x2F;fulu&#x2F;polynomial-commitments-sampling.md#cells&quot;&gt;in the consensus specs&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that, while &lt;code&gt;cell_proofs&lt;&#x2F;code&gt; contain the proofs for all cells, including the extension cells, the blobs themselves are sent without being extended (&lt;code&gt;CELLS_PER_EXT_BLOB &#x2F; 2&lt;&#x2F;code&gt; cells per blob). This is to avoid sending redundant data, which can quickly be computed by the receiving node.
In other words, &lt;code&gt;cell_proofs[i * CELLS_PER_EXT_BLOB + j]&lt;&#x2F;code&gt; is the proof for cell &lt;code&gt;j&lt;&#x2F;code&gt; of &lt;code&gt;compute_cells(blobs[i])&lt;&#x2F;code&gt;, where &lt;code&gt;compute_cells(blob)&lt;&#x2F;code&gt; outputs all cells of &lt;code&gt;blob&lt;&#x2F;code&gt;, including the extension cells.&lt;&#x2F;p&gt;
&lt;p&gt;The node MUST validate &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; and verify the wrapped data against it. To do so, ensure that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are an equal number of &lt;code&gt;tx_payload_body.blob_versioned_hashes&lt;&#x2F;code&gt;, &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;commitments&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;cell_proofs&lt;&#x2F;code&gt; contains exactly &lt;code&gt;CELLS_PER_EXT_BLOB * len(blobs)&lt;&#x2F;code&gt; cell proofs&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; hash to the versioned hashes, i.e. &lt;code&gt;kzg_to_versioned_hash(commitments[i]) == tx_payload_body.blob_versioned_hashes[i]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; match the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;cell_proofs&lt;&#x2F;code&gt;. This requires computing the extension cells for all &lt;code&gt;blobs&lt;&#x2F;code&gt; (e.g. via &lt;code&gt;compute_cells&lt;&#x2F;code&gt;), and verifying all &lt;code&gt;cell_proofs&lt;&#x2F;code&gt;. (Note: all cell proofs can be batch verified at once, e.g. via &lt;code&gt;verify_cell_kzg_proof_batch&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-use-das-to-scale-the-da-layer&quot;&gt;Why use DAS to scale the DA layer?&lt;&#x2F;h3&gt;
&lt;p&gt;PeerDAS is a DAS scheme that requires nodes to only download a small constant fraction of the data to satisfy a local availability check. With the current parameters, this is 1&#x2F;8 of the total data (i.e. blobs in a block), which can in the future be decreased to 1&#x2F;16 or even 1&#x2F;32 by reducing the size of samples (increasing the number of columns). In this way, PeerDAS allows for securely scaling the blob throughput of the network without compromising decentralization, i.e., without increasing node&#x27;s bandwidth and storage requirements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-does-peer-sampling-provide&quot;&gt;What does peer sampling provide?&lt;&#x2F;h3&gt;
&lt;p&gt;PeerDAS takes the set of peers of a node on the network as a primitive to build a DAS scheme around. A focus on peers allows for redundancy in the mechanism (as a node generally has many peers, and peer count can also be cheaply increased) which both helps with theoretical security as detailed in the &quot;Security Considerations&quot; section, but also practical security of the implementation (e.g. if a single peer fails, a node can likely use another peer for the same sampling task).&lt;&#x2F;p&gt;
&lt;p&gt;PeerDAS also has the nice property that any given node may voluntarily custody more of the data than the bare minimum which increases the performance of the mechanism. Alternative schemes do not readily support this &quot;transparent&quot; scaling property.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-are-these-parameters-chosen&quot;&gt;Why are these parameters chosen?&lt;&#x2F;h3&gt;
&lt;p&gt;The parameters of PeerDAS given in the specs support network security while keeping node requirements sufficiently low. See the security argument below for further details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-do-validators-have-an-additional-custody-requirement-beyond-full-nodes&quot;&gt;Why do validators have an additional custody requirement beyond full nodes?&lt;&#x2F;h3&gt;
&lt;p&gt;Validators are assumed to have marginally higher requirements to participate on the network. PeerDAS introduces a custody requirement that scales with the validator count so that nodes with more resources can contribute to a more stable backbone that makes the global network more robust.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;column-sampling-vs-row-sampling&quot;&gt;Column sampling vs row sampling&lt;&#x2F;h3&gt;
&lt;p&gt;PeerDAS defines a sample as a &quot;column&quot; which is a cross-section across &lt;em&gt;all&lt;&#x2F;em&gt; blobs, rather than a &quot;row&quot; which would be a full blob.
The sampling scheme could be defined over rows but then any reconstruction strategy would need to work over &quot;extension&quot; blobs that do not a priori exist on the network.
Reconstruction becomes much more tractable by working over columns as nodes can be assumed to have much more of the complete data by default (e.g. because most&#x2F;all of the blobs are in the public mempool).&lt;&#x2F;p&gt;
&lt;p&gt;Another benefit is that sampling over rows requires &lt;em&gt;column&lt;&#x2F;em&gt; extensions which would have to be done at the time of block construction, i.e. on the &quot;critical path&quot;. Sampling over columns requires row extensions which can be done in advance (not on the critical path), and moreover proof computation can be outsourced to senders of blob transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Refer to the consensus and execution spec tests for testing of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The primary failure mode of a DAS scheme is a &quot;data withholding&quot; attack, where a block producer attempts to convince the network some data is available even when the block producer fails to provide the associated data.
PeerDAS resolves withholding attacks by implementing a (pseudo)randomized sampling scheme that decreases the probability of a successful attack as the size of the network grows for a sublinear amount of data that must be downloaded.&lt;&#x2F;p&gt;
&lt;p&gt;This intuition can be formalized as follows:&lt;&#x2F;p&gt;
&lt;p&gt;Letting &lt;code&gt;n&lt;&#x2F;code&gt; be the total number of sampling nodes (i.e. the size of the network), &lt;code&gt;m&lt;&#x2F;code&gt; be the total number of samples possible (cf. &lt;code&gt;NUMBER_OF_CUSTODY_GROUPS&lt;&#x2F;code&gt; in the specs) and &lt;code&gt;k&lt;&#x2F;code&gt; be the minimum number of samples that a node must download (cf. &lt;code&gt;SAMPLES_PER_SLOT&lt;&#x2F;code&gt; in the specs), we have the following bound for the probability of convincing a fraction $\epsilon$ of the nodes that some data is available when it is withheld:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7594&#x2F;.&#x2F;assets&#x2F;withholding-probability.svg&quot; alt=&quot;withholding-probability&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The first term is the number of possible ways to choose a subset of $n\epsilon$ nodes whose sampling queries should be satisfied (i.e. the nodes to be tricked).
The second term is the number of ways to choose a maximally large subset of samples to be made available to satisfy the sampling queries of the $n\epsilon$ nodes without allowing reconstruction of the full data.
Finally, for any such choices, the third term is the probability of success, i.e. the probability that the sampling queries of all chosen $n\epsilon$ nodes are satisfied by the chosen subset up to the reconstruction threshold.&lt;&#x2F;p&gt;
&lt;p&gt;For mainnet parameters given in the specs and assuming 10,000 nodes on the network, we can compute upper bounds of attack success for varying $\epsilon$:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;$\epsilon$&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;$n\epsilon$ (target nodes)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: center&quot;&gt;Upper bound on $\mathbb{P}$&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.01&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;100&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$1$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.02&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-20.04}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.03&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;300&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-101.55}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.04&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-198.24}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;0.05&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: center&quot;&gt;$10^{-306.34}$&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The table shows that the chances of a successful attack quickly drop to a negligible amount and so PeerDAS is considered secure to withholding attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS signed transactions</title>
        <published>2024-01-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7591/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7591-bls-signed-transactions/19911" />
        

        <id>https://wg-eips.ritovision.com/7591/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7591"
            label="EIP-7591" />
        

        
        

        
        <summary type="html">Introduces a new transaction type signed with BLS signatures</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7591/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type that is signed with BLS signatures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The BLS signature scheme allows for easy aggregation and verification of aggregated signatures.
If a substantial number of transactions on mainnet were BLS signed transactions, we can aggregate signatures in a block and batch-verify them.
This will reduce growth of the chain history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;BLS_TX_TYPE = Bytes1(0x04)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-type&quot;&gt;Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;The transaction type will have the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, sender, signature]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with &lt;code&gt;sender&lt;&#x2F;code&gt; being the BLS public key of an account with address &lt;code&gt;address = [0:20](keccak256(sender))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The signature value &lt;code&gt;signature&lt;&#x2F;code&gt; is calculated by constructing a BLS signature over the following digest:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;tx_hash = keccak256(BLS_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, sender]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;header-changes&quot;&gt;Header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The block header will be amended with the &lt;code&gt;aggregated_sig&lt;&#x2F;code&gt; field, containing an aggregated signature of all BLS transactions in the block.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    aggregated_sig,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;block-changes&quot;&gt;Block changes&lt;&#x2F;h3&gt;
&lt;p&gt;The block building algorithm needs to be changed in order to built the aggregated signature of all BLS signed transactions in the block.
All transactions in the block will be added without the signature field set.&lt;&#x2F;p&gt;
&lt;p&gt;Blocks with transactions containing the &lt;code&gt;signature&lt;&#x2F;code&gt; field MUST be rejected.&lt;&#x2F;p&gt;
&lt;p&gt;On block verification, the &lt;code&gt;verifyAggregate&lt;&#x2F;code&gt; algorithm is used as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid = verifyAggregate(sender_1, ... sender_n, tx_hash_1, ... tx_hash_n, aggregated_sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Removing the ECDSA signature from a transaction saves 65 bytes. The BLS public key is 48 bytes, the aggregated signature is 96 bytes.
Thus we save &lt;code&gt;-96 + (65-48)* #transactions&lt;&#x2F;code&gt; bytes per block. With ~7000 blocks per day, 1.000.000 transactions per day, the average block contains roughly 150 transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Thus we would save 2454 bytes or 2.4KB per block. This would equate to ~1.5% saving given an average block size of 160KB.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to the (admittedly meager) size savings for full nodes, the ability to add a new transaction type to utilize a different signature scheme does have some merit to it. This proposal shows that it would be possible to add for example a quantum safe signature scheme to ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the execution layer and introduces a new transaction type and a new header field. Thus a hardfork is needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The messages signed via BLS are distinct (no hash collisions on the txhash), thus the aggregation is secure even without a proof-of-possession.
The public keys are not distinct which is not a problem in BLS.&lt;&#x2F;p&gt;
&lt;p&gt;We assume that keccak256 and ECDSA and BLS are working as intended.
Suppose we have two addresses &lt;code&gt;address_1 = keccak256(pk_ecdsa)&lt;&#x2F;code&gt; and &lt;code&gt;address_2 = keccak(pk_bls)&lt;&#x2F;code&gt; with &lt;code&gt;address_1 == address_2&lt;&#x2F;code&gt;.
We know that &lt;code&gt;pk_ecdsa&lt;&#x2F;code&gt; must be equal to &lt;code&gt;pk_bls&lt;&#x2F;code&gt; (follows from keccak).
This would mean that we would either be able to find &lt;code&gt;x&lt;&#x2F;code&gt; with &lt;code&gt;g_bls^x = y&lt;&#x2F;code&gt; for a given &lt;code&gt;y&lt;&#x2F;code&gt; (violates the security of BLS)
or find &lt;code&gt;z&lt;&#x2F;code&gt; with &lt;code&gt;d_ecdsa^z = y&lt;&#x2F;code&gt; (violates the security of ECDSA).&lt;&#x2F;p&gt;
&lt;p&gt;Thus it would be impossible (with greater than negligble probability) to find two private keys, one in ECDSA and one in BLS that control the same account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Move committee index outside Attestation</title>
        <published>2023-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7549/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7549-move-committee-index-outside-attestation/16390" />
        

        <id>https://wg-eips.ritovision.com/7549/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7549"
            label="EIP-7549" />
        

        
        

        
        <summary type="html">Move committee index outside of the signed Attestation message</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7549/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Move the committee&#x27;s &lt;code&gt;index&lt;&#x2F;code&gt; field outside of the signed Attestation message to allow aggregation of equal consensus votes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to make Casper FFG clients more efficient by reducing the average number of pairings needed to verify consensus rules. While all types of clients can benefit from this EIP, ZK circuits proving Casper FFG consensus will likely have the most impact.&lt;&#x2F;p&gt;
&lt;p&gt;On a beacon chain network with at least 262144 active indices, it&#x27;s necessary to verify a minimum of &lt;code&gt;ceil(32*64 * 2&#x2F;3) = 1366&lt;&#x2F;code&gt; attestations to reach a 2&#x2F;3 threshold. Participants cast two votes at once: LMD GHOST vote and Casper-FFG vote. However, the Attestation message contains three elements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;LMD GHOST vote &lt;code&gt;(beacon_block_root, slot)&lt;&#x2F;code&gt;. Note: includes slot in the event (block, slot) voting is adopted.&lt;&#x2F;li&gt;
&lt;li&gt;FFG vote &lt;code&gt;(source, target)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Committee index &lt;code&gt;(index)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Signing over the 3rd item causes tuples of equal votes to produce different signing roots. If the committee index is moved outside of the Attestation message, the minimum number of attestations to verify to reach a 2&#x2F;3 threshold is reduced to &lt;code&gt;ceil(32 * 2&#x2F;3) = 22&lt;&#x2F;code&gt; (a factor of 62).&lt;&#x2F;p&gt;
&lt;p&gt;On-chain attestations can now be packed more space-efficiently into beacon blocks. This proposal allows for up to 8 slots worth of votes in a block, compared to 2 today. In other words, a chain with only 1&#x2F;8 online proposers can still potentially include all votes on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;index&lt;&#x2F;code&gt; field from &lt;code&gt;AttestationData&lt;&#x2F;code&gt; to a fixed value of zero&lt;&#x2F;li&gt;
&lt;li&gt;Move committee indexing data to the outer &lt;code&gt;Attestation&lt;&#x2F;code&gt; container with &lt;code&gt;committee_bits&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Increase the capacity of &lt;code&gt;aggregation_bits&lt;&#x2F;code&gt; to all committees in a slot&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The full specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;2c1f677187e6534aec77057a7d1cc746a40d3630&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;deprecation-strategy&quot;&gt;Deprecation strategy&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;index&lt;&#x2F;code&gt; field in &lt;code&gt;AttestationData&lt;&#x2F;code&gt; can be deprecated by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Removing the field&lt;&#x2F;li&gt;
&lt;li&gt;Preserving the field and setting it to zero&lt;&#x2F;li&gt;
&lt;li&gt;Changing the field type to Optional (from EIP-7495 StableContainer)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP chooses the second option to not complicate the inclusion of &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; objects. While the &lt;code&gt;Attestation&lt;&#x2F;code&gt; container changes, &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; includes indexed attestations without committee data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-attestations-value&quot;&gt;&lt;code&gt;MAX_ATTESTATIONS&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;The maximum size of an attestation increases, with a bitfield 64 times larger on networks with maxed committees. &lt;code&gt;MAX_ATTESTATIONS&lt;&#x2F;code&gt; value is reduced to limit the beacon block size while still increasing the total capacity of votes. A value of 8 increases the voting capacity by 4 while having the same attestation space size with a network of 1.2M active indices.
Read the details &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7549&#x2F;assets&#x2F;complexity_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-attester-slashings-value&quot;&gt;&lt;code&gt;MAX_ATTESTER_SLASHINGS&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;On-chain &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; includes a list of participants&#x27; indices. With this EIP, the worst-case size increases by 64 times, resulting in an uncompressed size of 488 KB per &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt; in a network of 1M validators. Snappy compression reduces it to 320 KB, which is still significant. To bound the maximum size of the block, this proposal reduces &lt;code&gt;MAX_ATTESTER_SLASHINGS&lt;&#x2F;code&gt; from 2 to 1, the minimum value.
Read the details &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7549&#x2F;assets&#x2F;complexity_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-bitvector-for-committee-bits&quot;&gt;Using &lt;code&gt;Bitvector&lt;&#x2F;code&gt; for &lt;code&gt;committee_bits&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;committee_bits&lt;&#x2F;code&gt; sequence has a variable length with the max size &lt;code&gt;MAX_COMMITTEES_PER_SLOT = 64&lt;&#x2F;code&gt;. Encoding of the &lt;code&gt;Bitlist&lt;&#x2F;code&gt; includes its actual length, which doubles the size of the &lt;code&gt;committee_bits&lt;&#x2F;code&gt; compared to the &lt;code&gt;Bitvector&lt;&#x2F;code&gt; type. Beacon chain state transition ensures correctness of the &lt;code&gt;committee_bits&lt;&#x2F;code&gt; when the effective number of committees in a slot is less than its max value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward-incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;first-block-after-the-fork&quot;&gt;First block after the fork&lt;&#x2F;h3&gt;
&lt;p&gt;Because the on-chain &lt;code&gt;Attestation&lt;&#x2F;code&gt; container changes, attestations from the prior fork can&#x27;t be included in post-Electra blocks. Therefore, the first block after the fork may have zero attestations. LMD votes can still be applied to fork-choice via &lt;code&gt;on_attestation&lt;&#x2F;code&gt; handler, so there will be only a 1&#x2F;32 loss of FFG votes. Attesters assigned to the last slot of the fork will incur one epoch worth of offline penalties. One possible mitigation is to change the Electra block body type to allow including attestations from both forks. However, the mitigation increases complexity for little gain, so this proposal chooses not to address the issue.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mutation-over-gossip&quot;&gt;Mutation over gossip&lt;&#x2F;h3&gt;
&lt;p&gt;Moving the &lt;code&gt;index&lt;&#x2F;code&gt; field outside of the signed message allows malicious mutation only on the p2p gossip topic &lt;code&gt;beacon_attestation_${subnet_id}&lt;&#x2F;code&gt;. Everywhere else, the &lt;code&gt;Attestation&lt;&#x2F;code&gt; message is wrapped with an outer signature that prevents mutation.&lt;&#x2F;p&gt;
&lt;p&gt;Gossip verification rules for the &lt;code&gt;beacon_attestation_${subnet_id}&lt;&#x2F;code&gt; topic include:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;[REJECT] The attester is a member of the committee -- i.e., &lt;code&gt;attestation.attester_index&lt;&#x2F;code&gt; in &lt;code&gt;get_beacon_committee(state, attestation.data.slot, index)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If an attacker mutates the &lt;code&gt;index&lt;&#x2F;code&gt; field, the above rule verification will fail, and the message will be dropped. If implementations run the above check before registering the attestation in a &#x27;first-seen&#x27; cache, there&#x27;s no risk of cache pollution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Inclusion lists</title>
        <published>2023-10-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>mike</name><uri>https://github.com/michaelneuder</uri>
	</author>
	
	<author>
		<name>Vitalik</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Francesco</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>Terence</name><uri>https://github.com/terencechain</uri>
	</author>
	
	<author>
		<name>potuz</name><uri>https://github.com/potuz</uri>
	</author>
	
	<author>
		<name>Manav</name><uri>https://github.com/manav2401</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7547/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7547-inclusion-lists/17474" />
        

        <id>https://wg-eips.ritovision.com/7547/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7547"
            label="EIP-7547" />
        

        
        

        
        <summary type="html">Add an inclusion list mechanism to allow forced transaction inclusion.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7547/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Censorship resistance is a core value proposition of blockchains. Inclusion lists aim to provide a mechanism to improve the censorship resistance of Ethereum by allowing proposers to specify a set of transactions that must be promptly included for subsequent blocks to be considered valid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Since the merge, validators have started outsourcing almost all block production to a specialized set of builders who compete to extract the most MEV (this is commonly referred to as Proposer-Builder Separation). As of October 2023, nearly 95% of blocks are built by builders rather than the proposer. While it is great that all proposers have access to competitive blocks through the &lt;code&gt;mev-boost&lt;&#x2F;code&gt; ecosystem, a major downside of externally built blocks is the fact that the builders ultimately decide what transactions to include or exclude. Without any forced transaction inclusion mechanism, the proposer is faced with a difficult choice: they either have no say on the transactions that get included, or they build the block locally (thus have the final say on transactions) and sacrifice some MEV rewards.&lt;&#x2F;p&gt;
&lt;p&gt;Inclusion lists aim to allow proposers to retain some authority by providing a mechanism by which transactions can be forcibly included. The simplest design is for the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer to specify a list of transactions that must be included in the block that is produced for their slot. However, this is not incentive-compatible because builders may choose to abstain from building blocks if the proposer sets some constraints on their behavior. This leads to the idea of &quot;forward&quot; inclusion lists, where the transactions specified by the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer are enforced in the &lt;code&gt;slot N+1&lt;&#x2F;code&gt; block. The naïve implementation of the forward inclusion lists presents a different issue of potentially exposing free data availability, which could be exploited to bloat the size of the chain without paying the requisite gas costs. The free data availability problem is solved with observations about nonce reuse and allowing multiple inclusion lists to be specified for each slot. With the incentive compatibility and free data availability problems addressed, we can more safely proceed with the implementation of inclusion lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_TRANSACTIONS_PER_INCLUSION_LIST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**4 = 16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_GAS_PER_INCLUSION_LIST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**21&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_SLOTS_FOR_INCLUSION_LIST_REQUEST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;reference-objects&quot;&gt;Reference Objects&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class InclusionListSummaryEntry(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address: ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit: uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class InclusionListSummary(Container)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    slot: Slot&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proposer_index: ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    summary: List[InclusionListSummaryEntry, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class SignedInclusionListSummary(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    message: InclusionListSummary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature: BLSSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class InclusionList(Container)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    summary: SignedInclusionListSummary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions: List[Transaction, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class ExecutionPayload(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_summary: List[InclusionListSummaryEntry, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_exclusions: List[uint64, MAX_TRANSACTIONS_PER_INCLUSION_LIST]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class ExecutionPayloadHeader(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_summary_root: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_exclusions_root: Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;class BeaconBlockBody(Container):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    inclusion_list_summary: SignedInclusionListSummary&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;high-level-overview&quot;&gt;High-level overview&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;slot N&lt;&#x2F;code&gt; proposal:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Proposer broadcasts a signed block and an inclusion list (summary and transactions objects) for &lt;code&gt;slot N+1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Transactions will be included in &lt;code&gt;slot N&lt;&#x2F;code&gt; or &lt;code&gt;slot N+1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Summaries include the originating address of the transactions and their respective gas limits.&lt;&#x2F;li&gt;
&lt;li&gt;Summaries are signed, but transactions are not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;slot N&lt;&#x2F;code&gt; validation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validators only consider the block for validation and fork-choice if they have seen at least one inclusion list for that slot.&lt;&#x2F;li&gt;
&lt;li&gt;They consider the block invalid if the inclusion list transactions are not executable at the start of &lt;code&gt;slot N&lt;&#x2F;code&gt; or if the transactions&#x27; &lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt; are not at least 12.5% higher than the current slot (to ensure the transactions will be valid in &lt;code&gt;slot N+1&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;slot N+1&lt;&#x2F;code&gt; validation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The proposer for &lt;code&gt;slot N+1&lt;&#x2F;code&gt; builds their block along with a signed summary from the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer.&lt;&#x2F;li&gt;
&lt;li&gt;The payload includes a list of transaction indices from the &lt;code&gt;slot N&lt;&#x2F;code&gt; payload that satisfy some entry in the signed inclusion list summary.&lt;&#x2F;li&gt;
&lt;li&gt;The payload is considered valid if: (a) the execution conditions are met, including satisfying the inclusion list summary and being executable from the execution layer perspective, and (b) the consensus conditions are met with a proposer signature of the previous block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;specific-changes&quot;&gt;Specific Changes&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Beacon chain state transition spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;inclusion_list&lt;&#x2F;code&gt; object:&lt;&#x2F;em&gt; Introduce a new &lt;code&gt;inclusion_list&lt;&#x2F;code&gt; for the proposer to submit and nodes to process.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; and &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; objects:&lt;&#x2F;em&gt; Update these objects to meet the inclusion list requirements.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Modified to cache the inclusion list summary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;process_execution_payload&lt;&#x2F;code&gt; function:&lt;&#x2F;em&gt; Update this process to include checks for the inclusion list summary satisfaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Beacon chain fork-choice spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;is_inclusion_list_available&lt;&#x2F;code&gt; check:&lt;&#x2F;em&gt; Introduce a new check to determine if the inclusion list is available within the visibility window.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; notification action:&lt;&#x2F;em&gt; Implement a new call to notify the Execution Layer (EL) client about a new inclusion list. The corresponding block is considered invalid if the EL client deems the inclusion list invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Beacon chain P2P spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; gossipnet and validation rules for inclusion list:&lt;&#x2F;em&gt; Define new rules for handling the inclusion list in the gossip network and validation.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; RPC request and response network for inclusion list:&lt;&#x2F;em&gt; Establish a new network for sending and receiving inclusion lists.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Validator spec:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; duty for &lt;code&gt;inclusion_list&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Proposer to prepare and sign the inclusion list.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; duty for &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Update the duty to prepare the beacon block body to include the &lt;code&gt;inclusion_list_summary&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;get_inclusion_list&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Introduce a new function for proposers to retrieve inclusion lists.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; &lt;code&gt;new_inclusion_list&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Define a new function for nodes to validate the execution side of the inclusion list.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;forkchoice_updated&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Update the function with a &lt;code&gt;payload_attribute&lt;&#x2F;code&gt; to include the inclusion list summary as part of the attribute.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Modified&lt;&#x2F;strong&gt; &lt;code&gt;new_payload&lt;&#x2F;code&gt;:&lt;&#x2F;em&gt; Update the function for EL clients to verify that &lt;code&gt;payload_transactions&lt;&#x2F;code&gt; satisfy &lt;code&gt;payload.inclusion_list_summary&lt;&#x2F;code&gt; and &lt;code&gt;payload.inclusion_list_exclusions&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;New&lt;&#x2F;strong&gt; validation rules:&lt;&#x2F;em&gt; Implement new validation rules based on the changes introduced in the Execution-API spec.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We consider a few design decisions present in this EIP.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ReducedSummary&lt;&#x2F;code&gt; versus &lt;code&gt;Summary&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The original proposal tries to improve data efficiency by using a &lt;code&gt;ReducedSummary&lt;&#x2F;code&gt; and a &lt;code&gt;Rebuilder&lt;&#x2F;code&gt;. This allows the full summary to be reconstructed.&lt;&#x2F;li&gt;
&lt;li&gt;This adds a lot of complexity to the spec, so in this initial version, we should consider just using the regular &lt;code&gt;Summary&lt;&#x2F;code&gt; and including that in the subsequent block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Gas limit vs no limit.
&lt;ul&gt;
&lt;li&gt;One consideration is whether the inclusion list should have a gas limit or use the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;Having a separate gas limit simplifies complexity but opens up the possibility for validators to outsource their inclusion list construction for side payments (e.g., if a block is full, the proposer could auction off space in the inclusion list for guaranteed inclusion in the subsequent block).&lt;&#x2F;li&gt;
&lt;li&gt;Alternatively, inclusion lists could be part of the block gas limit and only satisfied if the block gas limit is not full. However, this could lead to situations where the next block proposer intentionally fills up the block to ignore the inclusion list, albeit at the potential expense of paying to waste the gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Inclusion list ordering.
&lt;ul&gt;
&lt;li&gt;We assume that the inclusion list is processed at the top of the &lt;code&gt;slot N&lt;&#x2F;code&gt; block. Transactions in the inclusion list are evaluated for the pre-state of &lt;code&gt;slot N&lt;&#x2F;code&gt; but are only guaranteed to be included in &lt;code&gt;slot N+1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Inclusion list transaction exclusion.
&lt;ul&gt;
&lt;li&gt;Inclusion list transactions proposed at &lt;code&gt;slot N&lt;&#x2F;code&gt; may be satisfied in the same slot (e.g., by being included in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;). This is a side effect of validators using &lt;code&gt;mev-boost&lt;&#x2F;code&gt; because they don’t know the contents of the block they propose.&lt;&#x2F;li&gt;
&lt;li&gt;Due to this, there exists an exclusion field, a node looks at each transaction in the payload’s &lt;code&gt;inclusion_list_exclusion&lt;&#x2F;code&gt; field and makes sure it matches with a transaction in the current inclusion list. When there’s a match, we remove that transaction from the inclusion list summary.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mev-boost&lt;&#x2F;code&gt; compatibility.
&lt;ul&gt;
&lt;li&gt;There are no significant changes to &lt;code&gt;mev-boost&lt;&#x2F;code&gt;. Like any other hard fork, &lt;code&gt;mev-boost&lt;&#x2F;code&gt;, relays, and builders must adjust their beacon nodes.&lt;&#x2F;li&gt;
&lt;li&gt;Builders must know that execution payloads that don’t satisfy the inclusion list summary will be invalid.&lt;&#x2F;li&gt;
&lt;li&gt;Relays may have additional duties to verify such constraints before passing them to validators for signing.&lt;&#x2F;li&gt;
&lt;li&gt;When receiving the header, validators can check that the &lt;code&gt;inclusion_list_summary_root&lt;&#x2F;code&gt; matches their local version and skip building a block if there’s a mismatch, using the local block instead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Syncing using by range or by root.
&lt;ul&gt;
&lt;li&gt;To consider a block valid, a node syncing to the latest head must also have an inclusion list.&lt;&#x2F;li&gt;
&lt;li&gt;A block without an inclusion list cannot be processed during syncing.&lt;&#x2F;li&gt;
&lt;li&gt;To address this, there is a parameter called &lt;code&gt;MIN_SLOTS_FOR_INCLUSION_LIST_REQUEST&lt;&#x2F;code&gt;. A node can skip inclusion list checks if the block’s slot plus this parameter is lower than the current slot.&lt;&#x2F;li&gt;
&lt;li&gt;This is similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, where a node skips blob sidecar data availability checks if it’s outside the retention window.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork. These changes do not break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The main potential issue is around the incentivization of the inclusion lists. If the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer constructs an inclusion list that negatively impacts the rewards of the &lt;code&gt;slot N+1&lt;&#x2F;code&gt; proposer, the &lt;code&gt;slot N+1&lt;&#x2F;code&gt; proposer may attempt to bribe the &lt;code&gt;slot N&lt;&#x2F;code&gt; proposer to publish an empty list. This isn&#x27;t a direct attack on the protocol, but rather a profit-sharing mechanism by which the inclusion list would go unutilized. It seems likely these commitment games could be played no matter the censorship resistance scheme in place, but this remains an active area of research.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM arbitrary precision decimal math</title>
        <published>2023-10-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>1m1</name><uri>https://github.com/1m1-github</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7543/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/decimal-math-on-evm/16194" />
        

        <id>https://wg-eips.ritovision.com/7543/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7543"
            label="EIP-7543" />
        

        
        

        
        <summary type="html">This EIP adds OPCODEs to allow arbitrary precision decimal float calculation of all elementary functions with precise gas enumeration.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7543/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds &lt;em&gt;arbitrary precision decimal float&lt;&#x2F;em&gt; OPCODEs for arithmetic via DECADD, DECNEG, DECMUL, DECINV and expression of all elementary functions via DECEXP, DECLN, DECSIN. All decimal values upto the maximal precision allowed by a int256 coefficient and exponent are represented exactly, as c*10^q. All implemented algorithms converge for all inputs given enough precision, as chosen by the user. All calculations are deterministic and gas is precisely embedded bottom-up. Allowing arbitrary precision decimal elementary functions invites the worlds of mathematical finance, machine learning, science, digital art, games and others to Ethereum. The implementation is functional.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, to take a power, a^b, of non integer values, requires vast amounts of Solidity code.
The simplest task in trading e.g. is to convert volatilities from yearly to daily, which involves taking the 16th root.&lt;&#x2F;p&gt;
&lt;p&gt;Giving users&#x2F;devs the same ability that scientific calculators have allows for the creation of apps with higher complexity.&lt;&#x2F;p&gt;
&lt;p&gt;The files &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7543&#x2F;.&#x2F;assets&#x2F;BlackScholes.yul&quot;&gt;BlackScholes.yul&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7543&#x2F;.&#x2F;assets&#x2F;Neuron.yul&quot;&gt;Neuron.yul&lt;&#x2F;a&gt; demonstrate how these OPCODEs simplify numerical smart contract code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-decimal&quot;&gt;Why decimal?&lt;&#x2F;h3&gt;
&lt;p&gt;To represent a simple value like 0.1 in binary requires infinite many digits and is therefore not exactly represently in a finite binary machine. Decimal types are much closer to the vast majority of numerical calculations run by humans.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm&quot;&gt;eVm&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM is a virtual machine and thereby not restricted by hardware. Usually, assembly languages provide OPCODES that are mimic the ability of hardware. In a virtual machine, we have no such limitations and nothing stops us from adding more complex OPCODEs, as long as fair gas is provided. At the same time, we do not want to clutter the OPCODEs library. EXP, LN and SIN are universal functions that open the path to: powers, trigonometry, integrals, differential equations, machine learning, digital art, etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;decimal&quot;&gt;Decimal&lt;&#x2F;h3&gt;
&lt;p&gt;A decimal is defined as&lt;&#x2F;p&gt;
&lt;p&gt;c * 10^q&lt;&#x2F;p&gt;
&lt;p&gt;where c and q are int256.&lt;&#x2F;p&gt;
&lt;p&gt;Notationwise:
a = ac * 10^aq
b = bc * 10^bq
etc.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-defs&quot;&gt;OPCODE defs&lt;&#x2F;h3&gt;
&lt;p&gt;0xd0 DECADD a+b -&amp;gt; c    : (ac, aq, bc, bq, precision) -&amp;gt; (cc, cq)
0xd1 DECNEG  -a -&amp;gt; b    : (ac, aq) -&amp;gt; (bc, bq)
0xd2 DECMUL a*b -&amp;gt; c    : (ac, aq, bc, bq, precision) -&amp;gt; (cc, cq)
0xd3 DECINV 1&#x2F;a -&amp;gt; b    : (ac, aq, precision) -&amp;gt; (bc, bq)
0xd4 DECEXP exp(a) -&amp;gt; b : (ac, aq, precision, steps) -&amp;gt; (bc, bq)
0xd5 DECLN   ln(a) -&amp;gt; b : (ac, aq, precision, steps) -&amp;gt; (bc, bq)
0xd6 DECSIN sin(a) -&amp;gt; b : (ac, aq, precision, steps) -&amp;gt; (bc, bq)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;precision&lt;&#x2F;code&gt; is the # of digits kept during all calculations. &lt;code&gt;steps&lt;&#x2F;code&gt; for DECEXP and DECSIN are the # of Taylor expansion steps. &lt;code&gt;steps&lt;&#x2F;code&gt; for DECLN is the depth of the continued fractions expansion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-these-functions&quot;&gt;Why these functions?&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed functions (+,-,*,&#x2F;,exp,ln,sin) form a small set that combined enable all calculation of all elementary functions, which includes the sets of sums, products, roots and compositions of finitely many polynomial, rational, trigonometric, hyperbolic, and exponential functions, including their inverse functions.&lt;&#x2F;p&gt;
&lt;p&gt;a^b = exp(b * ln(a)) gives us powers and polynomials.
cos(a) = sin(tau&#x2F;4-a), tan(a)=sin(a)&#x2F;cos(a), etc., gives us all of trigonometry.&lt;&#x2F;p&gt;
&lt;p&gt;Together with arithmetic, we get all elementary functions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decneg-instead-of-decsub&quot;&gt;DECNEG instead of DECSUB&lt;&#x2F;h3&gt;
&lt;p&gt;Negation is a more general operation vs subtraction. OPCODEs should be as fundamental as possible and as complex as desirable.
For the same reason, we have DECINV instead of DECDIV.&lt;&#x2F;p&gt;
&lt;p&gt;DECSUB(a,b) = DECADD(a,DECNEG(b))
DECDIV(a,b) = DECMUL(a,DECINV(b))&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decexp-decsin-via-taylor-series&quot;&gt;DECEXP, DECSIN via Taylor series&lt;&#x2F;h3&gt;
&lt;p&gt;The Taylor series of exp and sin converge everywhere and fast. The error falls as fast as the factorial of steps.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;decln-via-continued-fractions&quot;&gt;DECLN via continued fractions&lt;&#x2F;h3&gt;
&lt;p&gt;Ln converges fast using continued fractions within the interval ]0,2]. The implementation scales the input into this interval and scales the result back correctly.&lt;&#x2F;p&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas&quot;&gt;gas&lt;&#x2F;h3&gt;
&lt;p&gt;All the above OPCODEs are deterministic, hence the gas cost can be determined. At the same time, the calculations are complex and depend on the input.&lt;&#x2F;p&gt;
&lt;p&gt;It is crucial to have accurate gas costs to avoid energy attacks on nodes.&lt;&#x2F;p&gt;
&lt;p&gt;To this end, the underlying uint256 lib can be wrapped with gas accumulation, as found in the reference implementation in ..&#x2F;assets&#x2F;eip-EVM+&#x2F;uint256_wrapped.go. This gives a bottom-up approach to calculating gas, by running the OPCODE.&lt;&#x2F;p&gt;
&lt;p&gt;Because the EVM interprator expects the gas cost before actually running the OPCODE, we are running the OPCODE twice. the first run, identical to the second, is to get the bottom-up gas cost, which is then doubled to account for the actual run plus the gas calculation. On top, we add a fixed emulation cost.&lt;&#x2F;p&gt;
&lt;p&gt;This gives an embedded gas calculation, which works well for complex OPCODEs (see gasEVMPlusEmulate in ..&#x2F;assets&#x2F;eip-EVM+&#x2F;gasEVMPlusEmulate.go).&lt;&#x2F;p&gt;
&lt;p&gt;To remove the double gas, we could find an upper bound on gas usage dependent on the function inputs.
Alternatively, a future EIP would suggest the following: allow contract code to run whilst accumulating gas (at runtime) and panicking in case of limit breach, without requiring the cost in advance. This only works for contract code that is pure, defined as code that only depends on the user input and the inner bytecode of the contract. Pure contracts cannot use state from the chain, nor make calls to other contracts. pure mathematical functions would e.g. be pure contracts. pure contracts are fully deterministic given the input, allowing a user to estimate gas costs offline (cheaper) and the EVM to panic at runtime, without knowing gas in advance.&lt;&#x2F;p&gt;
&lt;p&gt;Since the costs depend on the input, a fuzzing would give us close to the worst cases (TODO).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;p&gt;Since the EVM allows contracts to deploy with invalid code, there could be previously invalid code that becomes valid when adding a new OPCODE. The EVM could be designed to expect a version tag at the beginning of all bytecode or (not xor) to only deploy valid code. This is an issue for any new OPCODE.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;..&#x2F;assets&#x2F;eip-EVM+&#x2F;decimal_float_test.go&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation is found in ..&#x2F;assets&#x2F;eip-EVM+&#x2F;decimal_float.go&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no security considerations, as long as numerical correctness is guaranteed and gas is collected fairly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verkle proof verification precompile</title>
        <published>2023-10-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Diederik Loerakker</name><uri>https://github.com/protolambda</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7545/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/verkle-proof-verification-precompile/16274" />
        

        <id>https://wg-eips.ritovision.com/7545/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7545"
            label="EIP-7545" />
        

        
        

        
        <summary type="html">Add a precompile to help dapps verify verkle proofs</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7545/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes the addition of a precompiled contract to provide up-to-date state proof verification capabilities to smart contracts in a stateless Ethereum context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed proof systems for stateless Ethereum require an upgrade to many tools and applications, that need a simple path to keep their proving systems up-to-date, without having to develop and deploy new proving libraries each time another proof format must be supported.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;A precompiled contract is added at address &lt;code&gt;0x21&lt;&#x2F;code&gt;, wrapping the stateless ethereum proof verification function.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile&#x27;s &lt;code&gt;input&lt;&#x2F;code&gt; is the tightly packed concatenation of the following fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; (1 byte) specifies which version of the stateless proof verification function should be used. Version 0 is used for an MPT and version 1 is used for the polynomial commitment scheme multiproof used in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;state_root&lt;&#x2F;code&gt; (32 bytes) specifies the state root that the proof is proving against.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proof_data&lt;&#x2F;code&gt; (arbitrary long) is the proof data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Pseudo-code behavior of the precompile:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; proof_verification_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;33&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;33&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;33&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;proof_data_size&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deserialize_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; verify_mpt_multiproof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; version&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deserialize_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; verify_pcs_multiproof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;version&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt; then the proof is expected to follow the SSZ format described in &quot;the verge&quot; proposal in the consensus spec.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile returns &lt;code&gt;1&lt;&#x2F;code&gt; if it was able to verify the proof, and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant name&lt;&#x2F;th&gt;&lt;th&gt;cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POINT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POLY_EVAL_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The precompile cost is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;cost = (POINT_COST + 1)*len(get_commitments(input)) + POLY_EVAL_COST * [leaf_depth(key, get_tree(input)) for key in get_keys(input))]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_commitments&lt;&#x2F;code&gt; extracts the list of commitments in the proof, as encoded in &lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;get_keys&lt;&#x2F;code&gt; extracts the list of keys in the proof, as encoded in &lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;leaf_depth&lt;&#x2F;code&gt; returns the depth of the leaf in the tree&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;get tree&lt;&#x2F;code&gt; reconstruct a stateless view of the tree from &lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Stateless Ethereum relies on proofs using advanced mathematical concepts and tools from a fast-moving area of cryptography. As a result, a soft-fork approach is currently favored in the choice of the proof format: proofs are going to be distributed outside of consensus, and in the future, stateless clients will be able to chose their favorite proof format.&lt;&#x2F;p&gt;
&lt;p&gt;This introduces a burden on several application, e.g. bridges, as they will potentially need to support proof formats designed after the release of the bridge contract.&lt;&#x2F;p&gt;
&lt;p&gt;Delegating the proof verification burden to a version-aware precompile will ensure that these applications can support newer proving primitives without having to upgrade their contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;WIP&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;First implementation in Optimism, pull request #192 of ethereum-optimism&#x2F;op-geth by @protolambda&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block-level Warming with fair cost savings</title>
        <published>2023-10-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Yoav Weiss</name><uri>https://github.com/yoavw</uri>
	</author>
	
	<author>
		<name>Alex Forshtat</name><uri>https://github.com/forshtat</uri>
	</author>
	
	<author>
		<name>Dror Tirosh</name><uri>https://github.com/drortirosh</uri>
	</author>
	
	<author>
		<name>Shahaf Nacson</name><uri>https://github.com/shahafn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7557/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7557-block-level-warming/16642" />
        

        <id>https://wg-eips.ritovision.com/7557/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7557"
            label="EIP-7557" />
        

        
        

        
        <summary type="html">Block-level warming of addresses and slots with access lists</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7557/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism for a fair distribution of the gas costs associated with access to addresses and storage slots
among multiple transactions with shared items in their &lt;code&gt;accessList&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929: Gas cost increases for state access opcodes&lt;&#x2F;a&gt; introduced a new gas cost model that differentiates
between &quot;cold&quot; and &quot;warm&quot; access to accounts and storage slots.&lt;&#x2F;p&gt;
&lt;p&gt;However, the cost of every cold access is borne by each transaction separately, even though the validator only
needs to fetch the state object once for the entire block.&lt;&#x2F;p&gt;
&lt;p&gt;When multiple transactions access the same state object in the same block the fees charged for these transactions
do not accurately reflect the computations that block builders and validators perform for the blockchain state access
during transaction execution.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930: Optional access lists&lt;&#x2F;a&gt; made it possible for transactions to pre-specify and pre-pay for the
accounts and storage slots that the transaction plans to access,
however, the cost is still paid repeatedly by each transaction rather than once at the block level.&lt;&#x2F;p&gt;
&lt;p&gt;With the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800: Ethereum state using a unified verkle tree&lt;&#x2F;a&gt; on the roadmap for inclusion,
the cost of reading from the Ethereum state and especially the contract code is expected to increase.&lt;&#x2F;p&gt;
&lt;p&gt;Especially affected by this upcoming change will be transactions that involve smart contracts with a high code size.&lt;&#x2F;p&gt;
&lt;p&gt;Each such transaction in the block will be forced to pay the full &quot;retail&quot; price for loading smart contract
bytecode during a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The validators, however, only have to perform the actual reading from the Ethereum state once per block,
and all subsequent reads of the values that were already referenced are significantly more efficient.&lt;&#x2F;p&gt;
&lt;p&gt;If witnesses are introduced to Ethereum blocks, the same witness can be reused by multiple transactions.
Requiring each transaction to pay regardless of the contents of the block is unfair and inefficient.&lt;&#x2F;p&gt;
&lt;p&gt;Another change that may be on the roadmap for Ethereum is Account Abstraction.
This change will see a large share of transactions being initiated by smart contracts directly.
It is reasonable to expect many of these Smart Contract Accounts to rely on the same core wallet implementations.
If each Account Abstraction transaction is charged a full gas cost of loading the Smart Contract Account code repeatedly,
such transactions would become significantly overpriced.&lt;&#x2F;p&gt;
&lt;p&gt;This difference is especially noticeable when compared to an EOA, which gets its validation logic loaded and executed for free.&lt;&#x2F;p&gt;
&lt;p&gt;In this scenario, the base gas fees would be taken from the senders and burned needlessly while block proposers
would be enjoying an unjustified excessive earning of priority gas fees.&lt;&#x2F;p&gt;
&lt;p&gt;A major distinction between this proposal and alternatives, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7863&#x2F;&quot;&gt;EIP-7863&lt;&#x2F;a&gt;, lies in performing a fair
distribution of gas savings between all participants - all transactions senders and the block builder.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930: Optional access lists&lt;&#x2F;a&gt; already introduced the first part of the solution.
Each transaction can specify an array of &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; to announce its intention to
read those values during the execution of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The sender of the transaction is then pre-charged with the cost of accessing this data but is given a small discount
compared to unannounced access.&lt;&#x2F;p&gt;
&lt;p&gt;The missing component is a mechanism to aggregate the gas costs of the cold access and redistribute the resulting
savings amongst the participating transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;During the transaction execution, the cost of all storage-related operations is not affected,
and all rules from EIP-2929 and EIP-2930 continue to apply.&lt;&#x2F;p&gt;
&lt;p&gt;There are no changes to the block header or the transaction payload and receipt.&lt;&#x2F;p&gt;
&lt;p&gt;As the last operation of each block, the collected gas costs associated with storage access are redistributed
among the senders of all transactions withing a block.
This affects the balances of all these accounts in a way that only becomes observable in the next block.&lt;&#x2F;p&gt;
&lt;p&gt;This reimbursement&#x27;s amount is proportional to the amount paid for the access in the first place.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;participant-transactions-mapping&quot;&gt;Participant transactions mapping&lt;&#x2F;h3&gt;
&lt;p&gt;After the block builder finalizes the contents of the block, it iterates over all included transactions to read
the &lt;code&gt;accessList&lt;&#x2F;code&gt; component of each supported transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The block builder then constructs an array containing each accessed address and each accessed slot, and an array of
transaction senders&#x27; addresses that initiated at least one access to the given address or slot,
as well as the &lt;code&gt;priorityFeePerGas&lt;&#x2F;code&gt; that was paid for such access.&lt;&#x2F;p&gt;
&lt;p&gt;A sample JSON representation of the data structure that represents such a structure and is used in the pseudocode below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;slots&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000003&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;id&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000007&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;            &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;calculating-a-reimbursement-of-the-burned-base-fee&quot;&gt;Calculating a reimbursement of the burned base fee&lt;&#x2F;h3&gt;
&lt;p&gt;Considering that the same amount of computation is needed to access an address or a slot regardless of the number of
transactions using one, it is reasonable for the protocol to only burn the gas cost of the cold access once.
As all transactions in the same block pay exactly the same &lt;code&gt;baseFeePerGas&lt;&#x2F;code&gt;, the single cost of accessing a cold item is
divided evenly among all transactions containing such access and the rest of the burned base fee is reimbursed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setting-an-absolute-minimal-cost-of-cold-state-access&quot;&gt;Setting an absolute minimal cost of cold state access&lt;&#x2F;h3&gt;
&lt;p&gt;If a large number of transactions all access the same addresses or slots, the cost of each cold access may get
way too low which may represent a potential DoS attack vector.&lt;&#x2F;p&gt;
&lt;p&gt;In order to prevent that, the gas cost of including an entity in the access list cannot be lower
than &lt;code&gt;MIN_ACCESS_LIST_ENTRY_COST&lt;&#x2F;code&gt;, which is set to &lt;code&gt;32 gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This value is equivalent to the calldata cost of including two bytes long identifier of entries in &lt;code&gt;block_access_list&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calculating-a-reimbursement-of-the-charged-priority-fee&quot;&gt;Calculating a reimbursement of the charged priority fee&lt;&#x2F;h3&gt;
&lt;p&gt;Each transaction pays an individual &lt;code&gt;priorityFeePerGas&lt;&#x2F;code&gt; value and redistributing this part of the cold access cost
is more complex.&lt;&#x2F;p&gt;
&lt;p&gt;We propose the following approach to a fair reimbursement of the paid &lt;code&gt;priorityFee&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The validator gets paid the &lt;code&gt;priorityFee&lt;&#x2F;code&gt; for each cold access only once, but according to the highest &lt;code&gt;priorityFee&lt;&#x2F;code&gt;
among the transactions containing the said cold access.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The rest of the Ether that was charged by the validator as a  &lt;code&gt;priorityFee&lt;&#x2F;code&gt; is redistributed back to all the senders
of transactions containing the same cold access in proportion to their &lt;strong&gt;marginal contribution&lt;&#x2F;strong&gt; to the
&lt;strong&gt;total gains&lt;&#x2F;strong&gt; of the transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The block builder is only paid for access once and the remaining value is reimbursed.
So the &lt;code&gt;total reimbursement&lt;&#x2F;code&gt; value is a difference between the sum of value charged and the block builder&#x27;s reward.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;total gains&lt;&#x2F;code&gt; of the transaction is defined by a sum of the &lt;code&gt;priorityFee&lt;&#x2F;code&gt; paid out to the block builder
and &lt;code&gt;total reimbursement&lt;&#x2F;code&gt; made to all participants.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Mathematically, the &lt;code&gt;marginal contribution&lt;&#x2F;code&gt; of a transaction to the &lt;code&gt;total gains&lt;&#x2F;code&gt; is defined as
the difference between the sum &lt;code&gt;total gains&lt;&#x2F;code&gt; value calculated when all transactions in a block are included,
and when all transactions are included except for this particular transaction.
In practice this value always amounts to &lt;code&gt;priorityFee * gasCost&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;𝑀𝐶𝑖 = 𝑣(𝑆 ∪ {𝑖}) − 𝑣(𝑆)&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A single transaction accessing an address or a slot that is not shared by other transactions does not trigger a reimbursement,
and therefore has a zero marginal contribution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficiently-storing-the-access-lists-in-the-block-history&quot;&gt;Efficiently storing the access lists in the block history&lt;&#x2F;h3&gt;
&lt;p&gt;The contents of the &lt;code&gt;accessList&lt;&#x2F;code&gt; parameter are part of the Ethereum history and the potential cost of keeping this
data in the blockchain must be accounted for when implementing this change.
There is currently no additional charge applied to the &lt;code&gt;accessList&lt;&#x2F;code&gt; parameter, due to the cost of including
an address or a storage slot in the &lt;code&gt;accessList&lt;&#x2F;code&gt; being a constant value that is significantly higher than the
potential cost of storing the &lt;code&gt;accessList&lt;&#x2F;code&gt; at the cost of  a
dynamically sized &lt;code&gt;calldata&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;With the block-level warming there is a change that makes it possible for a transaction sender to construct
transactions with a large &lt;code&gt;accessList&lt;&#x2F;code&gt; that cost very little to be included, and this can be used to bloat the
blockchain size.&lt;&#x2F;p&gt;
&lt;p&gt;This potential bloating of the block size also presents a challenge for the propagation of the block in a P2P network.&lt;&#x2F;p&gt;
&lt;p&gt;In order to minimize the cost of permanently storing access lists, we propose the following changes to
the &lt;code&gt;execution_payload&lt;&#x2F;code&gt; structure:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add a new &lt;code&gt;block_access_list&lt;&#x2F;code&gt; field.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The execution clients create a combined block-level &quot;access list&quot; that contains all unique entries from all
transactions in the block.
2. All individual transaction &lt;code&gt;accessList&lt;&#x2F;code&gt; fields replace the full entries with a
compact 2 bytes long reference to the &lt;code&gt;block_access_list&lt;&#x2F;code&gt; in the same order they appeared originally.&lt;&#x2F;p&gt;
&lt;p&gt;With this approach shared entries in the access lists cannot cause sufficient bloating of the block size.&lt;&#x2F;p&gt;
&lt;p&gt;There is no need to introduce any observable changes to the RPC API as this &quot;compression&quot; can be unwrapped by the
clients in real time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pseudocode-implementation-of-the-reimbursement-calculation-algorithm&quot;&gt;Pseudocode implementation of the reimbursement calculation algorithm&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateBlockColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  baseFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  accessDetailsMap&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AddressAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reimbursement&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; accessDetail&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessDetailsMap&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    calculateItemColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessDetail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; baseFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; of&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessDetail&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;slots&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;      calculateItemColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;slot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessors&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; baseFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; COLD_SLOAD_COST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculateItemColdAccessReimbursement&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  unsortedAccessors&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  baseFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  accessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;  reimbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Map&lt;&#x2F;span&gt;&lt;span&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Reimbursement&lt;&#x2F;span&gt;&lt;span&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; unsortedAccessors&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sort&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; =&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; addressAccessN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementPercent&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addressAccessN&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addressAccessN&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculatePriorityFeeReimbursements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; accessor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt; reimbursementFromBurn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; reimbursementFromCoinbase&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; adjustedAccessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;MIN_ACCESS_LIST_ENTRY_COST&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementPercent&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromBurn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;adjustedAccessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;baseFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BigInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;export&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculatePriorityFeeReimbursements&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessDetails&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; accessGasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validator charge is based on the highest paid priority fee per gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; validatorFee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accumulate the sum of all &amp;quot;contributions&amp;quot;, at least the top transaction contribution&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalContributions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validatorFee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Accumulate cost of gas paid to validator for accessing the same address&#x2F;slot&#x2F;chunk&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalSendersCharged&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Starting with `1` as element at `0` is explicitly shown here to be used as `validatorFee`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    totalContributions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    totalSendersCharged&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate the total amount of ether to be reimbursed for this access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalSendersCharged&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; validatorFee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; possible if only single transaction or if all priority fees are 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Array&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fill&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Calculate actual charges and reimbursements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; topTransactionContribution&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalContributions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessGasCost&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; calldataCharge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parseInt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedAccesses&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;priorityFeePerGas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; MIN_ACCESS_LIST_ENTRY_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementToCalldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; calldataCharge&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementToContribution&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;floor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;totalReimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; charge&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; totalContributions&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;Math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementToCalldata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementToContribution&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that two accumulating values, &lt;code&gt;reimbursementFromBurn&lt;&#x2F;code&gt; and &lt;code&gt;reimbursementFromCoinbase&lt;&#x2F;code&gt;,
are necessary in light of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559: Fee market change for ETH 1.0 chain&lt;&#x2F;a&gt; in order to differentiate
between the Ether reimbursement that is originating from a reduced block gas burn,
and from the reduced block proposer priority fee per gas reward.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-eip-6800-gas-reform-support&quot;&gt;Future EIP-6800 gas reform support&lt;&#x2F;h3&gt;
&lt;p&gt;Once &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; is active, the cost of accessing a contract code for a cold address is expected to change.&lt;&#x2F;p&gt;
&lt;p&gt;Instead of being a constant value of &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; (currently 2600 gas),
the total cost will be determined by the number of 31-byte &quot;chunks&quot; the code consists of.
Each &quot;chunk&quot; of code will have a cost of &lt;code&gt;CODE_CHUNK_ACCESS_COST&lt;&#x2F;code&gt; (currently 200 gas).&lt;&#x2F;p&gt;
&lt;p&gt;For a maximum contract size of &lt;code&gt;24576 bytes&lt;&#x2F;code&gt; defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; the cost of accessing this contract
surges from &lt;code&gt;2600&lt;&#x2F;code&gt; to &lt;code&gt;158600&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;This change will likely require the &lt;code&gt;accessList&lt;&#x2F;code&gt; parameter of transactions to be adjusted for transactions
to be able to specify which code chunks will be accessed.&lt;&#x2F;p&gt;
&lt;p&gt;In such case the changes are reflected in the reimbursement function as well, which is updated by adding the following code
in order to redistribute the shared cost of accessing the same code chunk in multiple transactions:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculatePriorityFeeReimbursements&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sortedCodeChunkAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; CHUNK_ACCESS_COST&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; sortedAccessDetails&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; reimbursement&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursements&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;accessor&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromBurn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; CHUNK_ACCESS_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;baseFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementPercent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  reimbursement&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reimbursementFromCoinbase&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; reimbursementsFromCoinbase&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;cost-redistribution-system-operation&quot;&gt;Cost redistribution system operation&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4895&#x2F;&quot;&gt;EIP-4895: Beacon chain push withdrawals as operations&lt;&#x2F;a&gt; sets a precedent by introducing a concept of a &lt;code&gt;system-level withdrawal operation&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We propose the introduction of yet another system-level operation called &lt;code&gt;cost redistribution&lt;&#x2F;code&gt;.
The &lt;code&gt;redistributions&lt;&#x2F;code&gt; in an execution payload are processed after any user-level transactions are applied.&lt;&#x2F;p&gt;
&lt;p&gt;The block builder or a validator prepares a list of reimbursement information.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;redistribution&lt;&#x2F;code&gt; in the list, the implementation increases the balance of the address specified by the amount &lt;code&gt;reimbursementFromBurn + reimbursementFromCoinbase&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The balance of the &lt;code&gt;coinbase&lt;&#x2F;code&gt; is reduced by a sum of all &lt;code&gt;reimbursementFromCoinbase&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;current-cold-storage-gas-cost-is-unfair&quot;&gt;Current cold storage gas cost is unfair&lt;&#x2F;h3&gt;
&lt;p&gt;As described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7557&#x2F;#motivation&quot;&gt;Motivation&lt;&#x2F;a&gt; section, the amount of gas that users spend on accessing the contract code does not reflect the actual cost of this access for the block builder or a validator.&lt;&#x2F;p&gt;
&lt;p&gt;The more popular the contract code or a storage slot is, the more transactions in each block should share the cost.
However, the current system multiplies the cost for the users instead of dividing it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;issuing-a-regular-gas-refund-after-a-transaction-is-not-possible&quot;&gt;Issuing a regular gas refund after a transaction is not possible&lt;&#x2F;h3&gt;
&lt;p&gt;There exists a list of EVM instructions that trigger both a gas charge and a gas refund.
A notable example of such operations is the &lt;code&gt;0x55 SSTORE&lt;&#x2F;code&gt; opcode as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283: Net gas metering for SSTORE without dirty maps&lt;&#x2F;a&gt;.
Intuitively it seems reasonable to issue the gas reimbursements for the shared cold storage access in the same fashion.&lt;&#x2F;p&gt;
&lt;p&gt;However, this approach significantly complicates the block-building process.
In this case, the inclusion or exclusion of a transaction at the end of the block triggers observable effects in transactions included at the beginning of the block, and this makes the job of finding a valid set of transactions for a block potentially computationally unsolvable.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, we propose performing the reimbursements at the end of the block, where it cannot change the behavior of any transaction in the block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;weighting-priority-fee-reimbursement&quot;&gt;Weighting priority fee reimbursement&lt;&#x2F;h3&gt;
&lt;p&gt;A common game-theoretical answer to the problem of calculating a fair redistribution of the payoff of the
results of the participants&#x27; cooperation is the use of Shapley values.&lt;&#x2F;p&gt;
&lt;p&gt;However, we argue that the proposed distribution of the &lt;code&gt;priorityFee&lt;&#x2F;code&gt; reimbursements is sufficiently fair while being
a lot easier to compute or articulate.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal does not introduce a change to any behavior that can be observed by a smart contract during its execution.
The only effect this change has is a lower effective gas cost for the transaction senders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The upper limit of storage reads in one block is not affected by this change as the gas charge is done with the
full cost of &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; or &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum amount of memory and computation required to calculate the reimbursements according to the
specified algorithm is insignificant.&lt;&#x2F;p&gt;
&lt;p&gt;It appears that this change does not have any negative security implications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Empty accounts deprecation</title>
        <published>2023-09-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7523/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7523-empty-accounts-deprecation/15870" />
        

        <id>https://wg-eips.ritovision.com/7523/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="last-call"
                label="Last Call" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7523"
            label="EIP-7523" />
        

        
        

        
        <summary type="html">Prohibit empty accounts on post-merge networks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7523/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP prohibits the state of any post-merge network from containing empty accounts. Since no empty accounts exist outside the testsuite and no new ones can be created this requirement is already achieved in practice. An explicit ban reduces technical debt going forward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The possibility of empty accounts is a historical artifact of the early history of Ethereum. The only networks that have ever been capable of containing them are Ethereum Mainnet, the deprecated testnet Ropsten, Etheruem Classic Mainnet and various Ethereum Classic testnets. All remaining empty accounts on Mainnet were cleared in block &lt;code&gt;14049881&lt;&#x2F;code&gt; (transaction &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;) and a similar transaction was sent on Ethereum Classic. None of the other myriad EVM-compatible networks are old enough to have empty accounts and there is no realistic prospect that anyone will encounter an empty account in a production context.&lt;&#x2F;p&gt;
&lt;p&gt;Despite empty accounts no longer existing, they still impose a legacy of technical debt. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; imposes complicated rules that require a client to delete an empty account when it is &quot;touched&quot;. As the Ethereum specification continues to evolve new edgecases of the &quot;touch&quot; rules arise which must be debated, implemented, tested and documented. If a future client wishes to only support post-merge blocks it must implement unnecessary empty account support solely to pass the test suite.&lt;&#x2F;p&gt;
&lt;p&gt;By prohibiting empty accounts on post-merge networks, this EIP frees designers and implementers of Ethereum and related blockchains from the burden of having to consider them going forward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;An empty account is an account with has &lt;strong&gt;no code&lt;&#x2F;strong&gt; and &lt;strong&gt;zero nonce&lt;&#x2F;strong&gt; and &lt;strong&gt;zero balance&lt;&#x2F;strong&gt;. This is the same as the definition in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;On networks that undergo the merge transition, the pre state of the merge block may not contain any empty accounts. For networks that are merged at genesis, none of the genesis accounts may be empty accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Rather than performing a scan of the state, clients MAY assume the following chains have no post-merge empty accounts:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The Mainnet chain whose merge block has hash &lt;code&gt;0x56a9bb0302da44b8c0b3df540781424684c3af04d0b7a38d72842b762076a664&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Any chain which satisfies all of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;has no empty accounts in the genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;had a post Spurious Dragon fork at genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The Ethereum specification is declared to be undefined in the presence of an empty account in a post-merge context. Any testcase involving post-merge empty accounts is invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP was drafted to be the simplest possible way of eliminating the long term technical debt imposed by empty accounts. The Merge was chosen as a natural easily identifiable cutoff point.&lt;&#x2F;p&gt;
&lt;p&gt;Alternative approaches include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Using an earlier cutoff point, such as block &lt;code&gt;14049881&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Identifying a wider range of edge case behaviour that never happened.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These approaches were rejected as being unnecessarily complicated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As EIP does not change any behaviour that can occur outside the testsuite, it has no backwards compatibility consequences.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The validity of this EIP is dependent on the assertion that all empty accounts on Ethereum Mainnet were cleared prior to the merge. This should be subject to appropriate verification.&lt;&#x2F;p&gt;
&lt;p&gt;Any networks artificially created with empty accounts will cause problems with tooling and clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Atomic Storage Operations SCREDIT and SDEBIT</title>
        <published>2023-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7519/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7519-atomic-storage-operations-scredit-and-sdebit/15818" />
        

        <id>https://wg-eips.ritovision.com/7519/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7519"
            label="EIP-7519" />
        

        
        

        
        <summary type="html">Add atomic operations for incrementing and decrementing storage slots</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7519/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Two new opcodes that atomically mutate smart contract storage are proposed:
SCREDIT, which increments a storage slot by a specified value, and SDEBIT, which
decrements a storage slot by a specified value. Overflow and underflow errors
are enforced, reverting when an unsigned 256-bit integer would overflow or
underflow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There has been a large amount of energy around parallel EVMs across multiple
chains, however there is a lack of parallel primitives within the EVM to support
any model other than optimistic concurrency control (OCC). By adding concurrent
increment and decrement operations more advanced parallel environments can be
introduced in Layer 2 networks.&lt;&#x2F;p&gt;
&lt;p&gt;This also provides the opportunity to serve the principal use case of increment
and decrement: token balances. We can introduce failures on overflow and
underflow conditions and provide an operation that is also useful outside of
parallel use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two operations to atomically increment and decrement a storage will be
introduced
at &lt;code&gt;0xTBD&lt;&#x2F;code&gt;. Each operation takes two stack arguments and has no immediate
arguments. Gas schedule will be the same as SSTORE.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Mnemonic&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Output&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SCREDIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xTBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SDEBIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xTBD+1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;scredit&quot;&gt;SCREDIT&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SCREDIT: slot, value&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;description&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Adds &lt;code&gt;value&lt;&#x2F;code&gt; to the value stored in contract storage &lt;code&gt;slot.&lt;&#x2F;code&gt;  If an overflow
would occur the operation halts exceptionally.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-charging&quot;&gt;Gas Charging&lt;&#x2F;h4&gt;
&lt;p&gt;Gas charging is identical to SSTORE. including interactions with the warm
storage slot list. Any future modifications to the SSTORE gas charges will also
apply to SCREDIT.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;Not valid python, not suitable for EELS yet&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;slot = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = read_contract_storage(slot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = storage_value + value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if storage_value &amp;gt;= 2**256 :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  raise Exception(&amp;quot;scredit overflow&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;write_contract_storage(storage_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;sdebit&quot;&gt;SDEBIT&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SDEBIT: slot, value&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;description-1&quot;&gt;Description&lt;&#x2F;h4&gt;
&lt;p&gt;Subtracts &lt;code&gt;value&lt;&#x2F;code&gt; to the value stored in contract storage &lt;code&gt;slot.&lt;&#x2F;code&gt;  If an
underflow would occur the operation halts exceptionally.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-charging-1&quot;&gt;Gas Charging&lt;&#x2F;h4&gt;
&lt;p&gt;Gas charging is identical to SSTORE, including interactions with the warm
storage slot list. Any future modifications to the SSTORE gas charges will also
apply to SDEBIT.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-1&quot;&gt;Execution&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;em&gt;Not valid python, not suitable for EELS yet&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;slot = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;value = evm_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = read_contract_storage(slot)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_value = storage_value - value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if storage_value &amp;lt; 0 :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  raise Exception(&amp;quot;sdebit underflow&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;write_contract_storage(storage_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The primary consideration when choosing between alternatives is that the primary
intended audiences is token contracts and other asset-tracking contracts
combined with a desire to ship the minimum necessary changes to enable that use
case. General concurrency controls is not a goal of this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;enforcing-overflow-semantics&quot;&gt;Enforcing Overflow Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;When allowing for out-of-order execution there needs to be mechanism to handle
any possible order of execution. OCC handles this by validating pre- and
post-conditions, and re-evaluating the transactions if those invariants did not
hold. This technique breaks down around writing to balances and counters.&lt;&#x2F;p&gt;
&lt;p&gt;Increment&#x2F;decrement with rollover checking allows for simple handling of
balances and counters while allowing for functional read support ensuring that
sufficient balance or count exists without depending on the exact values. This
allows for evaluation models where the only post-condition checked is to
validate that the storage slots could handle all possible re-ordering of
transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas Schedule&lt;&#x2F;h3&gt;
&lt;p&gt;The decision to cost the operations at the exact same value as SSTORE is partly
for ease of implementation and partly as an incentive to compilers and
developers.&lt;&#x2F;p&gt;
&lt;p&gt;These semantics could be implemented in the EVM today, but it would also include
a SLOAD, DUP, LT, JUMPI and REVERT instructions. The EVM, however, can do these
operations much more efficiently than via opcodes. First, each SSTORE always
incurs a slot load in order to apply &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; gas calculation
rules. This load is essential if there is no paired SLOAD. Math libraries for
256-bit numbers can all easily be made sensitive to overflow and underflow, if
they are not already present. Conditional logic handling is also much faster in
the operation logic as most of the overhead would be operation parsing and stack
management when interpreted.&lt;&#x2F;p&gt;
&lt;p&gt;The net impact of the most relevant operations to the most expensive
evaluation (an ADD and LT operation, above the cost of a plain SSTORE) would be
4 gas, or 0.2% of the current cost of a SSTORE. Finally, database access costs
dominate the real cost of the operation. A 0.2% overhead may disappear in I&#x2F;O
stalls.&lt;&#x2F;p&gt;
&lt;p&gt;Keeping the cost the same makes implementations of gas charging vert simple.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;storage-slots-only&quot;&gt;Storage Slots Only&lt;&#x2F;h3&gt;
&lt;p&gt;This most important use case for this EIP asset balances and not general
concurrency controls. Hence, only enabling credit and debit operations on
storage slots (which persist across transactions). Parallel execution within a
transaction and more generic tools like locks and semaphores have very limited
utility within this scope. The lack of in-transaction parallel execution also
precludes the use of such primitives against transient storage (as defined in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-instead-of-system-contract&quot;&gt;Opcode Instead of System Contract&lt;&#x2F;h3&gt;
&lt;p&gt;One alternative, particularly viable for Layer 2 chains, would be to implement
SCREDIT and SDEBIT as system contracts. The primary objection to system
contracts for other operations is the gas cost overhead of constructing a call.
Because a SSTORE is always greater than the cost of a call it would be possible
to build in a discount. However, there is no such accommodation that can be made
for the code size needed to invoke such a call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These opcodes are not simple replacements for SLOAD-(ADD|SUB)-SSTORE sequence
because there is an overflow&#x2F;underflow check&lt;&#x2F;p&gt;
&lt;p&gt;There is no EVM functionality removed by this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test for overflow and non-overflow for the following values and values before
and after:&lt;&#x2F;p&gt;
&lt;p&gt;1, 2^8, 2^16, 2^32, 2^64, 2^128 2^255, 2^256-1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&#x2F;# TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The use of revert to handle over&#x2F;underflow represents a new halt condition that
auditors will need to consider when examining reentrancy concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLOBBASEFEE instruction</title>
        <published>2023-09-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Carl Beekhuizen</name><uri>https://github.com/carlbeek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7516/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7516-blobbasefee-opcode/15761" />
        

        <id>https://wg-eips.ritovision.com/7516/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7516"
            label="EIP-7516" />
        

        
        

        
        <summary type="html">Instruction that returns the current data-blob base-fee</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7516/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BLOBBASEFEE (0x4a)&lt;&#x2F;code&gt; instruction that returns the value of the blob base-fee of the current block it is executing in. It is the identical to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3198&#x2F;&quot;&gt;EIP-3198&lt;&#x2F;a&gt; (&lt;code&gt;BASEFEE&lt;&#x2F;code&gt; opcode) except that it returns the blob base-fee as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The intended use case would be for contracts to get the value of the blob base-fee. This feature enables blob-data users to programmatically account for the blob gas price, eg:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Allow rollup contracts to trustlessly account for blob data usage costs.&lt;&#x2F;li&gt;
&lt;li&gt;Blob gas futures can be implemented based on it which allows for blob users to smooth out data blob costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; instruction with opcode &lt;code&gt;0x4a&lt;&#x2F;code&gt;, with gas cost &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Input&lt;&#x2F;th&gt;&lt;th&gt;Output&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x4a&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; returns the result of the &lt;code&gt;get_blob_gasprice(header) -&amp;gt; int&lt;&#x2F;code&gt; function as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#gas-accounting&quot;&gt;EIP-4844 §Gas accounting&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The value of the blob base-fee is needed to process data-blob transactions. That means its value is already available before running the EVM code.
The instruction does not add extra complexity and additional read&#x2F;write operations, hence the choice of &lt;code&gt;2&lt;&#x2F;code&gt; gas cost. This is also identical to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3198&#x2F;&quot;&gt;EIP-3198&lt;&#x2F;a&gt; (&lt;code&gt;BASEFEE&lt;&#x2F;code&gt; opcode)&#x27;s cost as it just makes available data that is in the header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with this instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;nominal-case&quot;&gt;Nominal Case&lt;&#x2F;h3&gt;
&lt;p&gt;Assume calling &lt;code&gt;get_blob_gasprice(header)&lt;&#x2F;code&gt; (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#gas-accounting&quot;&gt;EIP-4844 §Gas accounting&lt;&#x2F;a&gt;) on the current block&#x27;s header returns &lt;code&gt;7 wei&lt;&#x2F;code&gt;:
&lt;code&gt;BLOBBASEFEE&lt;&#x2F;code&gt; should push the value &lt;code&gt;7&lt;&#x2F;code&gt; (left padded byte32) to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x4900&lt;&#x2F;code&gt; (&lt;code&gt;BLOBBASEFEE, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;BLOBBASEFEE&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[7]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comprehensive-test-suite&quot;&gt;Comprehensive Test Suite&lt;&#x2F;h3&gt;
&lt;p&gt;A complete suite of tests can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;blob&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip7516_blobgasfee&#x2F;test_blobgasfee_opcode.py&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The value of the blob base-fee is not sensitive and is publicly accessible in the block header. There are no known security implications with this instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add Max Epoch Churn Limit</title>
        <published>2023-09-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Tim Beiko</name><uri>https://github.com/timbeiko</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7514/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7514-add-max-epoch-churn-limit/15709" />
        

        <id>https://wg-eips.ritovision.com/7514/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7514"
            label="EIP-7514" />
        

        
        

        
        <summary type="html">Modify the churn limit function to upper bound it to a max value</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7514/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Update the maximum validator growth rate from an exponential to a linear increase by capping the epoch churn limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal aims to mitigate the negative externalities of very high level of total ETH supply staked before a proper solution is implemented. In other words, this proposal accepts the complexities of changing the rewards curve and is meant only to slow down growth.&lt;&#x2F;p&gt;
&lt;p&gt;In the event that the deposit queue stays 100% full, the share of ETH supply staked will reach 50% by May 2024, 75% by September 2024, and 100% by December 2024. While rewards decrease as the validator set size increases, at 100% of ETH supply staked, yearly consensus rewards alone (excluding MEV&#x2F;transaction fees) for validators still represent ~1.6% of their stake. This small yield does not necessarily dissuade additional capital staking due to the often much higher and unpredictable yields from MEV. As such, the equilibrium point of the validator set size can be close to its maximum possible. Liquid staking tokens (LSTs) also contribute to this, given stakers can use them as they use unstaked ETH.&lt;&#x2F;p&gt;
&lt;p&gt;As the levels of ETH staked increase, more strain is put on the consensus layer. A larger number of validators leads to an increase in gossip messages, as well as a growing Beacon state size. Additionally, as the amount of stake grows, it&#x27;s unclear how much marginal security benefits come from additional economic weight.&lt;&#x2F;p&gt;
&lt;p&gt;The Beacon Chain validator reward function was chosen before its launch in 2020. PoS research and reward curve design were performed in a pre-MEV world. Much has changed since then, including the Beacon chain achieving unprecedented success, beyond the original intended targets of stake rate. In light of this, it is worth discussing whether Beacon chain validator rewards should be adjusted to better match today&#x27;s reality, potentially to discourage staking past a certain point.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not attempt to do this, but to allow more time for the community to have these discussions. By limiting the epoch churn limit now, the time to reach critical milestones of total ETH supply staked are significantly delayed. This allows more time for research into more comprehensive solutions, and for community consensus around them to emerge.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Add &lt;code&gt;get_validator_activation_churn_limit&lt;&#x2F;code&gt; with upper bound &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_registry_updates&lt;&#x2F;code&gt; to use bounded activation churn limit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The full specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;69d34dc4ee3d026ca437d1b6875b218e8aaf3a5c&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;max-per-epoch-churn-limit-value&quot;&gt;&lt;code&gt;MAX_PER_EPOCH_CHURN_LIMIT&lt;&#x2F;code&gt; value&lt;&#x2F;h3&gt;
&lt;p&gt;Depending on the specific constant selection the churn can &lt;em&gt;decrease&lt;&#x2F;em&gt; at the activation fork epoch. The Beacon chain spec can handle this without issues. During 2023 Q4 (projected Dencun activation) the churn value will range 14-16. The table below compares the projected validator set assuming a continuous full deposit queue.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;max-per-epoch-churn-limit-activation-date-dec-01-2023&quot;&gt;&lt;code&gt;MAX_PER_EPOCH_CHURN_LIMIT&lt;&#x2F;code&gt; activation date: Dec 01, 2023&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Max Churn Limit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;50% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;75% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;100% ETH staked&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;inf&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;May 28, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 25, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 18, 2024&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 23, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Apr 10, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 26, 2025&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Oct 09, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 21, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 04, 2026&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 15, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 18, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jan 21, 2028&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 19, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 14, 2027&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jun 08, 2029&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jun 29, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;May 05, 2029&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 12, 2032&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;max-per-epoch-churn-limit-activation-date-apr-01-2024&quot;&gt;&lt;code&gt;MAX_PER_EPOCH_CHURN_LIMIT&lt;&#x2F;code&gt; activation date: Apr 01, 2024&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Max Churn Limit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;50% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;75% ETH staked&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;100% ETH staked&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;inf&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;May 28, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 25, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 18, 2024&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;16&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 18, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 04, 2025&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;12&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jul 14, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Jun 26, 2026&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;8&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Oct 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Mar 05, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Aug 08, 2027&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;6&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 01, 2024&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Oct 26, 2026&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Sep 20, 2028&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;4&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Apr 02, 2025&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Feb 07, 2028&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;Dec 15, 2030&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Assuming that the earliest the next fork can happen is at the start of 2024 Q3, a value of 8 provides a significant reduction in projected size without causing a big drop in churn at a projected Dencun fork date. A value of 8 prevents reaching a level of 50% ETH staked for at least 1 full year even with a delayed dencun fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;&lt;code&gt;deneb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; test suite of the &lt;code&gt;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP breaks the symmetry between the validator entry and exit queues, where the former is bound by &lt;code&gt;MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT&lt;&#x2F;code&gt; while the latter isn&#x27;t.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgrade block proposer election to Whisk</title>
        <published>2023-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>George Kadianakis</name><uri>https://github.com/asn-d6</uri>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/JustinDrake</uri>
	</author>
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7441/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7441-upgrade-block-proposer-election-to-whisk-ssle/15316" />
        

        <id>https://wg-eips.ritovision.com/7441/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7441"
            label="EIP-7441" />
        

        
        

        
        <summary type="html">Allow elected block proposers to remain private until block publishing, to prevent DoS attacks</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7441/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Upgrades the block proposer election mechanism to Whisk, a single secret leader election (SSLE) protocol. Currently, block proposers are publicly known in advance, sufficiently to allow sequential DoS attacks that could disable Ethereum. This upgrade allows the next block proposer to remain secret until its block is published.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The beacon chain currently elects the next 32 block proposers at the beginning of each epoch. The results of this election are public and everyone gets to learn the identity of those future block proposers.&lt;&#x2F;p&gt;
&lt;p&gt;This information leak enables attackers to launch DoS attacks against each proposer sequentially in an attempt to disable Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The protocol can be summarized in the following concurrent steps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Validators register a tracker and unique commitment on their first proposal after the fork&lt;&#x2F;li&gt;
&lt;li&gt;At the start of a shuffling phase a list of candidate trackers is selected using public randomness from RANDAO&lt;&#x2F;li&gt;
&lt;li&gt;During each shuffling phase each proposer shuffles a subset of the candidate trackers using private randomness&lt;&#x2F;li&gt;
&lt;li&gt;After each shuffling phase an ordered list of proposer trackers is selected from the candidate set using RANDAO&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The full specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;a39abe388bc2d1abd5b4fd62fd18aed497956b30&#x2F;specs&#x2F;_features&#x2F;whisk&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;_features&#x2F;whisk&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;. In summary:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Update &lt;code&gt;BeaconState&lt;&#x2F;code&gt; with fields needed to track validator trackers, commitments, and the two rounds of candidate election.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;select_whisk_candidate_trackers&lt;&#x2F;code&gt; to compute the next vector of candidates from the validator set.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;select_whisk_proposer_trackers&lt;&#x2F;code&gt; to compute the next vector of proposers from current candidates.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_whisk_updates&lt;&#x2F;code&gt; to epoch processing logic.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_whisk_opening_proof&lt;&#x2F;code&gt; to validate block proposer has knowledge of this slot&#x27;s elected tracker.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_block_header&lt;&#x2F;code&gt; to not assert proposer election with &lt;code&gt;get_beacon_proposer_index&lt;&#x2F;code&gt;, instead assert valid opening proof.&lt;&#x2F;li&gt;
&lt;li&gt;Update &lt;code&gt;BeaconBlockBody&lt;&#x2F;code&gt; with fields to submit opening proof, shuffled trackers with proof, and tracker registration with proof.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;get_shuffle_indices&lt;&#x2F;code&gt; to compute pre-shuffle candidate selection&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_shuffled_trackers&lt;&#x2F;code&gt; to submit shuffled candidate trackers.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_whisk&lt;&#x2F;code&gt; to block processing logic.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;apply_deposit&lt;&#x2F;code&gt; to register an initial unique tracker and commitment without entropy.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;fields-per-validator&quot;&gt;Fields per validator&lt;&#x2F;h3&gt;
&lt;p&gt;Whisk requires having one tracker &lt;code&gt;(rG,krG)&lt;&#x2F;code&gt; and one unique commitment &lt;code&gt;kG&lt;&#x2F;code&gt; per validator. Both are updated only once on a validator&#x27;s first proposal after the fork.&lt;&#x2F;p&gt;
&lt;p&gt;Trackers are registered with a randomized base &lt;code&gt;(rG,krG)&lt;&#x2F;code&gt; to make it harder for adversaries to track them through shuffling gates. It can become an issue if the set of honest shufflers is small.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;identity-binding&quot;&gt;Identity binding&lt;&#x2F;h3&gt;
&lt;p&gt;Each tracker must be bound to a validator&#x27;s identity to prevent multiple parties to claim the same proposer slot. Otherwise, it would allow proposers to sell their proposer slot, and cause fork-choice issues if two competing blocks appear.&lt;&#x2F;p&gt;
&lt;p&gt;Whisk does identity binding by storing a commitment to the tracker&#x27;s secret &lt;code&gt;kG&lt;&#x2F;code&gt; in the validator record. Storing the commitment also ensures the uniqueness of &lt;code&gt;k&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, identity binding can be achieved by forcing the hash prefix of &lt;code&gt;hash(kG)&lt;&#x2F;code&gt; to match its validator index. However, validators would have to brute force &lt;code&gt;k&lt;&#x2F;code&gt; making bootstrap of the system harder for participants with fewer computational resources.&lt;&#x2F;p&gt;
&lt;p&gt;Identity binding can also be achieved by setting &lt;code&gt;k = hash(nonce + pubkey)&lt;&#x2F;code&gt;. However, proposers will need to reveal &lt;code&gt;k&lt;&#x2F;code&gt; and be de-anonymized for repeated proposals on adjacent shuffling phases.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-non-single-secret-election&quot;&gt;Alternative: non-single secret election&lt;&#x2F;h3&gt;
&lt;p&gt;Secret non-single leader election could be based on protocol engineering rather than cryptography, thus much simpler and cheaper than Whisk. However, it complicates the fork-choice and opens it up to potential MEV time-buying attacks, making it an unsuitable option at the time of writing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-network-anonymity&quot;&gt;Alternative: network anonymity&lt;&#x2F;h3&gt;
&lt;p&gt;Privacy-preserving networking protocols like Dandelion or Dandelion++ increase the privacy of network participants but not sufficiently for Ethereum&#x27;s use case.&lt;&#x2F;p&gt;
&lt;p&gt;SASSAFRAS is a simpler alternative SSLE protocol consensus-wise, but it relies on a network anonymity layer. Its specific trade-offs do not fit Ethereum&#x27;s overall threat model better than Whisk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;PBS participants (e.g. builders) will not know the next proposer validator index to use a specific pre-registered fee recipient; unless the proposer chooses to reveal itself ahead of time. Block explorers and tooling will not be able to attribute missing slots to a specific validator index.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The shuffling strategy is analyzed in a companion paper and considered sufficiently safe for Whisk&#x27;s use case. The data and computational complexity of this EIP are significant but constant, thus does not open new DoS vectors.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;anonymity-set&quot;&gt;Anonymity set&lt;&#x2F;h3&gt;
&lt;p&gt;The anonymity set in Whisk is the set of 8,192 candidates that did not get selected as proposers. That count of validators corresponds to a smaller number of p2p nodes. Assuming a Pareto principle where &quot;20% of the nodes run 80% of the validators&quot; the anonymity corresponds to 2,108 nodes on average. A bigger candidate pool could make the shuffling strategy unsafe while shuffling more trackers per round would increase the cost of the ZK proofs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;randao-biasing&quot;&gt;RANDAO biasing&lt;&#x2F;h3&gt;
&lt;p&gt;Whisk uses RANDAO in the candidate selection and proposer selection events, and is susceptible to potential RANDAO biasing attacks by malicious proposers. Whisk security could be made identical to the status quo by spreading the selection events over an entire shuffling period. However, status quo security is not ideal either and it would complicate the protocol further.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ ProgressiveContainer</title>
        <published>2023-08-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Cayman</name><uri>https://github.com/wemeetagain</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7495/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7495-ssz-progressivecontainer/15476" />
        

        <id>https://wg-eips.ritovision.com/7495/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="review"
                label="Review" />
            
        

        
        <category
            term="tag:eip:7495"
            label="EIP-7495" />
        

        
        

        
        <summary type="html">SSZ type for forward-compatible containers</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7495/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; type to represent containers with forward-compatible Merkleization: A given field is always assigned the same stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; even when different container versions append new fields or drop existing fields.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;SSZ containers are frequently versioned, for example across fork boundaries. When the number of fields reaches a new power of two, or a field is removed or replaced with one of a different type, the shape of the underlying Merkle tree changes, breaking verifiers of Merkle proofs for these containers. Deploying a new verifier may involve security councils to upgrade smart contract logic, or require firmware updates for embedded devices. This effort is needed even when no semantic changes apply to the fields that the verifier is interested in.&lt;&#x2F;p&gt;
&lt;p&gt;Progressive containers address these shortcomings by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Using the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7916&#x2F;&quot;&gt;progressive Merkle tree&lt;&#x2F;a&gt; structure to progressively grow to the actual field count with minimal overhead, ensuring provers remain valid as the field count changes.&lt;&#x2F;li&gt;
&lt;li&gt;Assigning stable gindices for each field across all versions by allowing gaps in the Merkle tree where a field is absent.&lt;&#x2F;li&gt;
&lt;li&gt;Serializing in a compact form where absent fields do not consume space.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;progressivecontainer-active-fields&quot;&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#composite-types&quot;&gt;SSZ composite types&lt;&#x2F;a&gt; is defined:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;progressive container&lt;&#x2F;strong&gt;: ordered heterogeneous collection of values with stable Merkleization&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;python dataclass notation with key-type pairs, e.g.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Square&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    side&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #0 (location of first 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #2 (location of second 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Circle&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    radius&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint16&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #1 (location of first 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    color&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merkleized at field index #2 (location of second 1 in `active_fields`)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#default-values&quot;&gt;default value&lt;&#x2F;a&gt; is defined as:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Default Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[default(type) for type in progressive_container]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The following types are considered &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#illegal-types&quot;&gt;illegal&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with no fields are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration of more than 256 entries are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration ending in &lt;code&gt;0&lt;&#x2F;code&gt; are illegal.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; with an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration with a different count of &lt;code&gt;1&lt;&#x2F;code&gt; than fields are illegal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h4&gt;
&lt;p&gt;Serialization of &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt; is identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#vectors-containers-lists&quot;&gt;&lt;code&gt;Container&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deserialization&quot;&gt;Deserialization&lt;&#x2F;h4&gt;
&lt;p&gt;Deserialization of &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt; is identical to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#deserialization&quot;&gt;&lt;code&gt;Container&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;json-mapping&quot;&gt;JSON mapping&lt;&#x2F;h4&gt;
&lt;p&gt;The canonical &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#json-mapping&quot;&gt;JSON mapping&lt;&#x2F;a&gt; is updated:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;SSZ&lt;&#x2F;th&gt;&lt;th&gt;JSON&lt;&#x2F;th&gt;&lt;th&gt;Example&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;object&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;{ &quot;field&quot;: ... }&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;ad36024441cf910d428d03f87f331fbbd2b3e5f1&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;SSZ Merkleization specification&lt;&#x2F;a&gt; is extended with two helper functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_active_fields(value)&lt;&#x2F;code&gt;, where &lt;code&gt;value&lt;&#x2F;code&gt; is of type &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;: return &lt;code&gt;active_fields&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;mix_in_active_fields&lt;&#x2F;code&gt;: Given a Merkle root &lt;code&gt;root&lt;&#x2F;code&gt; and an &lt;code&gt;active_fields&lt;&#x2F;code&gt; configuration return &lt;code&gt;hash(root, pack_bits(active_fields))&lt;&#x2F;code&gt;. Note that &lt;code&gt;active_fields&lt;&#x2F;code&gt; is restricted to ≤ 256 bits.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Merkleization definitions are extended.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mix_in_active_fields(merkleize_progressive([hash_tree_root(element) for element in value]), get_active_fields(value))&lt;&#x2F;code&gt; if &lt;code&gt;value&lt;&#x2F;code&gt; is a progressive container.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-is-active-fields-limited-to-256-bits&quot;&gt;Why is &lt;code&gt;active_fields&lt;&#x2F;code&gt; limited to 256 bits?&lt;&#x2F;h3&gt;
&lt;p&gt;256 bits (1 word) allows the mix-in to be simple, consistent with the length mix-in for lists, and is practically sufficient. An alternate design with a &lt;code&gt;ProgressiveBitlist&lt;&#x2F;code&gt; mix-in was explored, however deemed too over-engineered as it would effectively require introducing caches to pre-compute the mix-in&#x27;s &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; to avoid repeated computations, and also makes verifier logic more complex than necessary.&lt;&#x2F;p&gt;
&lt;p&gt;Even though the 256 field limit includes all fields (including deprecated ones), it is unlikely that many progressive containers come close to reach 256 fields (&lt;code&gt;BeaconState&lt;&#x2F;code&gt; currently reaches around 40 fields). If that happens, one can add a &lt;code&gt;more&lt;&#x2F;code&gt; field with a nested &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-is-empty-progressivecontainer-an-illegal-type&quot;&gt;Why is empty &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt; an illegal type?&lt;&#x2F;h3&gt;
&lt;p&gt;It would result in 0-length serialization, meaning that the length of a list of such a container cannot be determined from the serialization.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optional-type&quot;&gt;&lt;code&gt;Optional[type]&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;Introducing &lt;code&gt;Optional&lt;&#x2F;code&gt; is not required by any current functionality and is deferred to a future EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;active_fields&lt;&#x2F;code&gt; bitvector can be updated to also indicate optionality. Further, serialization for sparse lists should be explored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt; is a new SSZ type and does not conflict with existing types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt; contains static tests in &lt;code&gt;test_impl.py&lt;&#x2F;code&gt; and &lt;code&gt;test_typing.py&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; releases contain random tests in &lt;code&gt;tests&#x2F;general&#x2F;phase0&#x2F;ssz_generic&lt;&#x2F;code&gt;, generated according to a format defined in &lt;code&gt;tests&#x2F;format&#x2F;ssz_generic&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;code&gt;ethereum&#x2F;remerkleable&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Light client based verifiers and smart contracts (e.g., based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;) do not update at the same cadence as Ethereum. If a future fork removes a field from a &lt;code&gt;ProgressiveContainer(active_fields)&lt;&#x2F;code&gt;, the &lt;code&gt;active_fields&lt;&#x2F;code&gt; mix-in enables such verifiers to distinguish absent fields from &lt;code&gt;0&lt;&#x2F;code&gt; values. Without &lt;code&gt;active_fields&lt;&#x2F;code&gt;, the &lt;code&gt;hash_tree_root&lt;&#x2F;code&gt; for these cases would collide.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Zero-Knowledge Wormholes</title>
        <published>2023-08-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Keyvan Kambakhsh</name><uri>https://github.com/keyvank</uri>
	</author>
	
	<author>
		<name>Hamid Bateni</name><uri>https://github.com/irnb</uri>
	</author>
	
	<author>
		<name>Amir Kahoori</name><email>a.kahoorizadeh@gmail.com</email>
	</author>
	
	<author>
		<name>Nobitex Labs</name><email>labs@nobitex.ir</email>
	</author>
	
	<author>
		<name>0xwormhole</name><uri>https://github.com/0xwormhole</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7503/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7503-zero-knowledge-wormholes-private-proof-of-burn-ppob/15456" />
        

        <id>https://wg-eips.ritovision.com/7503/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7503"
            label="EIP-7503" />
        

        
        

        
        <summary type="html">Enable minting of secretly burnt Ethers as a native privacy solution for Ethereum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7503/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;While researching on privacy solutions and applications of ZKP, we discovered a technique,
by which people can burn their digital asset (E.g ETH) by sending it to an unspendable address,
and later build a ZK proof showing that some amount of tokens reside in an account that are
unspendable, without revealing the account.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP proposes to add a minting functionality to Ethereum, so that people can re-mint
Ethers they have purposefully burnt. The mentioned privacy solution will bring strong levels of
&lt;em&gt;&lt;strong&gt;plausible deniability&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; for the sender, since there is no way one can prove that the sender
has been participating in a privacy protocol. This will also make an anonymity pool that includes
all of the Ethereum accounts with zero outgoing transactions by default.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAGIC_ADDRESS&lt;&#x2F;code&gt;: &lt;code&gt;0xfe&lt;&#x2F;code&gt; (one byte)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAGIC_NULLIFIER&lt;&#x2F;code&gt;: &lt;code&gt;0x01&lt;&#x2F;code&gt; (one byte)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAGIC_POW&lt;&#x2F;code&gt;: &lt;code&gt;0x02&lt;&#x2F;code&gt; (one byte)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAGIC_CHANGE&lt;&#x2F;code&gt;: &lt;code&gt;0x0404040404040404040404040404040404040404040404040404040404040404&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;POW_LOG_DIFFICULTY&lt;&#x2F;code&gt;: &lt;code&gt;24&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_DEPOSIT&lt;&#x2F;code&gt;: &lt;code&gt;32 * 10**18&lt;&#x2F;code&gt; wei&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WormholeTxType&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WORMHOLE_NULLIFIER_ADDRESS&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RECEIPT_PREFIX&lt;&#x2F;code&gt;: &lt;code&gt;TBD&lt;&#x2F;code&gt; (datatype &lt;code&gt;List[bool]&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;We define a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, where &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;WormholeTxType&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; format is as follows:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, data, access_list, root_beacon_block_number, proof]&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Verifying this type of transaction requires confirming that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The proof is a zero-knowledge proof:
&lt;ul&gt;
&lt;li&gt;Private inputs: &lt;code&gt;secret&lt;&#x2F;code&gt;, &lt;code&gt;main_index&lt;&#x2F;code&gt;, &lt;code&gt;main_branch&lt;&#x2F;code&gt;, &lt;code&gt;privacy_pool_index&lt;&#x2F;code&gt;, &lt;code&gt;privacy_pool_branch&lt;&#x2F;code&gt;, &lt;code&gt;deposit_value&lt;&#x2F;code&gt;, &lt;code&gt;deposit_sender&lt;&#x2F;code&gt;, &lt;code&gt;change_value_salt&lt;&#x2F;code&gt;, &lt;code&gt;change_value&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Public inputs: &lt;code&gt;beacon_block_root&lt;&#x2F;code&gt;, &lt;code&gt;nullifier&lt;&#x2F;code&gt;, &lt;code&gt;privacy_pool_root&lt;&#x2F;code&gt;, &lt;code&gt;withdraw_value&lt;&#x2F;code&gt;, &lt;code&gt;change_value_hash&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Function: verify all of the following conditions
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;verify_merkle_branch(root=beacon_block_root, index=RECEIPT_PREFIX + main_index, leaf=make_receipt_hash(deposit_sender, deposit_value, change_value_salt, secret), branch=main_branch)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;verify_merkle_branch(root=privacy_pool_root, index=privacy_pool_index, leaf=make_receipt_hash(deposit_sender, deposit_value, change_value_salt, secret), branch=privacy_pool_branch)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nullifier == sha256(MAGIC_NULLIFIER + secret)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;sha256(MAGIC_POW + secret) % 2**POW_LOG_DIFFICULTY == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;change_value_hash == sha256(change_value_salt, change_value)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;change_value + withdraw_value == deposit_value&lt;&#x2F;code&gt; (all values are unsigned int, also need to confirm that there is no overflow)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;deposit_value &amp;lt;= MAX_DEPOSIT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD(WORMHOLE_NULLIFIER_ADDRESS, proof.nullifier) == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;get_beacon_block_root(root_beacon_block_number) == proof.beacon_block_root&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We define &lt;code&gt;make_receipt_hash&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def make_receipt_hash(deposit_sender: Address, value: uint256, change_value_salt: bytes32, secret: bytes32):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if deposit_sender != 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        to_address = sha256(MAGIC_ADDRESS + secret)[12:]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        topics = [MAGIC_EIP_7708, deposit_sender, to_address]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logdata = int_to_bytes32(value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        topics = [MAGIC_CHANGE, hash(change_value_salt, value)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        logdata = bytes([])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_ssz_root_hash(Log(topics=topics, data=logdata))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The hash of the transaction (excluding proof) should be included in the randomness for generating the zero-knowledge proof. This ensures the proof serves as a signature.&lt;&#x2F;p&gt;
&lt;p&gt;If the transaction is confirmed, generate &lt;code&gt;proof.withdraw_value&lt;&#x2F;code&gt; ether at address &lt;code&gt;WORMHOLE_NULLIFIER_ADDRESS&lt;&#x2F;code&gt;. Then proceed with a normal call from this address using that value. Before the call, set &lt;code&gt;SSTORE(WORMHOLE_NULLIFIER_ADDRESS, proof.nullifier, 1)&lt;&#x2F;code&gt;, and emit a log event where &lt;code&gt;topics = [MAGIC_CHANGE, proof.change_value_hash]&lt;&#x2F;code&gt; and &lt;code&gt;logdata = bytes([])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In Elliptic-Curve based digital signatures, normally there is a secret scalar $s$, from which
a public-key is calculated (By multiplying the generator point with the scalar: $s \times G$). An
Ethereum EOA-address is the keccak hash of a public-key.&lt;&#x2F;p&gt;
&lt;p&gt;Also, the funds in an Ethereum address might be spendable by a smart-contract, if the keccak hash
of the smart-contract&#x27;s parameters is equal with that address.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, an Ethereum address $A$ is spendable if and only if:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A private-key $s$ exists. such that $A = keccak(s \times G)$.&lt;&#x2F;li&gt;
&lt;li&gt;There exists a smart-contract $c$, such that $A = keccak(c_{params})$.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The preimage resistance property of hash functions implies that, you can&#x27;t find $x$ where $keccak(x)=r$,
in case $r$ is a random value. So the funds sent to a random Ethereum address $r$ is unspendable, but
how can other people be sure that $r$ is indeed random and not the result of calculating $s \times G$?&lt;&#x2F;p&gt;
&lt;p&gt;A great source of randomness is a hash function. If the address is equal with the hash of a secret preimage
$s$, we can conclude that the address is unspendable, since there isn&#x27;t a polynomially bounded algorithm
to find $x$ where $keccak(x)=h(s)$. This is only true if the second hash function is a different hash
function, and it assumes it is impossible to find $x_1$ and $x_2$ such that $h_1(x_1)=h_2(x_2)$ in case
$h_1$ and $h_2$ are different hash functions.&lt;&#x2F;p&gt;
&lt;p&gt;Using the help of Zero-Knowledge proofs, we can hide the value of $s$! We just need to prove that
we know a secret value $s$ where the address is $h(s)$. We can go even further. We can prove
that an Ethereum accounts exists in the state-root, which holds some amount of ETH and is unspendable.&lt;&#x2F;p&gt;
&lt;p&gt;By revealing this to the Ethereum blockchain and providing something like a nullifier
(E.g. $h(s | 123)$ so that double minting of same burnt tokens are not possible), we can add a new
&lt;em&gt;&lt;strong&gt;minting&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; functionality for ETH so that people can migrate their secretly burnt tokens to a
completely new address, without any trace on the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Cryptocurrency mixers like TornadoCash can successfully obfuscate Ethereum transactions, but it&#x27;s
easy for the governments to ban usage of them. Anybody who has interactions with a mixer contract,
whether the sender or receiver, can get marked. However this EIP tries to minimize the privacy leakage
of the senders, by requiring zero smart-contract interactions in order to send money, so
we only use plain EOA-to-EOA transfers. In order to have a &quot;teleportation&quot; mechanism we divide
the set of all Secp256k1 points $E(K)$ into two subsets&#x2F;address-spaces:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The spendable address-space: $\{p \in \{0,1\}^{160} | \exists s : keccak(s \times G)=p \lor \exists c : keccak(c_{params})=p \}$&lt;&#x2F;li&gt;
&lt;li&gt;The unspendable address-space: $\{p \in \{0,1\}^{160} | \nexists s : keccak(s \times G)=p \land \nexists c : keccak(c_{params})=p \}$&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The spendable&#x2F;unspendable addresses are not distinguishable, so we can exploit this fact and define
a spendability rule for the money sent to addresses that can&#x27;t be spent using regular elliptic-curve
signatures.&lt;&#x2F;p&gt;
&lt;p&gt;Deposits are made by sending ether to an address &lt;code&gt;sha256(MAGIC_ADDRESS + secret)[12:]&lt;&#x2F;code&gt;, where you know the &lt;code&gt;secret&lt;&#x2F;code&gt;. This ensures that no one knows about the deposit unless you reveal it: a deposit onchain is not distinguishable from sending ether to a friend. Withdrawals use a zero-knowledge proof to prove knowledge of a previous deposit&#x27;s &lt;code&gt;secret&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;A deposit can come from two places: a standard deposit by sending ether, or a change deposit. A change deposit is automatically generated when withdrawing funds from another deposit (standard or change). The entire deposited amount does not have to be withdrawn; for example, if 20 ether was deposited and only 12 is withdrawn, the system will make a new change deposit of 8 ether. The value of this change deposit is hashed, so someone looking at the chain cannot calculate &lt;code&gt;change deposit value + withdrawal value = old deposit value&lt;&#x2F;code&gt; and use the value to expose the original deposit.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP requires that &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7708&#x2F;&quot;&gt;EIP-7708&lt;&#x2F;a&gt; be in place along with an EIP to change receipts to SSZ format. This simplifies the proof as it only needs to verify a regular SHA256 Merkle branch verifying a log, there is no need to do verkle or RLP or other complex logic inside the proof. The log can be of two types: an EIP-7708 ETH transfer log, or a log generated by this EIP itself through the change mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP also includes a privacy pool &lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; mechanism where you must provide a privacy pool root, which corresponds to a list of deposits, so you prove that your deposit is one of the deposits in that list. Since this second Merkle branch mechanism is integrated into the proof, the marginal cost for a user to use it is zero, ensuring maximum adoption and maximizing the chance that privacy will be used responsibly. The privacy pools paper explains in much more detail the value of this privacy pools mechanism, and the benefits of an ecosystem where almost all legitimate users use it.&lt;&#x2F;p&gt;
&lt;p&gt;The built-in PoW and 32 ETH limit prevent hash collision attacks: if an attacker can find collision &lt;code&gt;(x1, x2)&lt;&#x2F;code&gt; such that &lt;code&gt;create2_address(..., x1) == sha256(MAGIC_ADDRESS + x2)&lt;&#x2F;code&gt;, the attacker could extract their ether twice (but only twice). Such an attack requires approximately &lt;code&gt;2**80&lt;&#x2F;code&gt; hashes. Adding 24 bits of PoW increases the difficulty to &lt;code&gt;2**92&lt;&#x2F;code&gt;. This many hashes can be computed but is very difficult; currently, mining a Bitcoin block takes around &lt;code&gt;2**79&lt;&#x2F;code&gt; hashes, so those with the capabilities to attack this mechanism have a much more lucrative opportunity in Bitcoin mining.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;scalability-implications&quot;&gt;Scalability Implications&lt;&#x2F;h3&gt;
&lt;p&gt;In case the circuits are able to simultaneously re-mint the sum of multiple burns in a single-proof,
merchants and CEXs will be able to accept their payments in burn-addresses and accumulate their funds
in a single address by storing a single proof (And a bunch of nullifiers) on the blockchain, which
significantly reduces the transaction count on the blockchain. The people who will use this EIP as a
scalability solution, will also increase the privacy guarantees of the protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethers generated using the mint function should not have any difference with original Ethers.
People should be able to use those minted Ethers for paying the gas fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be determined (TBD).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;zk-snark-implementation&quot;&gt;ZK-SNARK Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Also TBD, but the implementation must meet the following conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use a transparent setup; ideally reuse the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; setup. Do not use Groth16 or other application-specific setups.&lt;&#x2F;li&gt;
&lt;li&gt;The circuit should be directly verifiable without blindly trusting compilers like Circom. SHA256 is not too complicated and can be implemented using PLOOKUP with an 8-bit lookup table for arithmetic operations, which should suffice. There is no need to over-focus on prover efficiency.&lt;&#x2F;li&gt;
&lt;li&gt;Elliptic curves must still be used; Stark is too large.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;In case of faulty implementation of this EIP, people may mint infinite amount of ETH, collapsing the price of Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Buterin, V., Illum, J., Nadler, M., Schär, F., &amp;amp; Soleimani, A. (n.d.). &lt;span style=&quot;font-style: italic;&quot;&gt;Blockchain Privacy and Regulatory Compliance: Towards a Practical Equilibrium&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.2139&#x2F;ssrn.4563364&quot;&gt;10.2139&#x2F;ssrn.4563364&lt;&#x2F;a&gt; (Original work published 2023) &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Data section access instructions</title>
        <published>2023-08-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7480/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7480-eof-data-instructions/15414" />
        

        <id>https://wg-eips.ritovision.com/7480/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7480"
            label="EIP-7480" />
        

        
        

        
        <summary type="html">Instructions to read data section of EOF container</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7480/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Four new instructions are introduced, that allow to read EOF container&#x27;s data section: &lt;code&gt;DATALOAD&lt;&#x2F;code&gt; loads 32-byte word to stack, &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; loads 32-byte word to stack where the word is addressed by a static immediate argument, &lt;code&gt;DATASIZE&lt;&#x2F;code&gt; loads data section size and &lt;code&gt;DATACOPY&lt;&#x2F;code&gt; copies a segment of data section to memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Clear separation between code and data is one of the main features of EOF1. Data section may contain anything, e.g. compiler&#x27;s metadata, but to make it useful for smart contracts, EVM has to have instructions that allow to read from data section. Previously existing instructions for bytecode inspection (&lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; etc.) are deprecated in EOF1 and cannot be used for this purpose.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;DATALOAD&lt;&#x2F;code&gt;, &lt;code&gt;DATASIZE&lt;&#x2F;code&gt;, &lt;code&gt;DATACOPY&lt;&#x2F;code&gt; instruction pattern follows the design of existing instructions for reading other kinds of data (i.e. returndata and calldata).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DATALOADN&lt;&#x2F;code&gt; is an optimized version of &lt;code&gt;DATALOAD&lt;&#x2F;code&gt;, where data offset to read is set at compilation time, and therefore need not be validated at run-time, which makes the instruction cheaper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce four new instructions on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DATALOAD&lt;&#x2F;code&gt; (0xd0)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATALOADN&lt;&#x2F;code&gt; (0xd1)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATASIZE&lt;&#x2F;code&gt; (0xd2)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATACOPY&lt;&#x2F;code&gt; (0xd3)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, all of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;If the code is valid EOF1, the following execution rules apply:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dataload&quot;&gt;&lt;code&gt;DATALOAD&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Pops one value, &lt;code&gt;offset&lt;&#x2F;code&gt;, from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Reads &lt;code&gt;[offset:offset+32]&lt;&#x2F;code&gt; segment from the data section and pushes it as 32-byte value to the stack.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + 32&lt;&#x2F;code&gt; is greater than the data section size, bytes after the end of data section are set to 0.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts 4 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;dataloadn&quot;&gt;&lt;code&gt;DATALOADN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Has one immediate argument,&lt;code&gt;offset&lt;&#x2F;code&gt;, encoded as a 16-bit unsigned big-endian value.&lt;&#x2F;li&gt;
&lt;li&gt;Pops nothing from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Reads &lt;code&gt;[offset:offset+32]&lt;&#x2F;code&gt; segment from the data section and pushes it as 32-byte value to the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts 3 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;[offset:offset+32]&lt;&#x2F;code&gt; is guaranteed to be within data bounds by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7480&#x2F;#code-validation&quot;&gt;code validation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;datasize&quot;&gt;&lt;code&gt;DATASIZE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Pops nothing from the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes the size of the data section of the active container to the stack.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts 2 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;datacopy&quot;&gt;&lt;code&gt;DATACOPY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Pops three values from the stack: &lt;code&gt;mem_offset&lt;&#x2F;code&gt;, &lt;code&gt;offset&lt;&#x2F;code&gt;, &lt;code&gt;size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Performs memory expansion to &lt;code&gt;mem_offset + size&lt;&#x2F;code&gt; and deducts memory expansion cost.&lt;&#x2F;li&gt;
&lt;li&gt;Deducts &lt;code&gt;3 + 3 * ((size + 31) &#x2F;&#x2F; 32)&lt;&#x2F;code&gt; gas for copying.&lt;&#x2F;li&gt;
&lt;li&gt;Reads &lt;code&gt;[offset:offset+size]&lt;&#x2F;code&gt; segment from the data section and writes it to memory starting at offset &lt;code&gt;mem_offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + size&lt;&#x2F;code&gt; is greater than data section size, 0 bytes will be copied for bytes after the end of the data section.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;We extend code section validation rules (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Code section is invalid in case an immediate argument &lt;code&gt;offset&lt;&#x2F;code&gt; of any &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; is such that &lt;code&gt;offset + 32&lt;&#x2F;code&gt; is greater than data section size, as indicated in the container header &lt;em&gt;before deployment&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument value (jump destination relative offset) validation: code section is invalid in case offset points to one of two bytes directly following &lt;code&gt;DATALOADN&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;zero-padding-on-out-of-bounds-access&quot;&gt;Zero-padding on out of bounds access&lt;&#x2F;h3&gt;
&lt;p&gt;Existing instructions for reading other kinds of data implicitly pad with zeroes on out of bounds access, with the only exception of return data copying.&lt;&#x2F;p&gt;
&lt;p&gt;It is beneficial to avoid exceptional failures, because compilers can employ optimizations like removing a code that copies data, but never accesses this copy afterwards, but such optimization is possible only if instruction never has other side effects like exceptional abort.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-extdatacopy&quot;&gt;Lack of &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; instruction is deprecated and rejected in EOF contracts and does not copy contract code when being called in legacy with an EOF contract as target. A replacement instruction &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt; has been considered, but decided against in order to reduce the scope of changes.&lt;&#x2F;p&gt;
&lt;p&gt;Data-only contracts which previously relied on &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; are thereby discouraged, but if there is a strong need, support for them can be easily brought back by introducing &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt; in a future upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced only for EOF1 contracts, for which deploying undefined instructions is not allowed, therefore there are no existing contracts using these instructions. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Gas cost of these new opcodes is comparable to the legacy &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; instruction. They must be carefully considered during the implementation of the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add time-weighted averaging to the base fee</title>
        <published>2023-07-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guy Goren</name><uri>https://github.com/guy-goren</uri><email>guy.nahsholim@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7378/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-time-weighted-averaging-to-the-base-fee-mechanism/15142" />
        

        <id>https://wg-eips.ritovision.com/7378/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7378"
            label="EIP-7378" />
        

        
        

        
        <summary type="html">Using geometric weights to average past block sizes into consideration</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7378/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new formula to update the base fee, derived from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;. The existing base fee update formula,&lt;&#x2F;p&gt;
&lt;p&gt;$$b[i+1]\triangleq  b[i] \cdot \left( 1+\frac{1}{8} \cdot \frac{s[i]-s^* }{s^* }\right)$$&lt;&#x2F;p&gt;
&lt;p&gt;only considers the last block size $s[i]$. This mechanism incentivizes proposers to collude with users to manipulate the base fee.&lt;&#x2F;p&gt;
&lt;p&gt;We propose that even previous block sizes be considered by replacing the last block size with an exponential moving average. In particular, we suggest the following base fee update formula:&lt;&#x2F;p&gt;
&lt;p&gt;$$b[i+1]\triangleq  b[i] \cdot \left( 1+\frac{1}{8} \cdot \frac{s_{\textit{avg}}[i]-s^* }{s^* }\right)$$&lt;&#x2F;p&gt;
&lt;p&gt;where $s_{\textit{avg}}[i]$ is defined by:&lt;&#x2F;p&gt;
&lt;p&gt;$$s_{\textit{avg}}[i] \triangleq \alpha\sum_{k=1}^{\infty} (1-\alpha)^k\cdot s[i-k+1]$$&lt;&#x2F;p&gt;
&lt;p&gt;and $\alpha\in(0,1)$ is a smoothing factor.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To reduce bribe motivation when the demand for blockspace is high (see Incentive Considerations section) and to reduce oscillations, thus, having a more stable fee setting mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;Proposers use a mechanism described in EIP-1559 to determine which messages to include in a block. This mechanism includes a &quot;base fee&quot;: a portion of the transaction fee that is burned. The base fee varies according to the fill rate of blocks. A target block size is defined. If a block exceeds the target size, the base fee increases, and if it is smaller, the base fee lowers.&lt;&#x2F;p&gt;
&lt;p&gt;Research on the subject have revealed issues with this transaction fee mechanism. It has been shown to be &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;LMRSP.pdf&quot;&gt;unstable in cases&lt;&#x2F;a&gt;. Moreover, it has been shown that the dynamic nature of the base fee, which is influenced by the fill rate of blocks, opens the door for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;manipulation by miners (proposers) and users&lt;&#x2F;a&gt;. The desired behavior of the system under a stable high demand, is for it to reach an equilibrium where the base fee -- $b$ -- is the significant part of the gas fee, and the tip is relatively small -- denoted $\varepsilon$ (for reference, Ethereum&#x27;s base fee often has $\frac{b}{\varepsilon}\approx 20$). According to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;TR1559.pdf&quot;&gt;Roughgarden&lt;&#x2F;a&gt; this is a rational equilibrium under the assumption that proposers do not think ahead. However, we expect a proposer to optimize its behavior by also considering its future payoffs. In essence, since neither the proposer nor the user are getting the burnt fee, by colluding they can both tap into the burnt fee for a win-win situation for them both.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;theoretical work&lt;&#x2F;a&gt; describes how both proposers and users can initiate such an attack. For example, we can imagine that users who wish to pay lower costs will coordinate the attack. Roughly, a user (or group of users) that has transactions with a total $g$ amount of gas bribes the proposer of the current block (no matter the proposer&#x27;s power) to propose an empty block instead. The cost of such a bribe is only $\varepsilon \times {s^* }$ -- the tip times the target block size. Consequently, the base fee reduces in the next block. If we accept that EIP-1559 reaches its goals, e.g., users would typically use a simple and honest bidding strategy of reporting their maximal willingness to pay plus adding a small tip ($\varepsilon$), then in the honest users&#x27; steady state, gas proposals leave the proposers with an $\varepsilon$ tip. Given that other users are naive (or slow to react), our bribing user will include its transactions with any tip larger than $\varepsilon$ -- making the attack profitable whenever $g \frac{b^* }{8} &amp;gt;s^* \varepsilon$.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;$s[i]$ is replaced by $s_{\textit{avg}}[i]$, where:&lt;&#x2F;p&gt;
&lt;p&gt;$$s_{\textit{avg}}[i] \triangleq \alpha\sum_{k=1}^{\infty} (1-\alpha)^k\cdot s[i-k+1]$$&lt;&#x2F;p&gt;
&lt;p&gt;which simplifies to the recursive form&lt;&#x2F;p&gt;
&lt;p&gt;$$s_{\textit{avg}}[i] = \alpha\cdot s[i] + (1-\alpha)\cdot s_{\textit{avg}}[i-1]$$&lt;&#x2F;p&gt;
&lt;p&gt;where $\alpha\in(0, 1)$ is the smoothing factor. A higher smoothing factor means that the average responds more quickly to changes in block size (e.g., if $\alpha = 1$ the proposed formula degenerates to the existing rule).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;An intuitive option for the Transaction Fee Mechanism (TFM) that adjusts supply and demand economically is &lt;em&gt;First price auction&lt;&#x2F;em&gt;, which is well known and studied. Nevertheless, the Ethereum network choice was to use EIP-1559 for the TFM (one stated reason was to try and simplify the fee estimation for users, and reduce the advantage of sophisticated users). In this proposal, our design goal is to improve the TFM (of EIP-1559) by mitigating known problems that it raises. It is important to note that these problems severity are in direct relation to the demand for block space, and currently only mildly impact the Ethereum network. If demand to use Ethereum increases, however, these problems are expected to exacerbate. We may want to prepare for this beforehand.&lt;&#x2F;p&gt;
&lt;p&gt;The change is based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;this work&lt;&#x2F;a&gt; that described a rational strategy in which bribes are profitable. Choosing to average based on a geometric series weights results in two desired properties: (i) the computation and space complexity are both in O(1), and (ii) the average gradually phases out the impact of a single outlier block without causing significant future fluctuations in the base fee.
Moreover, the theoretical analysis does not consider the income from classic MEV strategies. (Actually, the described strategy may be seen as another form of MEV.) The fact that classic MEV (sandwich, front running, etc.) are not included in the analysis, means that the proposed solutions to classic MEV (obscuring transactions etc.) will also not help against the described strategy. The problem that we tackle in this EIP is at the core of the base fee mechanism, with no further assumptions (such as MEV or predictability of randomness).&lt;&#x2F;p&gt;
&lt;p&gt;Remark: An additional alternative strategy that is not fully discussed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;here&lt;&#x2F;a&gt; but one may consider is to reduce the &#x27;max change denominator&#x27; (the learning rate) from 1&#x2F;8 to something smaller. However, this is problematic since it significantly affects the responsiveness of the base fee, making it slow to respond to actual persistent changes. The reason for using geometric series weights is precisely to achieve the favorable tradeoff of still responding quickly while mitigating incentive misalignments.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;incentive-considerations&quot;&gt;Incentive Considerations&lt;&#x2F;h3&gt;
&lt;p&gt;The proposal is designed to improve the incentive compatibility of the TFM. A &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;AGHH.pdf&quot;&gt;game theoretic analysis&lt;&#x2F;a&gt; shows that the current TFM, which is based on EIP-1559, encourages bribes.&lt;&#x2F;p&gt;
&lt;p&gt;One of the main goals of EIP-1559 was to simplify the bidding for users. It was articulated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7378&#x2F;.&#x2F;assets&#x2F;TR1559.pdf&quot;&gt;theoretically by Roughgarden&lt;&#x2F;a&gt; as users bidding their honest valuations being an optimal strategy. In contrast, when using first price auctions for the TFM (as done by Bitcoin and previously in Ethereum), it is typically sub-optimal for a user to bid its honest valuation. In other words, a TFM that encourages users to not fully reveal their preferences is considered less good. However, one may argue that a TFM that encourages bribes is worse than a TFM that encourages not revealing one&#x27;s full preferences.&lt;&#x2F;p&gt;
&lt;p&gt;Although a first price auction is a safe bet regarding TFMs, the Ethereum network chose to use EIP-1559 and burn transaction fees (perhaps for reasons other than game-theoretic ones). We therefore suggest to mitigate the current incentives for bribes using the above proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a hard fork since the base fee is enforced (for blocks to be considered valid).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Migration Transaction</title>
        <published>2023-07-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/samwilsn</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7377/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-xxxx-migration-transaction/15144" />
        

        <id>https://wg-eips.ritovision.com/7377/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7377"
            label="EIP-7377" />
        

        
        

        
        <summary type="html">Allow EOAs to send a one-time transaction which deploys code at their account.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7377/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type with the format &lt;code&gt;0x04 || rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit, codeAddr, storage, data, value, accessList, yParity, r, s])&lt;&#x2F;code&gt; which sets the sending account&#x27;s &lt;code&gt;code&lt;&#x2F;code&gt; field in the state trie to the &lt;code&gt;code&lt;&#x2F;code&gt; value at &lt;code&gt;codeAddr&lt;&#x2F;code&gt; and applies the storage tuples to the sender&#x27;s storage trie.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Smart contract wallets have long been touted as the solution to Ethereum&#x27;s user experience woes. As early as 2015, there were proposals for allowing smart contracts to originate transactions in hopes that new users would flock to smart contract wallets to store their assets. So far, only a fraction of users have elected to do so.&lt;&#x2F;p&gt;
&lt;p&gt;Today, account abstraction is still an important goal in Ethereum and there are many efforts attempting to realize it. We&#x27;re getting closer to succeeding at this, but unfortunately the years of failure have caused many users to simply rely on EOA.&lt;&#x2F;p&gt;
&lt;p&gt;After a user has accumulated enough assets in an EOA, it is not tenable to migrate each individual asset to a new address. This is due both to the cost and to needing to manually sign and verify potentially hundreds of transactions.&lt;&#x2F;p&gt;
&lt;p&gt;This is an overlooked piece of the problem. Converting &lt;em&gt;existing&lt;&#x2F;em&gt; users to smart contract wallets efficiently will expedite adoption and push forward better support and integrations for smart contract wallets. They will no longer be dismissed as a niche use case.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, we must provide a mechanism, embedded in the protocol, to migrate EOAs to smart contracts. This EIP proposes such mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At the fork block &lt;code&gt;X&lt;&#x2F;code&gt;, introduce the migration transaction type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;migration-transaction&quot;&gt;Migration Transaction&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;definition&quot;&gt;Definition&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;field&lt;&#x2F;th&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;maxFeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;maxPriorityFeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gasLimit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;codeAddr&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;storage&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;List[Tuple[uint256, uint256]]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;data&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bytes&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;accessList&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;List[Tuple[address, List[uint256]]]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;yParity&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The EIP-2718 &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;0x04&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is &lt;code&gt;rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit, codeAddr, storage, data, value, accessList, yParity, r, s])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction&#x27;s signature hash is &lt;code&gt;keccak256(0x04 || rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit, codeAddr, storage, data, value, accessList])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;A migration transaction is considered valid if the follow properties hold:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;all &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; properties, unless specified otherwise&lt;&#x2F;li&gt;
&lt;li&gt;the code at &lt;code&gt;codeAddr&lt;&#x2F;code&gt; is less than the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; limit of &lt;code&gt;24576&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the code at &lt;code&gt;codeAddr&lt;&#x2F;code&gt; must not have size &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The intrinsic gas calculation modified from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; to be &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count + 20000 * length of storage&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;processing&quot;&gt;Processing&lt;&#x2F;h4&gt;
&lt;p&gt;Executing a migration transaction has two parts.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;contract-deployment&quot;&gt;Contract Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;Unlike standard contract deployment, a migration transaction directly specifies what &lt;code&gt;code&lt;&#x2F;code&gt; value the sender&#x27;s account should be set to.&lt;&#x2F;p&gt;
&lt;p&gt;As the first step of processing the transaction, set the sender&#x27;s &lt;code&gt;code&lt;&#x2F;code&gt; to &lt;code&gt;state[tx.codeAddr].code&lt;&#x2F;code&gt;. Next, for each tuple in &lt;code&gt;tx.storage&lt;&#x2F;code&gt; and the sender&#x27;s storage trie, set &lt;code&gt;storage[t.first] = t.second&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transaction-execution&quot;&gt;Transaction Execution&lt;&#x2F;h5&gt;
&lt;p&gt;Now instantiate an EVM call into the sender&#x27;s account using the same rules as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; and set the transaction&#x27;s origin to be &lt;code&gt;keccak256(sender)[0..20]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;no-to-address-field&quot;&gt;No &lt;code&gt;to&lt;&#x2F;code&gt; address field&lt;&#x2F;h3&gt;
&lt;p&gt;This transaction is only good for one-time use to migrate an EOA to a smart contract. It is designed to immediately call the deployed contract, which is at the sender&#x27;s address, after deployment to allow the sender to do any kind of further processing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-pointer-for-deployment&quot;&gt;Code pointer for deployment&lt;&#x2F;h3&gt;
&lt;p&gt;Naively, one could design the migration transaction to have a field &lt;code&gt;code&lt;&#x2F;code&gt; of type &lt;code&gt;bytes&lt;&#x2F;code&gt;. However, there would be substantial duplication of code calldata, since many users will want to deploy the exact same thing (often a wallet). Using a pointer instead acknowledges this overwhelming use case for the transaction type, and exploits it as an optimization.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cheaper-storage&quot;&gt;Cheaper storage&lt;&#x2F;h3&gt;
&lt;p&gt;Since the storage is guaranteed to be empty, there is no need to read before write. This means only 20,000 gas is needed to pay for the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt; value. This is a small discount to the normal cost of &lt;code&gt;22,100&lt;&#x2F;code&gt;, which is &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt; plus the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; of &lt;code&gt;2100&lt;&#x2F;code&gt;, because no load occurs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;intrinsic-does-not-account-for-contract-deployment&quot;&gt;Intrinsic does not account for contract deployment&lt;&#x2F;h3&gt;
&lt;p&gt;This takes advantage of the fact that clients tend to store a single, unique copy of code; no matter the number of deployments. Therefore, the only operation here is changing a pointer in the state trie to the desired code.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the EOA already exists because it has enough balance for the migration transaction to be considered valid. Therefore, we don&#x27;t need to pay a premium for adding a new account into the state trie.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;manipulating-transaction-origin&quot;&gt;Manipulating transaction origin&lt;&#x2F;h3&gt;
&lt;p&gt;Many applications have a security check &lt;code&gt;caller == origin&lt;&#x2F;code&gt; to verify the caller is an EOA. This is done to &quot;protect&quot; assets. While it is usually more of a bandage than an actual fix, we attempt to placate these projects by modifying the origin of the transaction so the check will continue performing its duty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;one-time-migration&quot;&gt;One-time migration&lt;&#x2F;h3&gt;
&lt;p&gt;There is no technical reason we couldn&#x27;t allow EOAs to change their code at any time with this transaction type. The only inhibitor at the moment is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt; which will cause migration transactions to be considered invalid if they come from an account with code already deployed. A functional reason for retaining this behavior though is that it makes it simpler to reason about contracts and their upgradability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blind-signing&quot;&gt;Blind Signing&lt;&#x2F;h3&gt;
&lt;p&gt;As with all sufficiently sophisticated account designs, if a user can be convinced to sign an arbitrary message, that message could be a migration transaction which is owned by a malicious actor instead of the user. This can generally be avoided if wallets treat these transactions with &lt;em&gt;extreme&lt;&#x2F;em&gt; care and create as much friction and verification as possible before completing the signature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-ecrecover&quot;&gt;On &lt;code&gt;ecrecover&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Applications standards such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612: Permit Extension&lt;&#x2F;a&gt; have exploited the cryptographic relationship between EOA addresses and their private keys. Many tokens today support this extension, allowing EOAs to approve the transfer of fund from their account using only a signature. Although collisions between EOAs and contract accounts are considered unlikely and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;maybe impossible&lt;&#x2F;a&gt; given today&#x27;s computing power, this EIP would make it common place for private keys to exist for contract accounts. There are some considerations here regarding security:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The obvious attack is a defi protocol deploys some their contract using this EIP and later sign an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt; message to steal the funds accrued in the contract. This can be avoided by wallets simply not allowing users to interact with protocols deployed in this manner.&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s also worth mentioning that there are concerns around how this EIP will affect the cross chain experience. Ultimately a users private key may still have some control over the account&#x27;s assets, depending on the exact protocols used on Ethereum and on other chains. It isn&#x27;t really possible perfectly migrate the EOA at the same time, on all chains. The best thing that can be done is to educate the user that just because their account has been migrated doesn&#x27;t mean that they are safe to now publicly reveal their private key. This seems like a reasonable request, especially since they&#x27;ll want to retain the private key in case they want to use the address on any other EVM-like chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Something that may alleviate these issues to some degree would be to add an &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; check in &lt;code&gt;ecrecover&lt;&#x2F;code&gt;. If the recovered account has code, the precompile will revert. This would disallow migrated EOAs from using standards like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2612&#x2F;&quot;&gt;ERC-2612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove BLAKE2 compression precompile</title>
        <published>2023-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>pcaversaccio</name><uri>https://github.com/pcaversaccio</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7266/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-removal-of-ripemd-160-and-blake2f-precompiles/14857" />
        

        <id>https://wg-eips.ritovision.com/7266/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:7266"
            label="EIP-7266" />
        

        
        

        
        <summary type="html">Remove the blake2f (0x09) precompile by changing the precompile behaviour to result in an exceptional abort</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7266/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP removes the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;152&#x2F;&quot;&gt;&lt;code&gt;blake2f&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) precompile by changing the precompile behaviour to result in an exceptional abort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;152&#x2F;&quot;&gt;EIP-152&lt;&#x2F;a&gt; has never capitalised on a real-world use case. This fact is clearly reflected in the number of times the address &lt;code&gt;0x09&lt;&#x2F;code&gt; has been invoked (numbers from the date this EIP was created):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The most recent call took place on 6 October 2022.&lt;&#x2F;li&gt;
&lt;li&gt;Since its gone live as part of the Istanbul network upgrade on December 7 2019 (block number 9,069,000), &lt;code&gt;0x09&lt;&#x2F;code&gt; has been called only 22,131 times.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;One of the reasons why &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;152&#x2F;&quot;&gt;EIP-152&lt;&#x2F;a&gt; has failed is that the envisioned use cases were not validated before inclusion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;All &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; invocations to the &lt;code&gt;blake2f&lt;&#x2F;code&gt; precompile address &lt;code&gt;0x09&lt;&#x2F;code&gt; MUST result in an exceptional halting state that consumes all supplied gas and returns no data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM should be optimised for simplicity and future-proofness. The original Yellow Paper states: &lt;em&gt;these are so-called &#x27;precompiled&#x27; contracts, meant as a preliminary piece of architecture that may later become native extensions&lt;&#x2F;em&gt;. Considering that no use cases have been realised in the last 3.5 years, we can conclude that the precompile &lt;code&gt;blake2f&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) will never transition into a native opcode. In that sense, the precompile &lt;code&gt;blake2f&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) is an obsolete carry-along with no real-world traction and thus should be removed. This removal will simplify the EVM to the extent that it only consists of clear instructions with real-world use cases. Eventually, the precompile &lt;code&gt;blake2f&lt;&#x2F;code&gt; (&lt;code&gt;0x09&lt;&#x2F;code&gt;) can be safely used as a test run for the phase-out and removal of EVM functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork as it modifies the consensus rules. Note that very few applications are affected by this change and a lead time of 6-12 months can be considered sufficient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known additional security considerations introduced by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile Falcon512 generic verifier</title>
        <published>2023-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Erick Pacheco Pedraza</name><uri>https://github.com/eum602</uri>
	</author>
	
	<author>
		<name>Marcos Allende</name><email>mallende@lacnet.com</email>
	</author>
	
	<author>
		<name>Diego Lopez León</name><email>dieguitoll@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7619/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/falcon-512-precompiled-generic-signature-verifier/18569" />
        

        <id>https://wg-eips.ritovision.com/7619/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7619"
            label="EIP-7619" />
        

        
        

        
        <summary type="html">Add precompiled contract that allows generic signature verifications using Falcon512 postquantum algorithm</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7619/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Include a precompiled signature verification function using Falcon-512. Falcon-512 is a candidate for standardization by the National Institute of Standards and Technology (NIST) and is quantum resistant with security level I.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The advent of quantum computing threatens blockchain protocols and networks because they utilize non-quantum resistant cryptographic algorithms. When quantum computers become robust enough to run Shor’s algorithm (a quantum algorithm to find the prime factors of an integer) on a large scale, the most used asymmetric algorithms, utilized for digital signatures and message encryption, such as RSA, (EC)DSA, and (EC)DH, will be no longer secure. Quantum computers will be able to break them within a short period of time. Today, there are hundreds of billions of dollars denominated in cryptocurrencies and other digital assets that rely on blockchain ledgers as well as thousands of blockchain-based applications storing value in blockchain networks. Cryptocurrencies and blockchain-based applications require solutions that guarantee quantum resistance in order to preserve the integrity of data and assets in these public and immutable ledgers. Most proposals for quantum-resistant blockchain networks are theoretical, require large QKD (quantum key distribution, a secure communication method that implements a cryptographic protocol involving components of quantum mechanics) networks, or propose new quantum-resistant blockchain protocols to be built from scratch. This EIP is pioneer in proposing a solution compatible with current EVM blockchain protocols. It presents a simple mechanism to add a NIST-compliant post-quantum signature to blockchain transactions, making them quantum-resistant even when ECC (elliptic curve cryptography) cryptography becomes vulnerable against attacks by quantum computers. We have developed a Solidity implementation for the on-chain verification of this signatures, which does not scale due to the required high amount of gas. This is why &lt;strong&gt;this EIP is proposing a pre-compiled smart contract&lt;&#x2F;strong&gt; that allows to verify post-quantum signatures in a scalable manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A clean implementation for Falcon-512 algorithm was brought from the PQClean project.&lt;&#x2F;p&gt;
&lt;p&gt;The precompiled signature verification function runs at address &lt;code&gt;0x65&lt;&#x2F;code&gt;. The required inputs are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;public key&lt;&#x2F;code&gt; - Falcon Public key of 897 bytes&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature&lt;&#x2F;code&gt; - 666 bytes (max size)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;message&lt;&#x2F;code&gt; - an arbitrary number of bytes representing the message that was signed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Those inputs are encoded according to:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[pubkey:897 bytes][signature:666 bytes][message: remainder]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Output is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;result&lt;&#x2F;code&gt; -
A successful signature verification returns &lt;code&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;, otherwise &lt;code&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; indicating all other failure cases where sufficient gas has been provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The precompile will only revert in the case where insufficient gas has been provided. Data format errors, size errors, and invalid signatures will not cause the precompile to revert.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Input:         &amp;quot;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Gas:           10,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ExpectedError: &amp;quot;out of gas&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name:          &amp;quot;empty input, too little gas&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  },&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Input:         &amp;quot;111111110000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000006e0&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Gas:           1000000,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Result:        &amp;quot;000000000000000000000000000000000000000000000000000000000000000000000000&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Name:          &amp;quot;garbled input&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;example-usage-in-solidity&quot;&gt;Example Usage in Solidity&lt;&#x2F;h3&gt;
&lt;p&gt;The precompile can be wrapped in Solidity to provide a more development-friendly interface to &lt;code&gt;Falcon-512&lt;&#x2F;code&gt; signature verification.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; verify&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; publicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; calldata&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; isValid&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt; success&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; verifies&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x0000000000000000000000000000000000000065&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            .&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;                abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    publicKey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    message&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;success &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; verifies&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;length &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &amp;quot;Invalid signature&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; verifies&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;31&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Since data size is variable, each operation to execute the precompiled call will require:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;1465 base units of gas for each operation.&lt;&#x2F;li&gt;
&lt;li&gt;6 units of gas for each word contained in the payload.
These values are based on results presented at the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;#benchmarks&quot;&gt;benchmarks&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Falcon-512 is a good candidate for a new signature implementation. Key sizes in Falcon-512 are relatively small compared to other post-quantum signature algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;The following table shows a summary of the typical values for keys and the approximate amount of time taken per second to execute signature verifications as specified by the authors of Falcon algorithm:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;strong&gt;variant&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;verify&#x2F;s&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;pub size(bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;strong&gt;sig size(bytes)&lt;&#x2F;strong&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Falcon512&lt;&#x2F;td&gt;&lt;td&gt;27933.0&lt;&#x2F;td&gt;&lt;td&gt;897&lt;&#x2F;td&gt;&lt;td&gt;666&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Falcon uses shake256 under the hood, an implementation made in solidity showed it is not viable to implement this algorithm at that layer, on the other hand the implementation of falcon-512 by using precompiles turned to be the best approach since the gas cost (as shown in the previous section) is relatively low.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing just the signature verification is sufficiently enough to open a wide range of use cases at the smart contract level. To give an example, this method can perfectly work with the Account Abstraction concept, where the authentication process would rely on Falcon and the account is a smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarks&quot;&gt;benchmarks&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming ecRecover precompile is perfectly priced, a set of benchmarks were executed comparing Falcon-512 signature verification function precompile with ecRecover precompile. For benchmarks, it was used 2.6 GHz Intel Core i7 64-bit machine.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; cat&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; &#x2F;proc&#x2F;cpuinfo&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; grep&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;model name&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Intel(R&lt;&#x2F;span&gt;&lt;span&gt;) Core(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TM&lt;&#x2F;span&gt;&lt;span&gt;) i7-10750H CPU @ 2.60GHz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;5-seconds-benchmark&quot;&gt;5 seconds benchmark&lt;&#x2F;h4&gt;
&lt;p&gt;Based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;bench_vectors&#x2F;&quot;&gt;100 test vectors with valid signatures&lt;&#x2F;a&gt; a benchmark of 5 seconds, for each test vector, was performed, considering the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the average time per operation (ns&#x2F;op),&lt;&#x2F;li&gt;
&lt;li&gt;each vector size increases in 33 bytes&lt;&#x2F;li&gt;
&lt;li&gt;Ecrecover is well tested&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Benchmark results &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;benchmark_results&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Then the 100 BenchmarkPrecompiledFalcon512 results were approximated to a linear equation dependent on the number of bytes in each test vector. From the approximation it was concluded that 1465 units of gas is the base requirement for any falcon-512 signature validation and 6 gas per word is additionally required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is very little risk of breaking backwards-compatibility with this EIP, the sole issue being if someone were to build a contract relying on the address at &lt;code&gt;0x65&lt;&#x2F;code&gt; being empty. The likelihood of this is low, and should specific instances arise, the address could be chosen to be any arbitrary value with negligible risk of collision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A set of test vectors, with valid signatures, for benchmarking on new implementations is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;bench_vectors&#x2F;&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A set of test vectors, with invalid data, to verify some invalid signature cases is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7619&#x2F;assets&#x2F;invalid_signature_test_vectors&#x2F;&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Since the scope of this proposal is encapsulated at the contract level for verifying signatures it doesn&#x27;t represent issues in regards to security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase the MAX_EFFECTIVE_BALANCE</title>
        <published>2023-06-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>mike</name><uri>https://github.com/michaelneuder</uri>
	</author>
	
	<author>
		<name>Francesco</name><uri>https://github.com/fradamt</uri>
	</author>
	
	<author>
		<name>dapplion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Mikhail</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Aditya</name><uri>https://github.com/adiasg</uri>
	</author>
	
	<author>
		<name>Justin</name><uri>https://github.com/justindrake</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7251/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7251-increase-the-max-effective-balance/15982" />
        

        <id>https://wg-eips.ritovision.com/7251/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7251"
            label="EIP-7251" />
        

        
        

        
        <summary type="html">Allow validators to have larger effective balances, while maintaining the 32 ETH lower bound.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7251/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increases the constant &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, while keeping the minimum staking balance &lt;code&gt;32 ETH&lt;&#x2F;code&gt;. This permits large node operators to consolidate into fewer validators while also allowing solo-stakers to earn compounding rewards and stake in more flexible increments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As of October 3, 2023, there are currently over 830,000 validators participating in the consensus layer. The size of this set continues to grow due, in part, to the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, which limits the stake of a single validator to &lt;code&gt;32 ETH&lt;&#x2F;code&gt;. This leads to large amounts of &quot;redundant validators&quot;, which are controlled by a single entity, possibly running on the same beacon node, but with distinct BLS signing keys. The limit on the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; is technical debt from the original sharding design, in which subcommittees (not the attesting committee but the committee calculated in &lt;code&gt;is_aggregator&lt;&#x2F;code&gt;) needed to be majority honest. As a result, keeping the weights of subcommittee members approximately equal reduced the risk of a single large validator containing too much influence. Under the current design, these subcommittees are only used for attestation aggregation, and thus only have a &lt;code&gt;1&#x2F;N&lt;&#x2F;code&gt; honesty assumption.&lt;&#x2F;p&gt;
&lt;p&gt;With the security model of the protocol no longer dependent on a low value for &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, we propose raising this value while keeping the minimum validator threshold of &lt;code&gt;32 ETH&lt;&#x2F;code&gt;. This increase aims to reduce the validator set size, thereby reducing the number of P2P messages over the network, the number of BLS signatures that need to be aggregated each epoch, and the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; memory footprint. This change adds value for both small and large validators. Large validators can consolidate to run fewer validators and thus fewer beacon nodes. Small validators now benefit from compounding rewards and the ability to stake in more flexible increments (e.g., the ability to stake &lt;code&gt;40 ETH&lt;&#x2F;code&gt; instead of needing to accumulate &lt;code&gt;64 ETH&lt;&#x2F;code&gt; to run two validators today).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for consolidation request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000BBdDc7CE488642fb579F8B00f3a590007251&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about consolidation request mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the head of the consolidation request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the consolidation request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The start memory slot of the in-state consolidation request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of consolidation requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_CONSOLIDATION_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(&#x27;0x02&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Gwei(2**5 * 10**9)&lt;&#x2F;code&gt;  (32 ETH)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_EFFECTIVE_BALANCE_ELECTRA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Gwei(2**11 * 10**9)&lt;&#x2F;code&gt; (2048 ETH)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer-1&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;consolidation-request&quot;&gt;Consolidation request&lt;&#x2F;h4&gt;
&lt;p&gt;The new consolidation request is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request with type &lt;code&gt;0x02&lt;&#x2F;code&gt; consisting of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;source_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;source_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;target_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a consolidation request is as follows. Note we simply return the encoded request value as returned by the contract.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;consolidation-request-contract&quot;&gt;Consolidation request contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add consolidation request - requires a &lt;code&gt;96&lt;&#x2F;code&gt; byte input, concatenated public keys of the source and the target validators.&lt;&#x2F;li&gt;
&lt;li&gt;Fee getter - if the input length is zero, return the current fee required to add a consolidation request.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by system address, pop off the consolidation requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;add-consolidation-request&quot;&gt;Add Consolidation Request&lt;&#x2F;h5&gt;
&lt;p&gt;If call data input to the contract is exactly &lt;code&gt;96&lt;&#x2F;code&gt; bytes, perform the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensure enough ETH was sent to cover the current consolidation request fee (&lt;code&gt;msg.value &amp;gt;= get_fee()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Increase consolidation request count by &lt;code&gt;1&lt;&#x2F;code&gt; for the current block (&lt;code&gt;increment_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Insert a consolidation request into the queue for the source address and pubkeys of the source and the target (&lt;code&gt;insert_consolidation_request_into_queue()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Specifically, the functionality is defined in pseudocode as the function &lt;code&gt;add_consolidation_request()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add_consolidation_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; Bytes48&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Add consolidation request adds new request to the consolidation request queue, so long as a sufficient fee is provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sufficient fee was provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Insufficient value for fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment consolidation request count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert into queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt; target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;fee-calculation&quot;&gt;Fee calculation&lt;&#x2F;h6&gt;
&lt;p&gt;The following pseudocode can compute the cost of an individual consolidation request, given a certain number of excess consolidation requests.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inhibitor still active&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_CONSOLIDATION_REQUEST_FEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        CONSOLIDATION_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fee-getter&quot;&gt;Fee Getter&lt;&#x2F;h5&gt;
&lt;p&gt;When the input to the contract is length zero, interpret this as a get request for the current fee, i.e. the contract returns the result of &lt;code&gt;get_fee()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;system-call&quot;&gt;System Call&lt;&#x2F;h5&gt;
&lt;p&gt;At the end of processing any execution block where this EIP is active (i.e. after processing all transactions and after performing the block body consolidation requests validations), call the contract at &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with no calldata. The invocation triggers the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract&#x27;s queue is updated based on consolidation requests dequeued and the consolidation requests queue head&#x2F;tail are reset if the queue has been cleared (&lt;code&gt;dequeue_consolidation_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s excess consolidation requests are updated based on usage in the current block (&lt;code&gt;update_excess_consolidation_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s consolidation requests count is reset to &lt;code&gt;0&lt;&#x2F;code&gt; (&lt;code&gt;reset_consolidation_requests_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each consolidation request must appear in the EIP-7685 requests list in the exact order returned by &lt;code&gt;dequeue_consolidation_requests()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the system call and the processing of that block must conform to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The call has a dedicated gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas consumed by this call does not count against the block’s overall gas usage.&lt;&#x2F;li&gt;
&lt;li&gt;Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The call does not follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee burn semantics — no value should be transferred as part of this call.&lt;&#x2F;li&gt;
&lt;li&gt;If there is no code at &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, the corresponding block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If the call to the contract fails or returns an error, the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The functionality triggered by the system call is defined in pseudocode as the function &lt;code&gt;process_consolidation_requests()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_excess_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_consolidation_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ssz&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reqs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helpers #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ConsolidationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dequeue_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_in_queue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_dequeued&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_in_queue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_dequeued&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        req&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ConsolidationRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            target_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;target_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reqs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;req&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; num_dequeued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queue is empty, reset queue pointers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_excess_consolidation_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check if excess needs to be reset to 0 for first iteration after activation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_CONSOLIDATION_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reset_consolidation_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; CONSOLIDATION_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xd3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x019a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0129&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x013b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0146&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0173&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0188&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x018e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;The consolidation requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f5561019e80602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1460d35760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1461019a57600182026001905f5b5f82111560685781019083028483029004916001019190604d565b9093900492505050366060146088573661019a573461019a575f5260205ff35b341061019a57600154600101600155600354806004026004013381556001015f358155600101602035815560010160403590553360601b5f5260605f60143760745fa0600101600355005b6003546002548082038060021160e7575060025b5f5b8181146101295782810160040260040181607402815460601b815260140181600101548152602001816002015481526020019060030154905260010160e9565b910180921461013b5790600255610146565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff141561017357505f5b6001546001828201116101885750505f61018e565b01600190035b5f555f6001556074025ff35b5f5ffd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xc0730f92dc275b663d377a7cbb141b6600052&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x379269d571beff3ed1d8eba3abb24076a7267b0eaf0cc66d728fb0544f5a690d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sender: 0x13d1913d623E6a9D8811736359E50fD31Fe54fCA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: 0x0000BBdDc7CE488642fb579F8B00f3a590007251&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer-1&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;The defining features of this EIP are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Increasing the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, while creating a &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; The core feature of allowing variable size validators.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Allowing for multiple validator indices to be combined through the protocol.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; A mechanism by which large node operators can combine validators without cycling through the exit and activation queues.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Adding execution layer partial withdrawals (part of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;).&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; Allowing Execution Layer messages to trigger partial withdrawals in addition to full exits (e.g., a &lt;code&gt;100 ETH&lt;&#x2F;code&gt; validator can remove up to &lt;code&gt;68 ETH&lt;&#x2F;code&gt; without exiting the validator).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;&lt;strong&gt;Making the initial slashing penalty negligible.&lt;&#x2F;strong&gt;&lt;&#x2F;em&gt; This reduces the risk of consolidation for large validators.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7251&#x2F;#rationale&quot;&gt;Rationale&lt;&#x2F;a&gt; section contains an explanation for each of these proposed core features. A sketch of the resulting changes to the consensus layer is included below.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;COMPOUNDING_WITHDRAWAL_PREFIX&lt;&#x2F;code&gt; and &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt; constants, while introducing the updated value of &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;MAX_EFFECTIVE_BALANCE_ELECTRA&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Create the &lt;code&gt;PendingDeposit&lt;&#x2F;code&gt; container, which is used to track incoming deposits in the weight-based rate limiting mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;Update the &lt;code&gt;BeaconState&lt;&#x2F;code&gt; with deposit and partial withdrawal queues, fields needed for deposit, and exit queue weight-based rate limiting.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;is_eligible_for_activation_queue&lt;&#x2F;code&gt; to check against &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt; rather than &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_validator_churn_limit&lt;&#x2F;code&gt; to depend on the validator weight rather than the validator count.&lt;&#x2F;li&gt;
&lt;li&gt;Create a helper &lt;code&gt;compute_exit_epoch_and_update_churn&lt;&#x2F;code&gt; to calculate the exit epoch based on the current pending withdrawals.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;initiate_validator_exit&lt;&#x2F;code&gt; to rate limit the exit queue by balance rather than the number of validators.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;initialize_beacon_state_from_eth1&lt;&#x2F;code&gt; to use &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_registry_updates&lt;&#x2F;code&gt; to activate all eligible validators.&lt;&#x2F;li&gt;
&lt;li&gt;Add a per-epoch helper, &lt;code&gt;process_pending_deposits&lt;&#x2F;code&gt;, to consume some of the pending deposits.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_validator_from_deposit&lt;&#x2F;code&gt; to initialize the effective balance to zero (it&#x27;s updated by the pending deposit flow).&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;process_deposit&lt;&#x2F;code&gt; to store incoming deposits in &lt;code&gt;state.pending_deposits&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;compute_weak_subjectivity_period&lt;&#x2F;code&gt; to use the new churn limit function.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;has_compounding_withdrawal_credential&lt;&#x2F;code&gt; to check for the &lt;code&gt;0x02&lt;&#x2F;code&gt; credential.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;is_fully_withdrawable_validator&lt;&#x2F;code&gt; to check for compounding credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;get_validator_excess_balance&lt;&#x2F;code&gt; to calculate the excess balance of validators.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;is_partially_withdrawable_validator&lt;&#x2F;code&gt; to check for excess balance.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;code&gt;get_expected_withdrawals&lt;&#x2F;code&gt; to use excess balance and process pending partial withdrawals.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;process_consolidation&lt;&#x2F;code&gt; to initiate in-protocol validator consolidation and switch a validator to compounding withdrawal credentials.&lt;&#x2F;li&gt;
&lt;li&gt;Limits the usage of exit churn to 256 ETH (equivalent to 8 validators with 32 ETH effective balance), and defers the surplus of the churn to process consolidations.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Full consensus layer specification can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;834e40604ae4411e565bd6540da50b008b2496dc&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;.&#x2F;electra&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP aims to reduce the total number of validators without changing anything about the economic security of the protocol. It provides a mechanism by which large node operators who control significant amounts of stake can consolidate into fewer validators. We analyze the reasoning behind each of the core features.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;increasing-the-max-effective-balance-while-creating-a-min-activation-balance&quot;&gt;Increasing the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;, while creating a &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;While increasing the &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt; to allow larger-stake validators, it is important to keep the lower bound of &lt;code&gt;32 ETH&lt;&#x2F;code&gt; (by introducing a new constant – &lt;code&gt;MIN_ACTIVATION_BALANCE&lt;&#x2F;code&gt;) to encourage solo-staking.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-for-multiple-validator-indices-to-be-combined-through-the-protocol&quot;&gt;Allowing for multiple validator indices to be combined through the protocol&lt;&#x2F;h3&gt;
&lt;p&gt;For large staking pools that already control thousands of validators, exiting and re-entering would be extremely slow and costly. The adoption of the EIP will be much higher by allowing in-protocol consolidation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adding-execution-layer-partial-withdrawals-part-of-eip-7002&quot;&gt;Adding execution layer partial withdrawals (part of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;&quot;&gt;EIP-7002&lt;&#x2F;a&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;For validators that choose to raise their effective balance ceiling, allowing for custom partial withdrawals triggered from the execution layer increases the flexibility of the staking configurations. Validators can choose when and how much they withdraw but will have to pay gas for the EL transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;making-the-initial-slashing-penalty-negligible&quot;&gt;Making the initial slashing penalty negligible&lt;&#x2F;h3&gt;
&lt;p&gt;To encourage consolidation, we could modify the slashing penalties. The biggest hit comes from the initial penalty of &lt;code&gt;1&#x2F;32&lt;&#x2F;code&gt; of the validator&#x27;s effective balance. Since this scales linearly on the effective balance, the higher-stake validators directly incur higher risk. By changing the scaling properties, we could make consolidation more attractive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consolidation-contract-parameter-values&quot;&gt;Consolidation contract parameter values&lt;&#x2F;h3&gt;
&lt;p&gt;The consolidation smart contract uses a fee mechanism to rate limit the number of requests per block. Details of the fee mechanism are available in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;#fee-update-rule&quot;&gt;EIP-7002&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TARGET_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; is chosen to be &lt;code&gt;1&lt;&#x2F;code&gt; to rate limit consolidation requests as much as possible.
&lt;code&gt;MAX_CONSOLIDATION_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; is chosen to be &lt;code&gt;2&lt;&#x2F;code&gt; to allow for switching a validator to compounding credentials and requesting a consolidation in the same block.&lt;&#x2F;p&gt;
&lt;p&gt;One consolidation per block is still higher than the size of consolidation churn which can lead to unbounded growth of the consolidation queue.
Thus, there is a hard limit on the consolidation queue size equal to 262,144 requests which is &lt;code&gt;4 MB&lt;&#x2F;code&gt; of data in the beacon state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the block validation rule set and must be accompanied by a hard fork. These changes do not break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This change modifies committees and churn, but doesn&#x27;t significantly impact the security properties.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-of-attestation-committees&quot;&gt;Security of attestation committees&lt;&#x2F;h3&gt;
&lt;p&gt;Given full consolidation as the worst case, the probability of an adversarial takeover of a committee remains low. Even in a high consolidation scenario, the required share of honest validators remains well below the 2&#x2F;3 supermajority needed for finality.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aggregator-selection&quot;&gt;Aggregator selection&lt;&#x2F;h3&gt;
&lt;p&gt;In the original sharding roadmap, subcommittees were required to be secure with extremely high probability. Now with the sole responsibility of attestation aggregation, we only require each committee to have at least one honest aggregator. Currently, aggregators are selected through a VRF lottery, targeting several validator units that can be biased by non-consolidated attackers. This proposal changes the VRF lottery to consider weight, so the probability of having at least one honest aggregator is not worse.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposer-selection-probability&quot;&gt;Proposer selection probability&lt;&#x2F;h3&gt;
&lt;p&gt;Proposer selection is already weighted by the ratio of their effective balance to &lt;code&gt;MAX_EFFECTIVE_BALANCE&lt;&#x2F;code&gt;. Due to the lower probabilities, this change will slightly increase the time it takes to calculate the next proposer index.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sync-committee-selection-probability&quot;&gt;Sync committee selection probability&lt;&#x2F;h3&gt;
&lt;p&gt;Sync committee selection is also already weighted by effective balance, so this proposal does not require modifications to the sync protocol. Light clients can still check that a super-majority of participants have signed an update irrespective of their weights since we maintain a weight-based selection probability.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;churn-invariants&quot;&gt;Churn invariants&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal maintains the activation and exit churn invariants limiting active weight instead of validator count. Balance top-ups are now handled explicitly, being subject to the same activation queue as full deposits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-overpayment&quot;&gt;Fee Overpayment&lt;&#x2F;h3&gt;
&lt;p&gt;Calls to the system contract require a fee payment defined by the current contract state. Overpaid fees are not returned to the caller. It is not generally possible to compute the exact required fee amount ahead of time. When adding a consolidation request from a contract, the contract can perform a read operation to check for the current fee and then pay exactly the required amount. Here is an example in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function addConsolidation(bytes memory srcPubkey, bytes memory targetPubkey, uint64 requestFeeLimit) private {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(srcPubkey.length == 48);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(targetPubkey.length == 48);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Read current fee from the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool readOK, bytes memory feeData) = ConsolidationsContract.staticcall(&amp;#39;&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!readOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;reading fee failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 fee = uint256(bytes32(feeData));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Check the fee is not too high.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (fee &amp;gt; requestFeeLimit) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;fee is too high&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Add the request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory callData = bytes.concat(srcPubkey, targetPubkey);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool writeOK,) = ConsolidationsContract.call{value: fee}(callData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!writeOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;adding request failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: the system contract uses the EVM &lt;code&gt;CALLER&lt;&#x2F;code&gt; operation (Solidity: &lt;code&gt;msg.sender&lt;&#x2F;code&gt;) to get the address used in the consolidation request, i.e. the address that calls the system contract must match the 0x01 withdrawal credential recorded in the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;Note: the above code reverts if the fee is too high, the fee can change significantly between the creation of a consolidation request transaction and its inclusion into a block, thus, this check is very important to avoid overpayments.&lt;&#x2F;p&gt;
&lt;p&gt;Using an EOA to request consolidations will always result in overpayment of fees. There is no way for an EOA to use a wrapper contract to request a consolidation. And even if a way existed, the gas cost of returning the overage would likely be higher than the overage itself. If requesting consolidations from an EOA to the system contract is desired, we recommend that users perform transaction simulations to estimate a reasonable fee amount to send.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consolidation-queue-hard-limit&quot;&gt;Consolidation queue hard limit&lt;&#x2F;h3&gt;
&lt;p&gt;Consolidations exceeding the hard limit of the consolidation queue (262,144 requests) will be discarded by the consensus layer and will need to be re-submitted,
note that the fee is not refunded in this case.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-call-failure&quot;&gt;System Call failure&lt;&#x2F;h3&gt;
&lt;p&gt;Although the likelihood of a failed system call to &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; is extremely low, the behavior in such cases is well-defined: the block is marked as invalid. This consideration directly follows from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;#system-call-failure&quot;&gt;EIP-7002&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empty-code-failure&quot;&gt;Empty Code failure&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP should not have been activated if there is no code present at &lt;code&gt;CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; (i.e., if the chain is not &quot;ready&quot;). This is also similar to the consideration in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;#empty-code-failure&quot;&gt;EIP-7002&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Perpetually Valid Signed Voluntary Exits</title>
        <published>2023-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7044/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7044-perpetually-valid-signed-voluntary-exits/14348" />
        

        <id>https://wg-eips.ritovision.com/7044/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7044"
            label="EIP-7044" />
        

        
        

        
        <summary type="html">Lock voluntary exit signature domain on capella for perpetual validity</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7044/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Lock validator voluntary exit signature domain on Capella for perpetual validity. Currently, signed voluntary exits are only valid for two upgrades.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, signed voluntary exits are valid up-to only two upgrades for block inclusion due to the Beacon Chain state considering only the current and previous fork version. This limitation increases the complexity of some staking operations, specifically those in which the staking operator (holder of active key) is distinct from the owner of the funds (holder of the withdrawal credential). Because voluntary exits can only be signed by the active key, such a relationship requires the exchange of signed exits ahead of time for an unbounded number of forks.&lt;&#x2F;p&gt;
&lt;p&gt;The limited validity of voluntary exits was originally motivated to isolate them in the event of a hard fork that results in two maintained chains. If fork A and B exist and a validator operates on both, if they send an exit, it will be replayable on both. However, this possibility is not sufficient to justify the UX degradation exposed above, as no funds are at risk and the staker can re-stake on one or both of the chains.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;Specification changes are built into the Consensus Specs Deneb upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;The specific makes one change to the state transition function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;75971a8c218b1d76d605dd8b88a08d39c42de221&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#modified-process_voluntary_exit&quot;&gt;&lt;code&gt;process_voluntary_exit&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to compute the signing domain and root fixed on &lt;code&gt;CAPELLA_FORK_VERSION&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the &lt;code&gt;voluntary_exit&lt;&#x2F;code&gt; gossip conditions are implicitly modified to support this change.&lt;&#x2F;p&gt;
&lt;p&gt;To make the change backwards compatible the signature domain is locked on the Capella fork&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This specification does not require any changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Perpetually valid signed voluntary exits allow simpler staking operation designs. It also aligns the UX of such objects to &lt;code&gt;BLSToExecutionChanges&lt;&#x2F;code&gt; and deposits, such that downstream tooling does not need to be updated with fork version information.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is backwards compatible to the Consensus Layer of Ethereum block processing logic.&lt;&#x2F;p&gt;
&lt;p&gt;The expectation of future validity of exits is not forward compatible. Specifically, users who have already pre-signed exits utilizing the Deneb fork domain with an expectation of their validity should be aware that these pre-signed exits will no longer be recognized as valid. Consequently, users should adjust their approach moving forward. For continued validity across forks, including Deneb and subsequent forks, users should ensure that their exits are signed using the Capella fork domain.&lt;&#x2F;p&gt;
&lt;p&gt;There are no forwards&#x2F;backwards compatibility issues with the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;&lt;code&gt;deneb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; test suite of the &lt;code&gt;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The divergent signature domains across forked networks would previously have prevented the replay of VoluntaryExits after two hard forks. This specification change causes the replay protection to no longer exist. These potential replays could impact individual stakers on both sides of a fork, but does not put funds at risk and does not impact the security of the chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase max attestation inclusion slot</title>
        <published>2023-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7045-increase-attestation-slot-inclusion-range/14342" />
        

        <id>https://wg-eips.ritovision.com/7045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7045"
            label="EIP-7045" />
        

        
        

        
        <summary type="html">Increases max attestation inclusion slot to the last slot in `N+1` where `N` is the epoch containing the attestation&#x27;s slot.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7045/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increases max attestation inclusion slot from &lt;code&gt;attestation.slot + SLOTS_PER_EPOCH&lt;&#x2F;code&gt; to the last slot of epoch &lt;code&gt;N+1&lt;&#x2F;code&gt; where &lt;code&gt;N&lt;&#x2F;code&gt; is the epoch containing the attestation slot.&lt;&#x2F;p&gt;
&lt;p&gt;This increase is critical to the current LMD-GHOST security analysis as well as the confirmation rule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Attestations can currently be included after some minimum delay (&lt;code&gt;1&lt;&#x2F;code&gt; slot on mainnet) up until &lt;code&gt;SLOTS_PER_EPOCH&lt;&#x2F;code&gt; slots after the slot the attestation was created in. This rolling window of one epoch was decided upon during Phase 0 because the equal inclusion window for any attestation was assessed as &quot;fair&quot;. The alternative considered path was to allow inclusion during the current and next epoch which means attestations created during the start of an epoch have more potential slots of inclusion than those at the end of the epoch.&lt;&#x2F;p&gt;
&lt;p&gt;Since this decision, it has become apparent that the alternative design is critical for current LMD-GHOST security proofs as well as a new confirmation rule (which will allow for block confirmations in approximately 3-4 slots in normal mainnet conditions).&lt;&#x2F;p&gt;
&lt;p&gt;This specification thus increases the max inclusion slot for attestations in accordance with the learned security proof and confirmation rule needs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1710338135&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;This requires no changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;Specification changes are built into the Consensus Specs Deneb upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;The specification makes two minor changes to the state transition function:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Modify &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#modified-process_attestation&quot;&gt;&lt;code&gt;process_attestation&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to not have an upper bound on the slot check and instead define the inclusion range via the minimum slot as well as the target epoch being in either current or previous epoch.&lt;&#x2F;li&gt;
&lt;li&gt;Modify &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#modified-get_attestation_participation_flag_indices&quot;&gt;&lt;code&gt;get_attestation_participation_flag_indices&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to set the &lt;code&gt;TIMELY_TARGET_FLAG&lt;&#x2F;code&gt; without consideration of &lt;code&gt;inclusion_delay&lt;&#x2F;code&gt; to ensure that the extended inclusion attestations have a non-zero reward.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additionally, the specification modifies the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;p2p-interface.md#beacon_attestation_subnet_id&quot;&gt;attestation&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;95f36d99cf4aa59974da06af24ef9a7c12d3c301&#x2F;specs&#x2F;deneb&#x2F;p2p-interface.md#beacon_aggregate_and_proof&quot;&gt;aggregate attestation&lt;&#x2F;a&gt; gossip conditions to allow for gossip during this extended range.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;extended-max-inclusion-slot&quot;&gt;Extended max inclusion slot&lt;&#x2F;h3&gt;
&lt;p&gt;As discussed in the Motivation, extending this max inclusion slot to the end of the next epoch is critical for LMD-GHOST security proofs and confirmation rule.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removal-of-inclusion-delay-consideration-for-target-reward&quot;&gt;Removal of &lt;code&gt;inclusion_delay&lt;&#x2F;code&gt; consideration for target reward&lt;&#x2F;h3&gt;
&lt;p&gt;Previously, &lt;code&gt;get_attestation_participation_flag_indices&lt;&#x2F;code&gt; would only set the &lt;code&gt;TIMELY_TARGET_FLAG&lt;&#x2F;code&gt; (and thus reward for an attestation with correct target vote) if the attestation was included within a &lt;code&gt;SLOTS_PER_EPOCH&lt;&#x2F;code&gt; window.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;inclusion_delay&lt;&#x2F;code&gt; consideration for this flag is removed to ensure that whatever the valid inclusion window is for an attestation, it can receive a baseline non-zero reward for correct target. This ensures that clients will still attempt to pack such attestations into blocks which is important for the security analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Note, this was the intended behavior with the previously defined range which was equivalent to the max.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block validation rule set on the consensus layer and must be accompanied by a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;&lt;code&gt;deneb&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; test suite of the &lt;code&gt;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This improves LMD-GHOST security as well as enables a fast confirmation rule.&lt;&#x2F;p&gt;
&lt;p&gt;There are no known negative impacts to security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Execution layer triggerable withdrawals</title>
        <published>2023-05-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Hsiao-Wei Wang</name><uri>https://github.com/hwwhww</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Felix Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7002/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-7002-execution-layer-triggerable-exits/14195" />
        

        <id>https://wg-eips.ritovision.com/7002/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:7002"
            label="EIP-7002" />
        

        
        

        
        <summary type="html">Allow validators to trigger exits and partial withdrawals via their execution layer (0x01) withdrawal credentials</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7002/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new mechanism to allow validators to trigger withdrawals and exits from their execution layer (0x01) withdrawal credentials.&lt;&#x2F;p&gt;
&lt;p&gt;These new execution layer exit messages are appended to the execution layer block and then processed by the consensus layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Validators have two keys -- an active key and a withdrawal credential. The active key takes the form of a BLS key, whereas the withdrawal credential can either be a BLS key (0x00) or an execution layer address (0x01). The active key is &quot;hot&quot;, actively signing and performing validator duties, whereas the withdrawal credential can remain &quot;cold&quot;, only performing limited operations in relation to withdrawing and ownership of the staked ETH. Due to this security relationship, the withdrawal credential ultimately is the key that owns the staked ETH and any rewards.&lt;&#x2F;p&gt;
&lt;p&gt;As currently specified, only the active key can initiate a validator exit. This means that in any non-standard custody relationship (i.e., the active key is a separate entity from the withdrawal credentials), the ultimate owner of the funds -- the possessor of the withdrawal credentials -- cannot independently choose to exit and begin the withdrawal process. This leads to either trust issues (e.g. ETH can be &quot;held hostage&quot; by the active key owner) or insufficient work-arounds such as pre-signed exits. Additionally, in the event that active keys are lost, a user should still be able to recover their funds by using their cold withdrawal credentials.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure that the withdrawal credentials (owned by both EOAs and smart contracts) can trustlessly control the destiny of the staked ETH, this specification enables exits triggerable by 0x01 withdrawal credentials.&lt;&#x2F;p&gt;
&lt;p&gt;Note, 0x00 withdrawal credentials can be changed into 0x01 withdrawal credentials with a one-time signed message. Thus any functionality enabled for 0x01 credentials is defacto enabled for 0x00 credentials.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x00000961Ef480Eb55e80D19ad83579A64c007002&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Where to call and store relevant details about exit &#x2F; partial withdrawal mechanism&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; type prefix for withdrawal request&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Address used to invoke system operation on contract&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Pointer to head of the withdrawal request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Pointer to the tail of the withdrawal request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;The start memory slot of the in-state withdrawal request message queue&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;Maximum number of withdrawal requests that can be dequeued into a block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_WITHDRAWAL_REQUEST_FEE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;17&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;EXCESS_INHIBITOR&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**256-1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Excess value used to compute the fee before the first system call&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain after this EIP has been activated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;withdrawal-request-operation&quot;&gt;Withdrawal request operation&lt;&#x2F;h4&gt;
&lt;p&gt;The new withdrawal request operation is an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request
with type &lt;code&gt;0x01&lt;&#x2F;code&gt; and consists of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;source_address&lt;&#x2F;code&gt;: &lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validator_pubkey&lt;&#x2F;code&gt;: &lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount&lt;&#x2F;code&gt;: &lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; encoding of a withdrawal request is computed as follows.
Note that &lt;code&gt;amount&lt;&#x2F;code&gt; is returned by the contract little-endian, and must be encoded as such.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; read_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;withdrawal-request-contract&quot;&gt;Withdrawal Request Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The contract has three different code paths, which can be summarized at a high level as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Add withdrawal request - requires a &lt;code&gt;56&lt;&#x2F;code&gt; byte input, the validator&#x27;s public
key concatenated with a big-endian &lt;code&gt;uint64&lt;&#x2F;code&gt; amount value.&lt;&#x2F;li&gt;
&lt;li&gt;Fee getter - if the input length is zero, return the current fee required to add a withdrawal request.&lt;&#x2F;li&gt;
&lt;li&gt;System process - if called by system address, pop off the withdrawal requests for the current block from the queue.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h5 id=&quot;add-withdrawal-request&quot;&gt;Add Withdrawal Request&lt;&#x2F;h5&gt;
&lt;p&gt;If call data input to the contract is exactly &lt;code&gt;56&lt;&#x2F;code&gt; bytes, perform the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure enough ETH was sent to cover the current withdrawal request fee (&lt;code&gt;check_fee()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Increase withdrawal request count by 1 for the current block (&lt;code&gt;increment_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Insert a withdrawal request into the queue for the source address and validator pubkey (&lt;code&gt;insert_withdrawal_request_into_queue()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Specifically, the functionality is defined in pseudocode as the function &lt;code&gt;add_withdrawal_request()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add_withdrawal_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Add withdrawal request adds new request to the withdrawal request queue, so long as a sufficient fee is provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify sufficient fee was provided.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Insufficient value for fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment withdrawal request count.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Insert into queue.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt; uint64_to_little_endian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h6 id=&quot;fee-calculation&quot;&gt;Fee calculation&lt;&#x2F;h6&gt;
&lt;p&gt;The following pseudocode can compute the cost of an individual withdrawal request, given a certain number of excess withdrawal requests.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Inhibitor still active&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_WITHDRAWAL_REQUEST_FEE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        excess&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;fee-getter&quot;&gt;Fee Getter&lt;&#x2F;h5&gt;
&lt;p&gt;When the input to the contract is length zero, interpret this as a get request for the current fee, i.e. the contract returns the result of &lt;code&gt;get_fee()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;system-call&quot;&gt;System Call&lt;&#x2F;h5&gt;
&lt;p&gt;At the end of processing any execution block starting from the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; (i.e. after processing all transactions and after performing the block body withdrawal requests validations), call &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with no calldata. The invocation triggers the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The contract&#x27;s queue is updated based on withdrawal requests dequeued and the withdrawal requests queue head&#x2F;tail are reset if the queue has been cleared (&lt;code&gt;dequeue_withdrawal_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s excess withdrawal requests are updated based on usage in the current block (&lt;code&gt;update_excess_withdrawal_requests()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s withdrawal requests count is reset to 0 (&lt;code&gt;reset_withdrawal_requests_count()&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each withdrawal request must appear in the EIP-7685 requests list in the exact order returned by &lt;code&gt;dequeue_withdrawal_requests()&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the system call and the processing of that block must conform to the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The call has a dedicated gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Gas consumed by this call does not count against the block’s overall gas usage.&lt;&#x2F;li&gt;
&lt;li&gt;Both the gas limit assigned to the call and the gas consumed are excluded from any checks against the block’s gas limit.&lt;&#x2F;li&gt;
&lt;li&gt;The call does not follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee burn semantics — no value should be transferred as part of this call.&lt;&#x2F;li&gt;
&lt;li&gt;If there is no code at &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt;, the corresponding block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be marked invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If the call to the contract fails or returns an error, the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The functionality triggered by the system call is defined in pseudocode as the function &lt;code&gt;read_withdrawal_requests()&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Public function #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##################&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; read_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dequeue_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    update_excess_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reset_withdrawal_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ssz&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;reqs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Helpers #&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;##########&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; little_endian_to_uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; uint64_to_little_endian&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;num&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; num&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;little&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ValidatorWithdrawalRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; dequeue_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_in_queue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    num_dequeued&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_in_queue&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reqs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_dequeued&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; little_endian_to_uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; queue_storage_slot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        req&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ValidatorWithdrawalRequest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            source_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes20&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;source_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            validator_pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;validator_pubkey&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;            amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        reqs&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;req&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; num_dequeued&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; queue_tail_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Queue is empty, reset queue pointers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_TAIL_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_QUEUE_HEAD_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_queue_head_index&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; reqs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; update_excess_withdrawal_requests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_INHIBITOR&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        new_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; previous_excess&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; count&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; new_excess&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; reset_withdrawal_requests_count&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; WITHDRAWAL_REQUEST_COUNT_STORAGE_SLOT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xcb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x68&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;div&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;callvalue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01f4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xdf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0183&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shl&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffff00000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;and&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x40&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x38&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x30&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x06&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x28&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x18&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x08&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;shr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xe1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0195&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push32 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;push2&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x01e8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h5&gt;
&lt;p&gt;The withdrawal requests contract is deployed like any other smart contract. A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f556101f880602d5f395ff33373fffffffffffffffffffffffffffffffffffffffe1460cb5760115f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff146101f457600182026001905f5b5f82111560685781019083028483029004916001019190604d565b909390049250505036603814608857366101f457346101f4575f5260205ff35b34106101f457600154600101600155600354806003026004013381556001015f35815560010160203590553360601b5f5260385f601437604c5fa0600101600355005b6003546002548082038060101160df575060105b5f5b8181146101835782810160030260040181604c02815460601b8152601401816001015481526020019060020154807fffffffffffffffffffffffffffffffff00000000000000000000000000000000168252906010019060401c908160381c81600701538160301c81600601538160281c81600501538160201c81600401538160181c81600301538160101c81600201538160081c81600101535360010160e1565b910180921461019557906002556101a0565b90505f6002555f6003555b5f54807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14156101cd57505f5b6001546002828201116101e25750505f6101e8565b01600290035b5f555f600155604c025ff35b5f5ffd&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x5feeb084551e4e03a3581e269bc2ea2f8d0008&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x8ded54be89448d78d4bc97782c0187b099e45380ab681742f9d3754e405c2572&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Sender: 0x8646861A7cF453dDD086874d622b0696dE5b9674&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: 0x00000961Ef480Eb55e80D19ad83579A64c007002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;7bf43d1bc4fdb91059f0e6f4f7f0f3349b144950&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;Full specification&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Sketch of spec:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;New operation &lt;code&gt;ExecutionLayerWithdrawalRequest&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Will show up in &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; as an SSZ List bound by length &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New function that has similar functionality to &lt;code&gt;process_voluntary_exit&lt;&#x2F;code&gt; but can fail validations (e.g. validator is already exited) without the block failing (similar to deposit coming from EL)&lt;&#x2F;li&gt;
&lt;li&gt;This function is called in &lt;code&gt;process_operations&lt;&#x2F;code&gt; for each &lt;code&gt;ExecutionLayerWithdrawalRequest&lt;&#x2F;code&gt; found in the &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validator-pubkey-field&quot;&gt;&lt;code&gt;validator_pubkey&lt;&#x2F;code&gt; field&lt;&#x2F;h3&gt;
&lt;p&gt;Multiple validators can utilize the same execution layer withdrawal credential, thus the &lt;code&gt;validator_pubkey&lt;&#x2F;code&gt; field is utilized to disambiguate which validator is being exited.&lt;&#x2F;p&gt;
&lt;p&gt;Note, &lt;code&gt;validator_index&lt;&#x2F;code&gt; also disambiguates validators.
The problem is that smart contracts of some staking pools are not aware of the indices, because the index becomes known only after the validator has been created on the beacon chain, while the pubkey is available in advance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;message-queue&quot;&gt;Message queue&lt;&#x2F;h3&gt;
&lt;p&gt;The contract maintains an in-state queue of withdrawal request messages to be dequeued each block into the block and thus into the execution layer.&lt;&#x2F;p&gt;
&lt;p&gt;The number of withdrawal requests that can be passed into the consensus layer are bound by &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; to bound the load both on the block size as well as on the consensus layer processing. &lt;code&gt;16&lt;&#x2F;code&gt; has been chosen for &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; to be in line with the bounds of similar operations on the beacon chain -- e.g. &lt;code&gt;VoluntaryExit&lt;&#x2F;code&gt; and &lt;code&gt;Deposit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Although there is a maximum number of withdrawal requests that can be passed to the consensus layer each block, the execution layer gas limit can provide for far more calls to the withdrawal request predeploy contract at each block. The queue then allows for these calls to successfully be made while still maintaining a system rate limit.&lt;&#x2F;p&gt;
&lt;p&gt;The alternative design considered was to have calls to the contract fail after &lt;code&gt;MAX_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; successful calls were made within the context of a single block. This would eliminate the need for the message queue, but would come at the cost of a bad UX of contract call failures in times of high exiting. The complexity to mitigate this bad UX is relatively low and is currently favored.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rate-limiting-using-a-fee&quot;&gt;Rate limiting using a fee&lt;&#x2F;h3&gt;
&lt;p&gt;Transactions are naturally rate-limited in the execution layer via the gas limit, but an adversary willing to pay market-rate gas fees (and potentially utilize builder markets to pay for front-of-block transaction inclusion) can fill up the exit operation limits for relatively cheap, thus griefing honest validators that want to make a withdrawal request.&lt;&#x2F;p&gt;
&lt;p&gt;There are two general approaches to combat this griefing -- (a) only allow validators to send such messages and with a limit per time period or (b) utilize an economic method to make such griefing increasingly costly.&lt;&#x2F;p&gt;
&lt;p&gt;Method (a) (not used in this EIP) would require &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; (the &lt;code&gt;BEACON_ROOT&lt;&#x2F;code&gt; opcode) against which to prove withdrawal credentials in relation to validator pubkeys as well as a data-structure to track requests per-unit-time (e.g. 4 months) to ensure that a validator cannot grief the mechanism by submitting many requests. The downsides of this method are that it requires another cross-layer EIP and that it is of higher cross-layer complexity (e.g. care that might need to be taken in future upgrades if, for example, the shape of the merkle tree of &lt;code&gt;BEACON_ROOT&lt;&#x2F;code&gt; changes, then the contract and proof structure might need to be updated).&lt;&#x2F;p&gt;
&lt;p&gt;Method (b) has been utilized in this EIP to eliminate additional EIP requirements and to reduce cross-layer complexity to allow for correctness of this EIP (now and in the future) to be easier to analyze. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;-style mechanism with a dynamically adjusting fee mechanism allows for users to pay &lt;code&gt;MIN_WITHDRAWAL_REQUEST_FEE&lt;&#x2F;code&gt; for withdrawal requests in the normal case (fewer than 2 per block on average), but scales the fee up exponentially in response to high usage (i.e. potential abuse).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;target-withdrawal-requests-per-block-configuration-value&quot;&gt;&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; configuration value&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; has been selected as &lt;code&gt;2&lt;&#x2F;code&gt; such that the growth of the partial withdrawal queue in the beacon state is negligible under extreme scenarios of the exit churn congestion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-update-rule&quot;&gt;Fee update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The fee update rule is intended to approximate the formula &lt;code&gt;fee = MIN_WITHDRAWAL_REQUEST_FEE * e**(excess &#x2F; WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;, where &lt;code&gt;excess&lt;&#x2F;code&gt; is the total &quot;extra&quot; amount of withdrawal requests that the chain has processed relative to the &quot;targeted&quot; number (&lt;code&gt;TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt; per block).&lt;&#x2F;p&gt;
&lt;p&gt;Like EIP-1559, it’s a self-correcting formula: as the excess goes higher, the &lt;code&gt;fee&lt;&#x2F;code&gt; increases exponentially, reducing usage and eventually forcing the excess back down.&lt;&#x2F;p&gt;
&lt;p&gt;The block-by-block behavior is roughly as follows. If block &lt;code&gt;N&lt;&#x2F;code&gt; processes &lt;code&gt;X&lt;&#x2F;code&gt; requests, then at the end of block &lt;code&gt;N&lt;&#x2F;code&gt; &lt;code&gt;excess&lt;&#x2F;code&gt; increases by &lt;code&gt;X - TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK&lt;&#x2F;code&gt;, and so the &lt;code&gt;fee&lt;&#x2F;code&gt; in block &lt;code&gt;N+1&lt;&#x2F;code&gt; increases by a factor of &lt;code&gt;e**((X - TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK) &#x2F; WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;. Hence, it has a similar effect to the existing EIP-1559, but is more &quot;stable&quot; in the sense that it responds in the same way to the same total withdrawal requests regardless of how they are distributed over time.&lt;&#x2F;p&gt;
&lt;p&gt;The parameter &lt;code&gt;WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; controls the maximum downwards rate of change of the blob gas price. It is chosen to target a maximum downwards change rate of &lt;code&gt;e(TARGET_WITHDRAWAL_REQUESTS_PER_BLOCK &#x2F; WITHDRAWAL_REQUEST_FEE_UPDATE_FRACTION) ≈ 1.125&lt;&#x2F;code&gt; per block.&lt;&#x2F;p&gt;
&lt;p&gt;More detailed analysis of the fee mechanism is available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7002&#x2F;assets&#x2F;fee_analysis&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;withdrawal-requests-inside-of-the-block&quot;&gt;Withdrawal requests inside of the block&lt;&#x2F;h3&gt;
&lt;p&gt;Withdrawal requests are placed into the actual body of the beacon block.&lt;&#x2F;p&gt;
&lt;p&gt;There is a strong design requirement that the consensus layer and execution layer can execute independently of each other. This means, in this case, that the consensus layer cannot rely upon a synchronous call to the execution layer to get the required withdrawal requests for the current block. Instead, the requests must be embedded in the beacon block such that if the execution layer is offline, the consensus layer still has the requisite data to fully execute the consensus portion of the state transition function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;submitting-requests-via-execution-layer&quot;&gt;Submitting requests via execution layer&lt;&#x2F;h3&gt;
&lt;p&gt;Verifying &lt;code&gt;secp256k1&lt;&#x2F;code&gt; signatures from the consensus layer via Engine API is one of the alternatives to the proposed requests mechanism which engineering complexity is much lower.
However, this approach would limit usage of withdrawal requests to a large extent by making it impossible for smart contracts owning validator withdrawal credentials to benefit from this functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block structure and block validation rule set. But neither of these changes break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;impact-on-existing-custody-relationships&quot;&gt;Impact on existing custody relationships&lt;&#x2F;h3&gt;
&lt;p&gt;There might be existing custody relationships and&#x2F;or products that rely upon the assumption that the withdrawal credentials &lt;em&gt;cannot&lt;&#x2F;em&gt; trigger a withdrawal request. We are currently confident that the additional withdrawal credentials feature does not impact the security of existing validators because:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The withdrawal credentials ultimately own the funds so allowing them to exit staking is natural with respect to ownership.&lt;&#x2F;li&gt;
&lt;li&gt;We are currently not aware of any such custody relationships and&#x2F;or products that do rely on the lack of this feature.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In the event that existing validators&#x2F;custodians rely on this, then the validators can be exited and restaked utilizing 0x01 withdrawal credentials pointing to a smart contract that simulates this behaviour.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fee-overpayment&quot;&gt;Fee Overpayment&lt;&#x2F;h3&gt;
&lt;p&gt;Calls to the system contract require a fee payment defined by the current contract state. Overpaid fees are not returned to the caller. It is not generally possible to compute the exact required fee amount ahead of time. When adding a withdrawal request from a contract, the contract can perform a read operation to check for the current fee and then pay exactly the required amount. Here is an example in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function addWithdrawal(bytes memory pubkey, uint64 amount, uint64 requestFeeLimit) private {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert(pubkey.length == 48);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Read current fee from the contract.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool readOK, bytes memory feeData) = WithdrawalsContract.staticcall(&amp;#39;&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!readOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;reading fee failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint256 fee = uint256(bytes32(feeData));&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Check the fee is not too high.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (fee &amp;gt; requestFeeLimit) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;fee is too high&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Add the request.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes memory callData = abi.encodePacked(pubkey, amount);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (bool writeOK,) = WithdrawalsContract.call{value: fee}(callData);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if (!writeOK) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        revert(&amp;#39;adding request failed&amp;#39;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: the system contract uses the EVM &lt;code&gt;CALLER&lt;&#x2F;code&gt; operation (Solidity: &lt;code&gt;msg.sender&lt;&#x2F;code&gt;) as the target address for withdrawals, i.e. the address that calls the system contract must match the 0x01 withdrawal credential recorded in the beacon state.&lt;&#x2F;p&gt;
&lt;p&gt;Note: the above code reverts if the fee is too high, the fee can change significantly between creation of a withdrawal request transaction and its inclusion into a block, thus, this check is very important to avoid overpayments.&lt;&#x2F;p&gt;
&lt;p&gt;Using an EOA to request withdrawals will always result in overpayment of fees. There is no way for an EOA to use a wrapper contract to request a withdrawal. And even if a way existed, the gas cost of returning the overage would likely be higher than the overage itself. If requesting withdrawals to an EOA through the system contract is desired, we recommend that users perform transaction simulations to estimate a reasonable fee amount to send.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-call-failure&quot;&gt;System Call failure&lt;&#x2F;h3&gt;
&lt;p&gt;Although the likelihood of a failed system call to &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; is extremely low, the behavior in such cases is well-defined: the block is marked as invalid. However, if the failure results from processing a transaction within the block, the public mempool may still retain the transaction even after the block is invalidated. This can result in the offending transaction being included again, potentially causing one or more subsequent slots to go without valid blocks. To mitigate this, we recommend that the block producer implementation shuffle their transaction set to increase the chances of producing a valid block, without the offending transaction(s). The block producer implementation and&#x2F;or the mempool should be aware of system call failure scenarios to enable this behavior.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;empty-code-failure&quot;&gt;Empty Code failure&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP should not have been activated if there is no code present at &lt;code&gt;WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS&lt;&#x2F;code&gt; (i.e., if the chain is not &quot;ready&quot;). Doing so would cause the first and all subsequent blocks after &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; to be marked invalid.&lt;&#x2F;p&gt;
&lt;p&gt;If this situation occurs on a live chain, the following are two potential recovery strategies:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Deploy the contract code via a transaction and include it in a block. This block would become the first valid block, provided the system call to the contract does not fail. This works because the empty code validation occurs after block-transactions execution.&lt;&#x2F;li&gt;
&lt;li&gt;Postpone the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; activation point by updating the consensual fork timestamp or block number in the client implementation(s), then deploy the contract before the fork activates.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revamped CALL instructions</title>
        <published>2023-05-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7069/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-revamped-call-instructions/14432" />
        

        <id>https://wg-eips.ritovision.com/7069/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:7069"
            label="EIP-7069" />
        

        
        

        
        <summary type="html">Introduce EXTCALL, EXTDELEGATECALL and EXTSTATICCALL with simplified semantics</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7069/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce three new call instructions, &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;, &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;EXTSTATICCALL&lt;&#x2F;code&gt;, with simplified semantics. Introduce another instruction, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; for loading a word from return data into stack. Modify the behavior of &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instruction executed within EOF formatted code (as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;). The existing &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions are rejected by EOF validation.&lt;&#x2F;p&gt;
&lt;p&gt;The new instructions do not allow specifying a gas limit, but rather rely on the &quot;63&#x2F;64th rule&quot; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;) to limit gas. An important improvement is the rules around the &quot;stipend&quot; are simplified, and callers do not need to perform special calculation whether the value is sent or not.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, the obsolete functionality of specifying output buffer address is removed in favor of using &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instead. For cases which would previously &lt;code&gt;*CALL&lt;&#x2F;code&gt; output into a buffer and then &lt;code&gt;MLOAD&lt;&#x2F;code&gt; from the buffer, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; is provided instead.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, instead of returning a boolean for execution status, an extensible list of status codes is returned: &lt;code&gt;0&lt;&#x2F;code&gt; for success, &lt;code&gt;1&lt;&#x2F;code&gt; for revert, &lt;code&gt;2&lt;&#x2F;code&gt; for failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Observability of gas has been a problem for very long. The system of gas has been (and likely must be) flexible in adapting to changes to both how Ethereum is used as well as changes in underlying hardware.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately, in many cases compromises or workarounds had to be made to avoid affecting call instructions negatively, mostly due to the complex semantics and expectations of them.&lt;&#x2F;p&gt;
&lt;p&gt;This change removes gas observability from the new instructions and opens the door for new classes of contracts that are not affected by repricings. Furthermore, the legacy call instructions are rejected within EOF contracts, making sure they are mostly unaffected by changes in gas fees. Because these operations are required for removing gas observability they are required for EOF in lieu of the existing legacy instructions.&lt;&#x2F;p&gt;
&lt;p&gt;It is important to note that starting Solidity 0.4.21, the compiler already passes all remaining gas to calls (using &lt;code&gt;call(gas(), ...&lt;&#x2F;code&gt;), unless the developer uses the explicit override (&lt;code&gt;{gas: ...}&lt;&#x2F;code&gt;) in the language. This suggests most contracts don&#x27;t rely on controlling gas.&lt;&#x2F;p&gt;
&lt;p&gt;Besides the above, this change introduces a convenience feature of returning more detailed status codes: &lt;code&gt;success (0)&lt;&#x2F;code&gt;, &lt;code&gt;revert (1)&lt;&#x2F;code&gt;, &lt;code&gt;failure (2)&lt;&#x2F;code&gt;. This moves from the boolean option to codes, which are extensible in the future.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, the introduction of the &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; instructions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;211&#x2F;&quot;&gt;EIP-211&lt;&#x2F;a&gt;) has obsoleted the output parameters of calls, in a large number of cases rendering them unused. Using the output buffers have caused &quot;bugs&quot; in the past: in the case of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, conflicting implementations caused a lot of trouble, where some would return something, while others would not. With relying on &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; instructions this is implicitly clarified. This proposal also adds the &quot;missing&quot; &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; instruction to round out returndata buffer access instructions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;WARM_STORAGE_READ_COST&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;From &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COLD_ACCOUNT_ACCESS&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;td&gt;From &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALL_VALUE_COST&lt;&#x2F;td&gt;&lt;td&gt;9000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ACCOUNT_CREATION_COST&lt;&#x2F;td&gt;&lt;td&gt;25000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MIN_RETAINED_GAS&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MIN_CALLEE_GAS&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce four new instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EXTCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf8&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address, input_offset, input_size, value)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf9&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address, input_offset, input_size)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXTSTATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xfb&lt;&#x2F;code&gt;) with arguments &lt;code&gt;(target_address, input_offset, input_size)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) with argument &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These four new instructions are undefined in legacy code and only available in EOF code.&lt;&#x2F;p&gt;
&lt;p&gt;Execution semantics of &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;Pop required arguments from stack, halt with exceptional failure on stack underflow.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: When implemented in EOF, stack underflow check is done during stack validation and runtime check is omitted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;value&lt;&#x2F;code&gt; is non-zero (only &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;):
&lt;ul&gt;
&lt;li&gt;Halt with exceptional failure if the current frame is in &lt;code&gt;static-mode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Charge &lt;code&gt;CALL_VALUE_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;target_address&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address) then halt with an exceptional failure.&lt;&#x2F;li&gt;
&lt;li&gt;Perform (and charge for) memory expansion using &lt;code&gt;[input_offset, input_size]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in the &lt;code&gt;warm_account_list&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_ACCOUNT_ACCESS - WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;target_address&lt;&#x2F;code&gt; is not in the state and the call configuration would result in account creation, charge &lt;code&gt;ACCOUNT_CREATION_COST&lt;&#x2F;code&gt; gas.
&lt;ul&gt;
&lt;li&gt;The only such case in this EIP is if &lt;code&gt;value&lt;&#x2F;code&gt; is non-zero (only &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Calculate the gas available to callee as caller&#x27;s remaining gas reduced by &lt;code&gt;max(floor(gas&#x2F;64), MIN_RETAINED_GAS)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Clear the returndata buffer.&lt;&#x2F;li&gt;
&lt;li&gt;Fail with status code &lt;code&gt;1&lt;&#x2F;code&gt; returned on stack if any of the following is true (only gas charged until this point is consumed):
&lt;ul&gt;
&lt;li&gt;Gas available to callee at this point is less than &lt;code&gt;MIN_CALLEE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Balance of the current account is less than &lt;code&gt;value&lt;&#x2F;code&gt; (only &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Current call stack depth equals &lt;code&gt;1024&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;(only &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt;) &lt;code&gt;target_address&lt;&#x2F;code&gt; account in the state doesn&#x27;t have EOF code to execute (in particular, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; delegations should be resolved, as if &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; was used)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Perform the call with the available gas and configuration.&lt;&#x2F;li&gt;
&lt;li&gt;Push a status code on the stack:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0&lt;&#x2F;code&gt; if the call was successful.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;1&lt;&#x2F;code&gt; if the call has reverted (also can be pushed earlier in a light failure scenario described in step 10).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;2&lt;&#x2F;code&gt; if the call has failed (in case of general OOG failure or any scenario where all gas passed to the callee is burnt in case of an error).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Gas not used by the callee is returned to the caller.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution semantics of &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Charge &lt;code&gt;3&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;Pop 1 item from the stack, to be referred to as &lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Push 1 item onto the stack, the 32-byte word read from the returndata buffer starting at &lt;code&gt;offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + 32 &amp;gt; len(returndata buffer)&lt;&#x2F;code&gt;, the result is zero-padded.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution semantics of &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; in EOF formatted code (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) is modified as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Assume the 3 arguments popped from stack are &lt;code&gt;destOffset&lt;&#x2F;code&gt;, &lt;code&gt;offset&lt;&#x2F;code&gt; and &lt;code&gt;size&lt;&#x2F;code&gt;. &lt;em&gt;(no change)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Performs memory expansion to &lt;code&gt;destOffset + size&lt;&#x2F;code&gt; and deducts memory expansion cost. &lt;em&gt;(no change)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;offset + size &amp;gt; len(returndata buffer)&lt;&#x2F;code&gt; &lt;strong&gt;do not&lt;&#x2F;strong&gt; halt with exceptional failure, but instead set the &lt;code&gt;offset + size - len(returndata buffer)&lt;&#x2F;code&gt; memory bytes after the copied ones to zero.&lt;&#x2F;li&gt;
&lt;li&gt;Gas charged for memory copying remains &lt;code&gt;3 * num_words(size)&lt;&#x2F;code&gt;, regardless of the number of bytes actually copied or set to zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Execution of &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; which is not in EOF formatted code (i.e. is in legacy code) is not changed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;removing-gas-selectability&quot;&gt;Removing gas selectability&lt;&#x2F;h3&gt;
&lt;p&gt;One major change from the original &lt;code&gt;CALL&lt;&#x2F;code&gt; series of instructions is that the caller has no control over the amount of gas passed in as part of the call. The number of cases where such a feature is essential are probably better served by direct protocol integration.&lt;&#x2F;p&gt;
&lt;p&gt;Removing gas selectability also introduces a valuable property that future revisions to the gas schedule will benefit from: you can always overcome Out of Gas (OOG) errors by sending more gas as part of the transaction (subject to the block gas limit). Previously when raising storage costs (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt;) some contracts that sent only a limited amount of gas to their calls were broken by the new costing.&lt;&#x2F;p&gt;
&lt;p&gt;Hence some contracts had a gas ceiling they were sending to their next call, permanently limiting the amount of gas they could spend. No amount of extra gas could fix the issue as the call would limit the amount sent.  The notion of a stipend floor is retained in this spec. This floor can be changed independent of the smart contracts and still preserve the feature that OOG halts can be fixed by sending more gas as part of the transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stipend-and-63-64th-rule&quot;&gt;Stipend and 63&#x2F;64th rule&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of the stipend is to have enough gas to emit logs (i.e. perform non-state-changing operations) when a &quot;contract wallet&quot; is called. The stipend is only added when the &lt;code&gt;CALL&lt;&#x2F;code&gt; instruction is used and the value is non-zero.&lt;&#x2F;p&gt;
&lt;p&gt;The 63&#x2F;64th rule has multiple purposes:&lt;&#x2F;p&gt;
&lt;p&gt;a. to limit call depth,
b. to ensure the caller has gas left to make state changes after a callee returns.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, there is a call depth counter, and calls fail if the depth would exceed 1024.&lt;&#x2F;p&gt;
&lt;p&gt;Before the 63&#x2F;64th rule was introduced, it was required to calculate available gas semi-accurately on caller side. Solidity has a complicated ruleset where it tries to estimate how much it will cost on the caller side to perform the call itself, in order to set a reasonable gas value.&lt;&#x2F;p&gt;
&lt;p&gt;We have changed the ruleset:&lt;&#x2F;p&gt;
&lt;p&gt;The 63&#x2F;64th rule is still applied, but&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At least &lt;code&gt;MIN_RETAINED_GAS&lt;&#x2F;code&gt; gas is retained prior to executing the callee,&lt;&#x2F;li&gt;
&lt;li&gt;At least &lt;code&gt;MIN_CALLEE_GAS&lt;&#x2F;code&gt; gas is available to the callee.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;MIN_CALLEE_GAS&lt;&#x2F;code&gt; rule is a replacement for stipend: it simplifies the reasoning about the gas costs and is applied uniformly for all introduced &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instructions.
The following table visualizes the differences (note the discrepancy between &lt;em&gt;caller required gas&lt;&#x2F;em&gt; and &lt;em&gt;caller cost&lt;&#x2F;em&gt; for &lt;code&gt;CALL&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;Caller required gas&lt;&#x2F;th&gt;&lt;th&gt;Caller cost (burned gas)&lt;&#x2F;th&gt;&lt;th&gt;Caller min retained gas&lt;&#x2F;th&gt;&lt;th&gt;Callee min gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CALL V=0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALL V≠0&lt;&#x2F;td&gt;&lt;td&gt;100+9000&lt;&#x2F;td&gt;&lt;td&gt;100+6700&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATICCALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCALL V=0&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCALL V≠0&lt;&#x2F;td&gt;&lt;td&gt;100+9000&lt;&#x2F;td&gt;&lt;td&gt;100+9000&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTDELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTSTATICCALL&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;2300&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caller required gas&lt;&#x2F;strong&gt;: the minimum amount of gas a caller is required to have to execute a call instruction, lower value causes caller&#x27;s OOG,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Caller cost (burned gas)&lt;&#x2F;strong&gt;: the amount of gas deducted from the caller to execute the instruction, this amount is not available to the callee,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Caller min retained gas&lt;&#x2F;strong&gt;: the minimum amount of gas the caller is guaranteed to have after the call, if this cannot be guaranteed the call fails without even reaching the callee,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Callee min gas&lt;&#x2F;strong&gt;: the minimum gas limit for the callee&#x27;s execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Removing the call stack depth check was initially considered, but this would be incompatible with the original &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions, as well as &lt;code&gt;CREATE*&lt;&#x2F;code&gt; instructions, which can be intertwined with the new &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; instructions in the call stack. As such, keeping the call stack depth check involves no change affecting legacy code.&lt;&#x2F;p&gt;
&lt;p&gt;Also, we find the simple (as opposed to the complex 63&#x2F;64th rule) hard cap reassuring, that the call stack depth is limited, in case the gas rules can be bypassed. Lastly, the amount of gas to reach depth of 1024 is huge, but not absurdly huge, and we want to avoid constraining ourselves by dependency of this check on current gas limits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output-buffers&quot;&gt;Output buffers&lt;&#x2F;h3&gt;
&lt;p&gt;The functionality of specifying output buffer address is removed, because it is added complexity and in a large number of cases implementers prefer to use &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instead. Even if they rely on the output buffer (like in the case of Vyper), they would still check the length with &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;. In Solidity one exception is the case when the expected return size is known (i.e. non-dynamic return values), in this case Solidity still uses the output buffer. For these cases, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; is introduced, which simplifies the workflow of copying returndata into a (known) output buffer and using &lt;code&gt;MLOAD&lt;&#x2F;code&gt; from there; instead, &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; can be used directly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;status-codes&quot;&gt;Status codes&lt;&#x2F;h3&gt;
&lt;p&gt;Current call instructions return a boolean value to signal success: 0 means failure, 1 means success. The Solidity compiler assumed this value is a boolean and thus uses the value as branch condition to status (&lt;code&gt;if iszero(status) { &#x2F;* failure *&#x2F; }&lt;&#x2F;code&gt;). This prevents us from introducing new status codes without breaking existing contracts. At the time of the design of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;211&#x2F;&quot;&gt;EIP-211&lt;&#x2F;a&gt; the idea of return a specific code for revert was discussed, but ultimately abandoned for the above reason.&lt;&#x2F;p&gt;
&lt;p&gt;We change the value from boolean to a status code, where &lt;code&gt;0&lt;&#x2F;code&gt; signals success and thus it will be possible to introduce more non-success codes in the future, if desired.&lt;&#x2F;p&gt;
&lt;p&gt;Status code &lt;code&gt;1&lt;&#x2F;code&gt; is used for both reverts coming from the callee frame and light failures encountered (see step 10. of Execution Semantics) in the execution of the instructions. The reason for combining them is keeping the semantics similar to the original CALLs - both scenarios preserve unused gas and continue being indistinguishable to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;Status code &lt;code&gt;2&lt;&#x2F;code&gt; signals an exceptional failure in the callee execution, meaning an error occurred that consumed all remaining gas in the callee frame.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameter-order&quot;&gt;Parameter order&lt;&#x2F;h3&gt;
&lt;p&gt;The order of parameters has been changed to move the &lt;code&gt;value&lt;&#x2F;code&gt; field to be the last. This allows the instructions to have identical encoding with the exception of the last parameter, and simplifies EVM and compiler implementations slightly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-encoding&quot;&gt;Opcode encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of introducing three new &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; opcodes we have discussed a version with an immediate configuration byte (flags). There are two main disadvantages to this:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Some combination of flags may not be useful&#x2F;be invalid, and this increases the testing&#x2F;implementation surface.&lt;&#x2F;li&gt;
&lt;li&gt;The instruction could take variable number of stack items (i.e. &lt;code&gt;value&lt;&#x2F;code&gt; for &lt;code&gt;EXTCALL&lt;&#x2F;code&gt;) would be a brand new concept no other instruction has.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It is also useful to have these as new opcodes instead of modifying the existing CALL series inside of EOF. This creates an &quot;escape hatch&quot; in case gas observability needs to be restored to EOF contracts. This is done by adding the GAS and original CALL series opcodes to the valid EOF opcode list.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;callcode&quot;&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Since &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; is deprecated, we do not introduce a counterpart here.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;halting-when-target-address-is-not-a-20-byte-ethereum-addresses&quot;&gt;Halting when &lt;code&gt;target_address&lt;&#x2F;code&gt; is not a 20-byte ethereum addresses&lt;&#x2F;h3&gt;
&lt;p&gt;When existing &lt;code&gt;CALL&lt;&#x2F;code&gt; series operations encounter an address that does not fit into 20 bytes the current behavior is to mask the address so that it fits into 20 bytes, ignoring all high bytes. For the &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; operations a halt was chosen over treating the contract as empty for two reasons. First, it handles the case of sending value to an address that doesn&#x27;t exist without having to create a special case. Second, it keeps the &lt;code&gt;warm_access_list&lt;&#x2F;code&gt; from needing to track anything that is not a 20-byte ethereum address.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contract developers should not rely on the operation reverting when such addresses are passed in. When a suitable proposal for the use of Address Space Extension is adopted it is expected that the &lt;code&gt;EXT*CALL&lt;&#x2F;code&gt; series of operations will adopt those changes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-instructions-undefined-in-legacy-this-eip-is-part-of-eof-only&quot;&gt;New instructions undefined in legacy (this EIP is part of EOF only)&lt;&#x2F;h3&gt;
&lt;p&gt;Initially an alternative scenario was considered to introduce these new instructions separately in the legacy EVM first to limit the scope of EOF change, but it was decided to include it as a part of the EOF upgrade and keep them undefined in the legacy EVM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;returndataload-and-returndatacopy-padding-behavior&quot;&gt;&lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; padding behavior&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP initially proposed keeping the halt-on-OOB behavior of legacy &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt;. This makes compilers optimizations harder, because unnecessary &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt; instructions cannot be optimized out without change to code semantics.&lt;&#x2F;p&gt;
&lt;p&gt;It could be that only &lt;code&gt;RETURNDATALOAD&lt;&#x2F;code&gt; is given the padding behavior, but that would make it confusingly inconsistent with the closely related &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;There also was the alternative to have &lt;code&gt;RETURNDATACOPY2&lt;&#x2F;code&gt; introduced with the padding behavior, available in EOF only, at the same time banning &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; in EOF. This has been rejected in order to avoid multiplying opcodes, and also as suboptimal from the point of view of compiler implementation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-contracts-can-extdelegatecall-only-eof1-contracts&quot;&gt;EOF1 contracts can &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; only EOF1 contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Legacy contracts can selfdestruct in three different ways (directly through &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, indirectly through &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and indirectly through &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;). &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; disables the first two possibilities, however the third possibility remains. Allowing EOF1 contracts to &lt;code&gt;EXTDELEGATECALL&lt;&#x2F;code&gt; only other EOF1 contracts allows the following strong statement: EOF1 contract can never be destructed. Attacks based on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; completely disappear for EOF1 contracts. These include destructed library contracts (e.g. Parity Multisig).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No existing instructions are changed and so we do not think any backwards compatibility issues can occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It is expected that the attack surface will not grow. All of these operations can be modeled by existing operations with fixed gas (all available) and output range (zero length at zero memory).&lt;&#x2F;p&gt;
&lt;p&gt;When implemented in EOF (where the GAS opcode and the original CALL operations are removed) existing out of gas attacks will be slightly more difficult, but not entirely prevented. Transactions can still pass in arbitrary gas values and clever contract construction can still result in specific gas values being passed to specific calls. It is expected the same surface will remain in EOF, but the ease of exploitation will be reduced.&lt;&#x2F;p&gt;
&lt;p&gt;The legacy &lt;code&gt;*CALL&lt;&#x2F;code&gt; instructions allow to pass gas available for the callee. This ability is used to prevent reentrancy attack but in case of potential future gas repricing proposal this pattern does not give this guarantee any longer. Protecting against reentrancy should be resolved by using &lt;code&gt;TSTORE&#x2F;TLOAD&lt;&#x2F;code&gt; instructions introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt; or other solutions which do not rely on current gas schedule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Elected block proposer has not been slashed</title>
        <published>2023-05-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6988/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6988-elected-block-proposer-has-not-been-slashed/14349" />
        

        <id>https://wg-eips.ritovision.com/6988/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6988"
            label="EIP-6988" />
        

        
        

        
        <summary type="html">Prevents a slashed validator from being elected as a block proposer</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6988/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces a modification to the consensus layer specification which ensures that slashed validator cannot be elected as block proposer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A block proposed by a slashed validator is rejected by the corresponding validity check in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;3115d1140b23dd4c9c23fbd9e2428186cf816bde&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#block-header&quot;&gt;&lt;code&gt;phase0&#x2F;process_block_header&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; function as defined in the consensus layer specification.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time the definition of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;3115d1140b23dd4c9c23fbd9e2428186cf816bde&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#compute_proposer_index&quot;&gt;&lt;code&gt;phase0&#x2F;compute_proposer_index&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; allows for a slashed validator to be elected as a proposer. This contradiction effectively leads to a missed proposal if it is supposed to be made by a slashed validator.&lt;&#x2F;p&gt;
&lt;p&gt;The impact of the proposed fix in the case of a single slashing on Ethereum Mainnet is negligible but it becomes significant in the case of correlated slashings. For instance, a correlated slashing of &lt;code&gt;1&#x2F;10th&lt;&#x2F;code&gt; of a validator set can lead to &lt;code&gt;1&#x2F;10th&lt;&#x2F;code&gt; of missed proposals in a number of epochs after the slashing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Specification of the proposed change can be found in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;specs&#x2F;_features&#x2F;eip6988&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;&#x2F;_features&#x2F;eip6988&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;modifying-get-beacon-proposer-index&quot;&gt;Modifying &lt;code&gt;get_beacon_proposer_index&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This function is modified to read a proposer index from a beacon state if a slot of a latest block header is the same as the &lt;code&gt;state.slot&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This modification is done to make the function return correct proposer index in the case when the proposer of a given block is being slashed during processing of the block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This fix changes proposer election mechanism in a backwards incompatible way and requires a hard fork to be deployed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The following test cases were added to cover this change:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;altair&#x2F;block_processing&#x2F;sync_aggregate&#x2F;test_process_sync_aggregate.py#L712&quot;&gt;&lt;code&gt;test_slashed_proposer_rewarded_for_sync_aggregate_inclusion&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;altair&#x2F;block_processing&#x2F;test_process_attestation.py#L17&quot;&gt;&lt;code&gt;test_slashed_proposer_rewarded_for_attestation_inclusion&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;eip6988&#x2F;unittests&#x2F;validator&#x2F;test_validator.py#L9&quot;&gt;&lt;code&gt;test_slashed_validator_not_elected_for_proposal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;0ad3972725e7c22e8edf3bab2dd7730acbe3c272&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;phase0&#x2F;unittests&#x2F;validator&#x2F;test_validator_unittest.py#L520&quot;&gt;&lt;code&gt;test_slashed_validator_elected_for_proposal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementation is in the same place as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6988&#x2F;#specification&quot;&gt;Specification&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no observed security issues introduced by the proposed change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract Secured Revenue on an EVM based L2</title>
        <published>2023-05-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zak Cole</name><email>zak@numbergroup.xyz</email>
	</author>
	
	<author>
		<name>Zak Cole</name><uri>https://github.com/zscole</uri>
	</author>
	
	<author>
		<name>Kevin Owocki</name><email>kevin@supermodular.xyz</email>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6968/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6968-generalized-csr-protocol/14178" />
        

        <id>https://wg-eips.ritovision.com/6968/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6968"
            label="EIP-6968" />
        

        
        

        
        <summary type="html">Contract Secured Revenue on an EVM based L2</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6968/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contract Secured Revenue (CSR) allows smart contract developers to claim a percentage of all transaction fees paid by users when interacting with their smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes the introduction of CSR on EVM-based L2s which would provide smart contract developers who deploy on L2s access to revenue streams and&#x2F;or public goods.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Using protocol rewards of an L1 to fund smart contract development would be a big change to the way the current market works.  This EIP &lt;em&gt;does not&lt;&#x2F;em&gt; advocate for any changes to the existing Ethereum L1.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does advocate that L2s could begin to experiment with Contract Secured Revenue as a means of:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;creating a new revenue stream for smart contract developers&lt;&#x2F;li&gt;
&lt;li&gt;creating a new way of funding public goods&lt;&#x2F;li&gt;
&lt;li&gt;creating incentives for developers to deploy their dapps on your network&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;REVENUE_SHARE_QUOTIENT&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;fee-mechanism&quot;&gt;Fee Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The current &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee behavior is modified so that &lt;code&gt;header.base_fee_per_gas * REVENUE_SHARE_QUOTIENT&lt;&#x2F;code&gt; per gas is reallocated proportionally, based on gas used, to each contract executed during the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Implicitly, this means that no fees are redistributed to externally owned accounts (EOA).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-tracking&quot;&gt;Gas Tracking&lt;&#x2F;h4&gt;
&lt;p&gt;In order to fairly distribute the fee revenue, a new transaction-wide gas tracker is defined.&lt;&#x2F;p&gt;
&lt;p&gt;When executing a block, maintain a mapping &lt;code&gt;gas_used_by_address&lt;&#x2F;code&gt; of &lt;code&gt;address&lt;&#x2F;code&gt; to &lt;code&gt;uint64&lt;&#x2F;code&gt;. This will track the amount of gas used by each address. For every EVM instruction that does not instantiate a new execution frame (e.g. &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;), add the cost of the instruction to the address&#x27; current sum in the mapping.&lt;&#x2F;p&gt;
&lt;p&gt;For EVM instructions which do instantiate new frames, greater care must be taken to determine the cost of the instruction to the calling frame. For simplicity, this cost is defined to be the total cost of the operation minus the amount of gas passed to the child frame. The gas passed to the child frame is determined via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;. The computed cost is added to the address&#x27; current sum in the mapping.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the address does not exist in the mapping, it&#x27;s total gas used is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the instructions throws an out-of-gas (OOG) error, all remaining gas allocated to execution frame is added to the current total gas used by the address.&lt;&#x2F;li&gt;
&lt;li&gt;No other exceptional halt adds remaining gas to the counter for the address where the halt occurred.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;setting-revenue-recipient&quot;&gt;Setting Revenue Recipient&lt;&#x2F;h4&gt;
&lt;p&gt;Revenue recipients are tracked via a new transaction wide mapping &lt;code&gt;revenue_recipient&lt;&#x2F;code&gt; of &lt;code&gt;address&lt;&#x2F;code&gt; to &lt;code&gt;address&lt;&#x2F;code&gt;. The default value for every key is the key itself. For example, unless set otherwise, the key &lt;code&gt;0xdead...beef&lt;&#x2F;code&gt; maps to the value &lt;code&gt;0xdead...beef&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To set a different revenue recipient, a new instruction &lt;code&gt;SETREVENUERECIPIENT&lt;&#x2F;code&gt; is introduced with the opcode &lt;code&gt;0x49&lt;&#x2F;code&gt;. The operation takes &lt;code&gt;1&lt;&#x2F;code&gt; stack element as input and outputs &lt;code&gt;0&lt;&#x2F;code&gt; stack elements.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;20&lt;&#x2F;code&gt; least significant bytes of the input stack element is the address of the new revenue recipient for the instruction&#x27;s caller. The &lt;code&gt;revenue_recipient&lt;&#x2F;code&gt; entry is updated to reflect this.&lt;&#x2F;p&gt;
&lt;p&gt;The instruction costs &lt;code&gt;3&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dispersing-revenue&quot;&gt;Dispersing Revenue&lt;&#x2F;h4&gt;
&lt;p&gt;After a transaction completes, for every element (&lt;code&gt;addr&lt;&#x2F;code&gt;, &lt;code&gt;gas_used&lt;&#x2F;code&gt;) in &lt;code&gt;gas_used_by_address&lt;&#x2F;code&gt;, increase the balance of &lt;code&gt;revenue_recipient[addr]&lt;&#x2F;code&gt; by &lt;code&gt;gas_used * (header.base_fee_per_gas &#x2F;&#x2F; REVENUE_SHARE_QUOTIENT)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;tracking-gas-proportionally&quot;&gt;Tracking Gas Proportionally&lt;&#x2F;h3&gt;
&lt;p&gt;A simpler mechanism would be to send the full transaction revenue to the &lt;code&gt;to&lt;&#x2F;code&gt; value of the transaction. This, however, does not accurately reward the composition of many different smart contracts and applications. Additionally, it is not compatible with smart contract wallets which, by definition, are often the first destination of a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Maintaining a transaction wide tracker of gas uses makes it possible to distribute revenue to contracts which are genuinely the most utilized.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ephemeral-revenue-recipient-mapping&quot;&gt;Ephemeral Revenue Recipient Mapping&lt;&#x2F;h3&gt;
&lt;p&gt;Constructing the revenue recipient mapping ephemerally during each transaction appears inefficient on the surface. This value is expected to be relatively static and even if it did need to change, the change could be facilitated by the recipient contract.&lt;&#x2F;p&gt;
&lt;p&gt;Unfortunately such a change is much more invasive for the EVM. The recipient value would need to be stored somewhere. This would require a modification to the account structure in the state trie. Also, the recipient value would need to be set at some point. This would necessitate either a modification to the &lt;code&gt;CREATE*&lt;&#x2F;code&gt; opcodes or a new opcode, similar to &lt;code&gt;SETREVENUERECIPIENT&lt;&#x2F;code&gt;, that would be called by initcode to &quot;initialize&quot; the recipient value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;increased-max-block-size-complexity&quot;&gt;Increased Max Block Size&#x2F;Complexity&lt;&#x2F;h3&gt;
&lt;p&gt;Similar to EIP-1559, we must consider the effects this will have on block size. Depending on the method by which this is implemented, it could increase maximum block size in the event that a significant number of contracts opt-in to CSR.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SETCODE instruction</title>
        <published>2023-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6913/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6913-setcode-instruction/13898" />
        

        <id>https://wg-eips.ritovision.com/6913/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6913"
            label="EIP-6913" />
        

        
        

        
        <summary type="html">new instruction to replace code in-place</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6913/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce the &lt;code&gt;SETCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xfc&lt;&#x2F;code&gt;) instruction, which replaces the code of the executing account from memory.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many contracts are upgradeable in order to facilitate improvement or defer decisions without migrating to a new address.
Contracts presently do this in several ways:&lt;&#x2F;p&gt;
&lt;p&gt;The oldest method uses &lt;code&gt;CALL&lt;&#x2F;code&gt;.
The limitation of this method is that internal state must be modifiable by all future implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Second, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; can proxy the implementation.
Some proxies are minimal while others branch to many separate implementation accounts.
This method can also bypass account code size limits.&lt;&#x2F;p&gt;
&lt;p&gt;A third method uses &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; to replace code in-place.
This method improves upon the prior methods by removing the need to call into external contracts.
One limitation of this method is that any internal state is removed by &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.
Another limitation is that &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; does not remove code until the end of the transaction, sacrificing availability until &lt;code&gt;CREATE2&lt;&#x2F;code&gt; can complete the upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Given the upcoming deprecation of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; introduces a better method for replacing code in-place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;When within a read-only execution scope like the recursive kind created by &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; causes an exceptional abort.&lt;&#x2F;p&gt;
&lt;p&gt;When the currently executing code does not equal the code of the executing account, such as can happen inside of &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; causes an exceptional abort.&lt;&#x2F;p&gt;
&lt;p&gt;Otherwise, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; consumes two words from the stack: offset and length.
These specify a range of memory containing the new code.
Any validations that would be performed on the result of &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; occur immediately, potentially causing failure with exceptional abort.
The operations &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; now query the updated code, and message-calls such as &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; now execute the updated code.
Any execution scopes already executing replaced code, including the one that &lt;code&gt;SETCODE&lt;&#x2F;code&gt;, will continue executing the prior code.
Inside such scopes, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; continue to query the executing code.&lt;&#x2F;p&gt;
&lt;p&gt;Like &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, this account modification will be reverted if the current scope or any parent scope reverts or aborts.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;SETCODE&lt;&#x2F;code&gt; does not clear account balance, nonce, or storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost of this operation is the sum of &lt;code&gt;Gselfdestruct&lt;&#x2F;code&gt; and the product of &lt;code&gt;Gcodedeposit&lt;&#x2F;code&gt; and the number of bytes in the new code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The behavior of &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; match the behavior of &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;CREATE&lt;&#x2F;code&gt;, where it is also possible for executing code to differ from the code of the executing account.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of &lt;code&gt;SETCODE&lt;&#x2F;code&gt; is comparable to &lt;code&gt;CREATE&lt;&#x2F;code&gt; but excludes &lt;code&gt;Gcreate&lt;&#x2F;code&gt; because no execution context is created, nor any new account.
Other account modification costs are accounted for outside of execution gas.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, execution proceeds normally after &lt;code&gt;SETCODE&lt;&#x2F;code&gt; in order to allow validation and return data.
Post-update validation can undo a &lt;code&gt;SETCODE&lt;&#x2F;code&gt; operation with &lt;code&gt;REVERT&lt;&#x2F;code&gt;, or with a recursive &lt;code&gt;SETCODE&lt;&#x2F;code&gt;, but &lt;code&gt;REVERT&lt;&#x2F;code&gt; uses less gas.&lt;&#x2F;p&gt;
&lt;p&gt;Preventing &lt;code&gt;SETCODE&lt;&#x2F;code&gt; within most &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; allows static analysis to easily identify mutable code.
Account code not containing the &lt;code&gt;SETCODE&lt;&#x2F;code&gt; operation can be safely assumed to be immutable.
Code observed in a non-reverting context to be immutable will remain immutable, allowing on-chain static analysis for immutability.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The only prior operation changing code is &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.
As code modification via &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is deferred until the end of the transaction, its interactions with &lt;code&gt;SETCODE&lt;&#x2F;code&gt; are well-defined.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;CodeStart&lt;&#x2F;th&gt;&lt;th&gt;CallData&lt;&#x2F;th&gt;&lt;th&gt;CodeResult&lt;&#x2F;th&gt;&lt;th&gt;Gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;6613&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;00&lt;&#x2F;td&gt;&lt;td&gt;00&lt;&#x2F;td&gt;&lt;td&gt;5213&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5013&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffc595ffd&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc595ffd&lt;&#x2F;td&gt;&lt;td&gt;6617&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;365f5f37365ffcfe&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffc00&lt;&#x2F;td&gt;&lt;td&gt;365f5f37365ffcfe&lt;&#x2F;td&gt;&lt;td&gt;all&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Risks related to &lt;code&gt;SETCODE&lt;&#x2F;code&gt; similarly apply to other upgrade patterns.&lt;&#x2F;p&gt;
&lt;p&gt;Most contracts should never be replaced and should not be upgradeable.
Any upgrade mechanism can risk permanent failure.
The possibility of upgrade perpetuates such risk.&lt;&#x2F;p&gt;
&lt;p&gt;Access to upgrade operations should be restricted.
Upgrades should never be performed in a hurry or when tired.
Upgrades should be tested under as similar conditions to production as possible; discrepancies are sources of unexpected results.
When possible, multiple engineers should preview and independently verify pending upgrade procedures.&lt;&#x2F;p&gt;
&lt;p&gt;Block explorers, wallets, and other interfaces should flag upgradeable code.
Client software should warn against approving &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;ERC-721&lt;&#x2F;a&gt; tokens for upgradeable accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reuse Withdrawn Validator Indices</title>
        <published>2023-04-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Lion</name><uri>https://github.com/dapplion</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6914/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6914-reuse-withdrawn-validator-indices/15253" />
        

        <id>https://wg-eips.ritovision.com/6914/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6914"
            label="EIP-6914" />
        

        
        

        
        <summary type="html">Reuse fully withdrawn and safe to reuse validator indices for new beacon chain deposits.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6914/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reuse fully withdrawn validator indices after a sufficient safe-to-reuse period has passed to eliminate the unbounded growth of the beacon chain validator list as the validator set churns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The beacon chain maintains a list of validators and a separate list of balances associated with each validator. When a new deposit for a new validator occurs, the current mechanism only appends, rather than reusing previously fully withdrawn validator indices. As validators fully withdraw and new validators enter, this means the two lists will grow unbounded.&lt;&#x2F;p&gt;
&lt;p&gt;This specification allows for the reuse of validator indices in the event that it is safe to do so, eliminating the concerns around the unbounded validator list growth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus Layer&lt;&#x2F;h3&gt;
&lt;p&gt;The configuration values and mechanics of the specification can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;1a38b83e5db8638ee01c9461cccf11e7d8a3ebce&#x2F;specs&#x2F;_features&#x2F;eip6914&quot;&gt;Consensus Layer specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that validator indices are reused in the event that the validator has been fully withdrawn &lt;em&gt;and&lt;&#x2F;em&gt; that the validator has been withdrawable for a sufficient safe period.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;p&gt;This specification does not require any changes to the Execution Layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;validators&lt;&#x2F;code&gt; and &lt;code&gt;balances&lt;&#x2F;code&gt; lists are currently appended to each time a new Deposit for a new pubkey comes into the beacon chain. Due to the natural mechanics of stakers entering and leaving consensus over long time spans, these lists, thus the state size, will grow unbounded.&lt;&#x2F;p&gt;
&lt;p&gt;Increased state size represents load and&#x2F;or complexity in client implementations. This comes in the form of client memory footprint, state root calculations, validator set scans, and more. This is a relatively simple clean-up within the state transition that will prevent the unnecessary load and complexity of the otherwise unbounded lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible change to the Consensus Layer of Ethereum and must be scheduled with a hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;There are no forwards&#x2F;backwards compatibility issues with the Execution Layer&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are work-in-progress within the standard Consensus Layer tests.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Validator indices cannot be immediately reused but instead must wait &lt;code&gt;SAFE_EPOCHS_TO_REUSE_INDEX&lt;&#x2F;code&gt; epochs to ensure that attestations cannot be &quot;poisoned&quot; with withdrawn validator signatures -- thus non-slashable -- for at least the weak subjectivity period.&lt;&#x2F;p&gt;
&lt;p&gt;The attestation poisoning attack hinges upon two facts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The reuse of a validator index overwrites the previous validator&#x27;s pubkey from the beacon state.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;s includes validator indices to reconstruct signature participants.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;details-of-the-attack&quot;&gt;Details of the attack&lt;&#x2F;h3&gt;
&lt;p&gt;Assume a 1&#x2F;3 attacker. Attacker exits N validators on the honest chain, where N is a small fraction of the validator set. These validators leave the exit queue and are withdrawable within a few days. Now, N new deposits come in and overwrite the validators and most importantly their pubkeys.&lt;&#x2F;p&gt;
&lt;p&gt;The attacker then constructs an alternative attacker chain from before any of the N voluntary exits, such that the original N validators are not exited and withdrawn. N is large enough such that at least one of the N keys is on average in every committee of the attacker chain. The attacker double-signs in an attempt to finalize the attacker chain but ensures that one of the N keys is mixed into any revealed double-signed aggregate attestation -- the individual attestations are unavailable, only aggregates. These malicious attestations are &lt;em&gt;not&lt;&#x2F;em&gt; includable in the honest chain because &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;s rely upon mapping validator indices to particular pubkeys, thus breaking accountable safety.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mitigation&quot;&gt;Mitigation&lt;&#x2F;h3&gt;
&lt;p&gt;Not overwriting withdrawn validators for &lt;code&gt;SAFE_EPOCHS_TO_REUSE_INDEX&lt;&#x2F;code&gt; epochs (3x the max weak subjectivity period) ensures that attestations cannot be poisoned within the accountable safety security window.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative&quot;&gt;Alternative&lt;&#x2F;h3&gt;
&lt;p&gt;Note that if &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;s included a list of pubkeys instead of validator indices, then this would not be an issue. However, this would require more breaking changes and would increase the data requirement of an &lt;code&gt;AttesterSlashing&lt;&#x2F;code&gt;, the largest Consensus Layer data type, by a factor of 6.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Arithmetic verification at EVM level</title>
        <published>2023-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Renan Rodrigues de Souza</name><uri>https://github.com/RenanSouza2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6888/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-math-checking/13846" />
        

        <id>https://wg-eips.ritovision.com/6888/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6888"
            label="EIP-6888" />
        

        
        

        
        <summary type="html">Check for math overflows and division by zero at EVM level</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6888/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds arithmetics checks to EVM arithmetic and a new opcode jump conditionally if there were events. The list of check includes overflows, division by zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The importance of math checks in smart contract projects is very clear. It was an OpenZeppelin library and then incorporated in Solidity&#x27;s default behavior. Bringing this to EVM level can combine both gas efficiency and safety.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Starting from &lt;code&gt;BLOCK_TIMESTAMP &amp;gt;= HARDFORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HARDFORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;UINT_MAX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2 ** 256 - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INT_MIN&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;-(2**255)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;flags&quot;&gt;Flags&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Variable&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Initial Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;carry&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;false&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;overflow&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;false&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Two new flags are added to the EVM state: unsigned warning (&lt;code&gt;carry&lt;&#x2F;code&gt;) and signed warning (&lt;code&gt;overflow&lt;&#x2F;code&gt;). The scope of those flags are the same as the program counter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;From this point forward  &lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt; and &lt;code&gt;c&lt;&#x2F;code&gt; references the arguments in a math operation and &lt;code&gt;res&lt;&#x2F;code&gt; the output. &lt;code&gt;c&lt;&#x2F;code&gt; is only used if the operation takes 3 inputs.&lt;&#x2F;p&gt;
&lt;p&gt;The function &lt;code&gt;sign(x)&lt;&#x2F;code&gt; is defined in the set of &lt;code&gt;uint256 -&amp;gt; {NEGATIVE, ZERO, POSITIVE}&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contidions&quot;&gt;Contidions&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;carry&lt;&#x2F;code&gt; flag MUST be set in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When opcode is &lt;code&gt;ADD&lt;&#x2F;code&gt; (&lt;code&gt;0x01&lt;&#x2F;code&gt;) and &lt;code&gt;res &amp;lt; a&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;MUL&lt;&#x2F;code&gt; (&lt;code&gt;0x02&lt;&#x2F;code&gt;) and &lt;code&gt;a != 0 ∧ res &#x2F; a != b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SUB&lt;&#x2F;code&gt; (&lt;code&gt;0x03&lt;&#x2F;code&gt;) and &lt;code&gt;b &amp;gt; a&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;DIV&lt;&#x2F;code&gt; (&lt;code&gt;0x04&lt;&#x2F;code&gt;) or &lt;code&gt;MOD&lt;&#x2F;code&gt; (&lt;code&gt;0x06&lt;&#x2F;code&gt;); and &lt;code&gt;b == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;ADDMOD&lt;&#x2F;code&gt; (&lt;code&gt;0x08&lt;&#x2F;code&gt;) and &lt;code&gt;c == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;MULMOD&lt;&#x2F;code&gt; (&lt;code&gt;0x08&lt;&#x2F;code&gt;) and &lt;code&gt;c == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;EXP&lt;&#x2F;code&gt; (&lt;code&gt;0x0A&lt;&#x2F;code&gt;) and &lt;code&gt;a ** b &amp;gt; UINT_MAX&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SHL&lt;&#x2F;code&gt; (&lt;code&gt;0x1b&lt;&#x2F;code&gt;) and &lt;code&gt;res &amp;gt;&amp;gt; a != b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;overflow&lt;&#x2F;code&gt; flag MUST be set in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When opcode is &lt;code&gt;ADD&lt;&#x2F;code&gt; (&lt;code&gt;0x01&lt;&#x2F;code&gt;) and &lt;code&gt;a != 0 ∧ b != 0 ∧ sign(a) == sign(b) ∧ sign(a) != sign(res)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SUB&lt;&#x2F;code&gt; (&lt;code&gt;0x03&lt;&#x2F;code&gt;) and &lt;code&gt;(a != 0 ∧ b != 0 ∧ sign(a) != sign(b) ∧ sign(a) != sign(res)) ∨ (a == 0 ^ b == INT_MIN)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;MUL&lt;&#x2F;code&gt; (&lt;code&gt;0x02&lt;&#x2F;code&gt;) and &lt;code&gt;(a == -1 ∧ b == INT_MIN) ∨ (a == INT_MIN ∧ b == -1) ∨ (a != 0 ∧ (res &#x2F; a != b))&lt;&#x2F;code&gt; (this &lt;code&gt;&#x2F;&lt;&#x2F;code&gt; represents &lt;code&gt;SDIV&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SDIV&lt;&#x2F;code&gt; (&lt;code&gt;0x05&lt;&#x2F;code&gt;)  or &lt;code&gt;SMOD&lt;&#x2F;code&gt; (&lt;code&gt;0x06&lt;&#x2F;code&gt;); and &lt;code&gt;b == 0 ∨ (a == INT_MIN ∧ b == -1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When opcode is &lt;code&gt;SHL&lt;&#x2F;code&gt; (&lt;code&gt;0x1b&lt;&#x2F;code&gt;) and &lt;code&gt;res &amp;gt;&amp;gt; a != b&lt;&#x2F;code&gt; (this &lt;code&gt;&amp;gt;&amp;gt;&lt;&#x2F;code&gt; represents &lt;code&gt;SAR&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;jumpc&quot;&gt;&lt;code&gt;JUMPC&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Consumes one argument from the stack, the possible pc dest,
Conditionally alter the program counter depending on the &lt;code&gt;carry&lt;&#x2F;code&gt; flag. &lt;code&gt;J_JUMPC = carry ? µ_s[0] : µ_pc + 1&lt;&#x2F;code&gt;
Clears both flags. &lt;code&gt;carry = overflow = false&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;jumpo&quot;&gt;&lt;code&gt;JUMPO&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Consumes one argument from the stack, the possible pc dest,
Conditionally alter the program counter depending on the &lt;code&gt;ovewflow&lt;&#x2F;code&gt; flag. &lt;code&gt;J_JUMPO = carry ? µ_s[0] : µ_pc + 1&lt;&#x2F;code&gt;
Clears both flags. &lt;code&gt;carry = overflow = false&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;gas&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for both instructions is &lt;code&gt;G_high&lt;&#x2F;code&gt;, the same as &lt;code&gt;JUMPI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EVM uses two&#x27;s complement for negative numbers. The opcodes listed above triggers one or two flags depending if they are used for signed and unsigned numbers.&lt;&#x2F;p&gt;
&lt;p&gt;The conditions described for each opcode is made with implementation friendliness in mind. The only exception is EXP as it is hard to give a concise test as most of the others relied on the inverse operation and there is no native &lt;code&gt;LOG&lt;&#x2F;code&gt;. Most &lt;code&gt;EXP&lt;&#x2F;code&gt; implementations will internally use &lt;code&gt;MUL&lt;&#x2F;code&gt; so the flag &lt;code&gt;carry&lt;&#x2F;code&gt; can be drawn from that instruction, not the &lt;code&gt;overflow&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Both flags are cleaned at the same time because the instructions are expected to be used when transitioning between codes where numbers are treated as signed or unsigned.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode and changes int EVM behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new EVM behavior but each code will decide how to interact with it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Preimage retention</title>
        <published>2023-04-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6873/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6873-preimage-retention-in-the-fork-preceding-the-verge/15830" />
        

        <id>https://wg-eips.ritovision.com/6873/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6873"
            label="EIP-6873" />
        

        
        

        
        <summary type="html">Execution clients must retain the preimages of addresses and slots accessed between the fork preceding the verge, and the verge itself.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6873/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Enforce preimage collection by every node on the network from the fork preceding the verge, up to the fork. This is needed in case each node is responsible for their own conversion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;Let &lt;code&gt;T_p&lt;&#x2F;code&gt; be the timestamp of the fork preceding the verge, and &lt;code&gt;T_v&lt;&#x2F;code&gt; the timestamp of the verge.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;EL clients MUST save the preimage of each address and slot hashes they produce during the execution of all blocks produced between &lt;code&gt;T_p&lt;&#x2F;code&gt; and &lt;code&gt;T_v&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;EL clients MAY start storing preimages outside of this time range as well&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Given a hash produced between &lt;code&gt;T_p&lt;&#x2F;code&gt; and &lt;code&gt;T_v&lt;&#x2F;code&gt;, EL clients SHOULD be able to show they have the preimage for that hash in their database&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;EL clients SHOULD be able to download the preimages of the address and slot hashes that were produced before &lt;code&gt;T_v&lt;&#x2F;code&gt; from a publicly-available datastore&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Switching to verkle trees require a complete rehashing of all tree keys. Most execution clients store all keys hashed, without their preimages, which as the time of print take up 70GB on mainnet. In order to make these preimages available to everyone, the following course of action are available to each user:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Restart a full-sync with preimage retention enabled&lt;&#x2F;li&gt;
&lt;li&gt;Download the preimages as a file&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The second option is the only acceptable option in practice, as a full-sync requires the syncing machine to be offline for several days, and therefore should not be simultaneously imposed to the entire network. A file download, however, poses a problem of data obsolescence as new preimages will immediately need to be added to the list as the chain progresses and new addresses are accessed. Updating the preimage file is not sufficient, since it takes more than a slot time to download over 70GB.&lt;&#x2F;p&gt;
&lt;p&gt;To guarantee a timely availability of all preimages around the verkle transition time, each node is therefore responsible for updating the list of preimages between the fork preceding the Verge, and the Verge itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward compatibility issues found.&lt;&#x2F;p&gt;
&lt;!--

## Test Cases

TODO

--&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;All clients already implement preimage retention, at least as an option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion. &lt;!-- TODO --&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Automatically Reset Testnet</title>
        <published>2023-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mário Havel</name><uri>https://github.com/taxmeifyoucan</uri>
	</author>
	
	<author>
		<name>pk910</name><uri>https://github.com/pk910</uri>
	</author>
	
	<author>
		<name>Rémy Roy</name><uri>https://github.com/remyroy</uri>
	</author>
	
	<author>
		<name>Holly Atkinson</name><uri>https://github.com/atkinsonholly</uri>
	</author>
	
	<author>
		<name>Tereza Burianova</name><uri>https://github.com/T-ess</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6916/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/automatically-reset-testnet/15825" />
        

        <id>https://wg-eips.ritovision.com/6916/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6916"
            label="EIP-6916" />
        

        
        

        
        <summary type="html">A testnet network that periodically rolls back to genesis</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6916/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a specification for an automatically reset testnet, a novel approach to testnets that can be implemented within Ethereum clients. It enables a single testing infrastructure consisting of ephemeral networks with deterministic parameters. Each network iteration is created by a specified function which deterministically generates genesis states.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A testnet which automatically resets can provide an alternative environment for short-term testing of applications, validators and also breaking changes in client implementations. It avoids issues of long running testnets which suffer from state bloat, lack of testnet funds or consensus issues. Periodically resetting the network back to genesis cleans the validator set and returns funds back to faucets while keeping the network reasonably small for easy bootstrapping.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The testnet is set to always reset after a predefined time period. The reset means the generation of the next genesis, discarding the old one and starting a new network. This is possible by introducing functions for the genesis generation and the client reset.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;genesis&quot;&gt;Genesis&lt;&#x2F;h3&gt;
&lt;p&gt;To connect to the current instance of the network, the client must implement the genesis function. This function defines how the client stores information about the testnet and generates the current genesis. With each reset, the network starts from a new genesis which needs to be built based on given parameters and correspond in EL and CL clients.&lt;&#x2F;p&gt;
&lt;p&gt;The network always starts from a genesis which is deterministically created based on the original one - this very first genesis is hardcoded and we can call it &lt;code&gt;genesis 0&lt;&#x2F;code&gt;. Terminal time, the expiration of each genesis, is the addition of the start time of that genesis &lt;code&gt;MIN_GENESIS_TIME&lt;&#x2F;code&gt; and the testnet lifetime &lt;code&gt;period&lt;&#x2F;code&gt;, where &lt;code&gt;period&lt;&#x2F;code&gt; is a constant defining the length of time a single ephemeral network runs. Therefore, once the current slot timestamp reaches the terminal time of the ephemeral network, it has to switch to a new genesis. The main changes in each new genesis iteration are chainId, genesis time and the withdrawal credentials of the first validator.&lt;&#x2F;p&gt;
&lt;p&gt;Clients shall include a hardcoded &lt;code&gt;genesis 0&lt;&#x2F;code&gt; parameters, much like other networks predefined in clients. However, this genesis shall be used directly, only at the very beginning of the testnet&#x27;s existence, in its first iteration where &lt;code&gt;i&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;. Later on, with iteration &lt;code&gt;i&lt;&#x2F;code&gt; equal to &lt;code&gt;1&lt;&#x2F;code&gt; and above, the client does not initialize this genesis but uses it to derive the current one. When &lt;code&gt;i&amp;gt;0&lt;&#x2F;code&gt;, given a known &lt;code&gt;period&lt;&#x2F;code&gt; and current slot timestamp, the client always calculates the number of lifecycle iterations from &lt;code&gt;genesis 0&lt;&#x2F;code&gt; and creates a new genesis with the latest parameters.&lt;&#x2F;p&gt;
&lt;p&gt;When the client starts with the option of an ephemeral testnet, it checks whether a genesis for the network is present. If it doesn&#x27;t exist or the current slot timestamp is older than &lt;code&gt;current_genesis.genesis_time + period&lt;&#x2F;code&gt;, it triggers the generation of a new genesis. This new genesis, derived from &lt;code&gt;genesis 0&lt;&#x2F;code&gt;, will be written to the database and used to run the current network.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-client&quot;&gt;Execution client&lt;&#x2F;h4&gt;
&lt;p&gt;The EL client includes the hardcoded &lt;code&gt;genesis 0&lt;&#x2F;code&gt; serving as a preimage for generating the current one. Iteration of variables is done as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Number of iterations:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;i&lt;&#x2F;code&gt; = &lt;code&gt;int((current_slot_timestamp&lt;&#x2F;code&gt; - &lt;code&gt;genesis_0.genesis_time) &#x2F; period)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Genesis time of current genesis:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;current_genesis.genesis_time&lt;&#x2F;code&gt; = &lt;code&gt;period&lt;&#x2F;code&gt; * &lt;code&gt;i&lt;&#x2F;code&gt; + &lt;code&gt;genesis_0.genesis_time&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Current EL ChainId:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; = &lt;code&gt;genesis_0.chainId&lt;&#x2F;code&gt; + &lt;code&gt;i&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;consensus-client&quot;&gt;Consensus client&lt;&#x2F;h4&gt;
&lt;p&gt;Genesis generation in the CL client includes config with iterated values, similarly to EL, but also requires the updated genesis state. The state in SSZ format can be either generated by the client or downloaded from an external source. It includes validators with deposits ready to launch a merged network with the validator set created by trusted entities within the community.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MIN_GENESIS_TIME&lt;&#x2F;code&gt; is set to the latest genesis time and defines when the current period starts. It is recommended to add a small &lt;code&gt;GENESIS_DELAY&lt;&#x2F;code&gt;, for example 15 minutes, to avoid issues while infrastructure is restarting with the new genesis.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure a successful reset, &lt;code&gt;ForkDigest&lt;&#x2F;code&gt; needs to be unique for each iteration. In order to keep the &lt;code&gt;ForkVersions&lt;&#x2F;code&gt; of the network static for better tooling support, the withdrawal credentials of the first validator in the validator set need to be overridden by a calculated value.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;genesis.validators[0].withdrawal_credentials&lt;&#x2F;code&gt; = &lt;code&gt;0x0100000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; + &lt;code&gt;i&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;genesis.genesis_validators_root&lt;&#x2F;code&gt; =  &lt;code&gt;hash_tree_root(genesis.validators)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The update of &lt;code&gt;genesis.validators[0]&lt;&#x2F;code&gt; changes the state, therefore, clients have to be able to generate or download the latest genesis state. Generating the genesis ssz is not considered a standard client feature and adding it enables to trustlessly create the latest genesis state at the price of certain complexity. An alternative solution is to obtain it from a third party, either by downloading the ssz file from a server or using the checkpoint sync feature with an endpoint serving the genesis state. This became an accepted practice with Holešky testnet and existing features of checkpoint sync can be used for obtaining genesis states for automatically reset testnets. It also allows maintainers to update the genesis validator set without requiring new client releases. The full implementation of the recommended practice for obtaining the latest CL state should behave as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When the testnet flag is provided and client supports checkpoint sync of genesis, automatically use the hardcoded checkpoint endpoint to download the latest genesis state using the checkpoint sync feature
&lt;ul&gt;
&lt;li&gt;If user provides a custom checkpoint sync flag, override the default option and use the endpoint provided by user&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Include a backup download option pointing to an url with the latest testnet release, a publicly distributed ssz file, and trigger this option if the checkpoint state sync fails or make it the default if client doesn&#x27;t support genesis checkpoint sync&lt;&#x2F;li&gt;
&lt;li&gt;If the client includes a feature for generating the genesis or some of its parameters, use it to verify parameters in the downloaded state and issue an error if values or checksum don&#x27;t correspond&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It&#x27;s important to note that &lt;code&gt;genesis_validators_root&lt;&#x2F;code&gt; is normally predefined in the client but in this case it&#x27;s not known in advance which can potentially break certain architectures. For example light clients which are relying on hardcoded &lt;code&gt;genesis_validators_root&lt;&#x2F;code&gt; won&#x27;t work.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reset&quot;&gt;Reset&lt;&#x2F;h3&gt;
&lt;p&gt;The reset function defines an automatic process of throwing away the old data and starting with a new genesis. It depends on the previously defined function for genesis generation which the client must implement in order to be able to automatically follow the latest network iteration.&lt;&#x2F;p&gt;
&lt;p&gt;For the reset function, we can introduce the &lt;code&gt;terminal_timestamp&lt;&#x2F;code&gt; value which defines the network expiry time of an iteration. It can be the same as the genesis time of the next iteration (without the genesis delay) or can be calculated simply as &lt;code&gt;terminal_timestamp = current_genesis.genesis_time + period&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When the network reaches a slot with a timestamp &lt;code&gt;&amp;gt;= terminal_timestamp&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Client stops accepting&#x2F;creating new blocks
&lt;ul&gt;
&lt;li&gt;Shutdown client services running the network, e.g. p2p communication, beacon service, execution environment&lt;&#x2F;li&gt;
&lt;li&gt;This feature should be implemented alongside Genesis even without further reset functions just to create a basic support which is always safe from forking&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client calls a function which discards the current genesis, all chain or beacon data
&lt;ul&gt;
&lt;li&gt;Clients already include db tools including for purging the database which could be used here&lt;&#x2F;li&gt;
&lt;li&gt;It might be beneficial to include an additional flag, e.g. &lt;code&gt;--retain-ephemeral-data&lt;&#x2F;code&gt;, which would first export the existing data in a standard format before removing the database&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client triggers the Genesis function (as defined above):
&lt;ul&gt;
&lt;li&gt;Behaves like a regular client startup when genesis is not present&lt;&#x2F;li&gt;
&lt;li&gt;New genesis is written into db and initialized&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Main network services are started again pointing to the updated genesis&lt;&#x2F;li&gt;
&lt;li&gt;After the new genesis time is reached, the network starts again from the new genesis&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a full reset implementation, clients should be able to perform the above actions without requiring manual restart, operating the network fully independently and with minimal downtime.&lt;&#x2F;p&gt;
&lt;p&gt;Note that depending on the client architecture, it may not be feasible to fully implement such an internal reset mechanism, e.g. if the client doesn&#x27;t support a graceful shutdown. The reset feature is considered an advanced level of support and is mainly needed by infrastructure providers and genesis validators. The assumption is that even if the client doesn&#x27;t implement reset, advanced users can achieve similar behavior with external scripts handling the client by system tools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Ephemeral testnets with deterministic parameters provide a sustainable alternative to traditional testnets, with the same infrastructure. At each reset, the validator set is cleared, faucets are filled again and the database is kept small.&lt;&#x2F;p&gt;
&lt;p&gt;Upon reset the whole state is purged, which, on the one hand keeps the network small and easy to bootstrap but introduces problems for testing longer term &#x2F; advanced applications. However, basic contract infrastructure can be automatically deployed after each reset by any user. Generally, using the network is recommended for short term testing, deploying &lt;code&gt;Hello World&lt;&#x2F;code&gt; kinds of contracts that don&#x27;t need to stay forever on a long term testnet. However, there can be an offchain mechanism that automatically deploys standard contract primitives after each reset so application developers can also utilize the network more.&lt;&#x2F;p&gt;
&lt;p&gt;By defining two mechanisms for Genesis and Reset, this EIP enables two levels of how a client implementation can support the testnet;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Basic support requires the client to determine the current network specs and enables only connecting to the network.
&lt;ul&gt;
&lt;li&gt;This means support of the Genesis mechanism defined above&lt;&#x2F;li&gt;
&lt;li&gt;Enough to participate in the network for short term testing&lt;&#x2F;li&gt;
&lt;li&gt;To follow the latest iteration, the user has to manually shut down the client and delete the database&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s still recommended to add a feature for terminating the network&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Full support enables the client to follow the reset process and always sync the latest chain iteration
&lt;ul&gt;
&lt;li&gt;This also requires the client to implement an inherent Reset feature&lt;&#x2F;li&gt;
&lt;li&gt;Needed for running persistent infrastructure, genesis validators and bootnodes&lt;&#x2F;li&gt;
&lt;li&gt;It might be more complex to implement due to client architecture of clients&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The design is also compatible with nodes managed by external tooling, i.e. even if the client doesn&#x27;t implement these features, it can run on the same network as other nodes which are automatically reset by scripts. Any client supporting a custom network can be used for the testnet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;network-parameters&quot;&gt;Network parameters&lt;&#x2F;h3&gt;
&lt;p&gt;Constants and variables defining testnet properties are arbitrary but need to be crafted considering certain limitations and security properties set out below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reset-period&quot;&gt;Reset Period&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;period&lt;&#x2F;code&gt; is a constant, hardcoded in the client defining the period of time after which the network resets.&lt;&#x2F;p&gt;
&lt;p&gt;It can be defined based on users&#x27; needs but for security reasons, it also depends on the number of validators in genesis. Considering the time to activate a validator, the number of trusted validators should be high enough so the network cannot be overtaken by a malicious actor.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Genesis&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Validators&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; until&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; 66%&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; majority&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;10k&lt;&#x2F;span&gt;&lt;span&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1289&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (5,7&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;50k&lt;&#x2F;span&gt;&lt;span&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6441&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (28,6&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;75k&lt;&#x2F;span&gt;&lt;span&gt;  =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9660&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (42,9&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;100k&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12877&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (57,2&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;150k&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 19323&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (85,9&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;200k&lt;&#x2F;span&gt;&lt;span&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 25764&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; Epochs&lt;&#x2F;span&gt;&lt;span&gt; (114,5&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; days&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;chainid&quot;&gt;ChainId&lt;&#x2F;h4&gt;
&lt;p&gt;ChainId is a variable because it needs to keep changing with each new genesis to avoid replay attack. The function for the new ChainId value is a simple incrementation (+1). The ChainId in &lt;code&gt;genesis 0&lt;&#x2F;code&gt; is a hardcoded constant. This constant is used by the client with each new genesis to derive a new ChainId for that network iteration.&lt;&#x2F;p&gt;
&lt;p&gt;New ChainIds shouldn&#x27;t collide with any other existing public EVM chain even after many iterations. Consequently, low ChainId values are discouraged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The network itself is providing a secure environment thanks to regular resets. Even if some sort of vulnerability is exploited, it will be cleared on the next reset. This is also a reason to keep periods relatively short (weeks&#x2F;months opposed to months&#x2F;years) with a big enough genesis validator set to keep an honest majority.&lt;&#x2F;p&gt;
&lt;p&gt;Changes in clients caused by the implementation of features for resetting networks need to be reviewed together with standard security procedures. Especially the mechanism for triggering reset which must be separated from other networks that are not configured as ephemeral.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ex Post Facto Cascading Revert</title>
        <published>2023-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6810/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6810-ex-post-facto-cascading-revert/13630" />
        

        <id>https://wg-eips.ritovision.com/6810/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6810"
            label="EIP-6810" />
        

        
        

        
        <summary type="html">Allow transactions to be reversed after confirmation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6810/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A new transaction type reverts one of a sender&#x27;s prior transactions, and other transactions dependent on that state, recursively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While Ethereum has the capability of reversible transactions through smart contracts, instant settlement is the default.
But sometimes users make mistakes.
Most mistakes are discovered quickly.
However, once the transaction is confirmed, it is settled.
There are many use cases for reverting settled transactions.
Some of the most-common mistakes are listed below.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Wrong recipient&lt;&#x2F;li&gt;
&lt;li&gt;Unintended consequences&lt;&#x2F;li&gt;
&lt;li&gt;Got scammed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This feature addresses these issues and more, ending all regret.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;0x5a&lt;&#x2F;code&gt;.
The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chainId, nonce, revertNonce, budget, signatureYParity, signatureR, signatureS])&lt;&#x2F;code&gt;.
The &lt;code&gt;signatureYParity, signatureR, signatureS&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x5a || rlp([chainId, nonce, revertNonce, budget]))&lt;&#x2F;code&gt;.
The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, budgetUsed, removedLogsBloom, [newReceiptPayloads]])&lt;&#x2F;code&gt;, where &lt;code&gt;newReceiptPayloads&lt;&#x2F;code&gt; is a sequential array of the updated receipts of all reverted transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-gas-limit&quot;&gt;Block gas limit&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction of type &lt;code&gt;0x5a&lt;&#x2F;code&gt; shall be the only transaction in its block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cascading-revert-operation&quot;&gt;Cascading revert operation&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction fee budget is initialized to the value specified by &lt;code&gt;budget&lt;&#x2F;code&gt;, denominated in ether.
This budget is the transaction fee for this type of transaction.
Reverted transaction fees are refunded from this budget.
Should the budget be insufficient, the Ex Post Facto Cascading Revert transaction fails and the entire budget is paid to the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; specified in the block header.
Otherwise, the remainder of the budget after all transactions are reverted is paid to the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; account.&lt;&#x2F;p&gt;
&lt;p&gt;The state is rolled back to the start of the transaction specified by &lt;code&gt;revertNonce&lt;&#x2F;code&gt;.
An access list is initialized empty.
Any state previously modified by a reverted transaction is added to the access list.
Any subsequent transaction reading or using state included in the access list must also be reverted.
This operation cascades forward until the current block.&lt;&#x2F;p&gt;
&lt;p&gt;State includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ether balance&lt;&#x2F;li&gt;
&lt;li&gt;contract code&lt;&#x2F;li&gt;
&lt;li&gt;account nonce&lt;&#x2F;li&gt;
&lt;li&gt;storage keys&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;snap-sync&quot;&gt;Snap sync&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the large amount of state that may be modified by such a transaction, slower clients should use snap sync to load the new state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The transaction must fill the entire block to prevent MEV attacks.&lt;&#x2F;p&gt;
&lt;p&gt;While some cascading reverts are highly consequential, others are considerably simpler.
The budget ensures the full network cost of the operation is paid.
For example, reversing a token transfer to the wrong recipient would be relatively cheap.
On the other hand, it would be prohibitively expensive to revert all deposits to a custodial exchange.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction fees must be refunded from this budget rather than the prior block reward in order to protect the security of the consensus protocol.&lt;&#x2F;p&gt;
&lt;p&gt;Snap sync should be safe because if the state root is invalid then the block producer could get slashed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;If we find any backwards compatibility issue we can maybe reverse those transactions.
If that doesn&#x27;t work idk maybe need another hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Reverting a transaction that ever funded an account reverts all of that account&#x27;s subsequent transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Reverting the transaction that deploys a contract reverts all transactions interacting with that contract.&lt;&#x2F;li&gt;
&lt;li&gt;Reverting a transfer to a new account does not revert other transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Seems simple enough.
TODO this later; should only take a few hours, tops.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This specification has been audited by Illinois Senator Robert Peters.
No exploits were found.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>To The Moon—10 Minute Blocks</title>
        <published>2023-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Pandapip1</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6811/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ethereum-to-the-moon/13633" />
        

        <id>https://wg-eips.ritovision.com/6811/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6811"
            label="EIP-6811" />
        

        
        

        
        <summary type="html">Increases the block time to facilitate finality over cosmic distances</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6811/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP makes a minimal number of changes to allow Ethereum to be used on the moon and other potentially habitable bodies in Earth&#x27;s solar system. It changes the time between blocks, the per-block validator reward, and the number of blocks per epoch.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is impossible for today&#x27;s Ethereum to literally &quot;go to the moon&quot; due to a limitation in the protocol: the block length. Should validators attempt to validate on the surface of the moon, they would find that the ~1.25 second communication delay (caused by the speed of light) might cause issues with synchronization, considering the 12-second timer between blocks. The validators would eventually be ejected on the terrestrial chain after leaking. If however a substantial number of validators are displaced (think 1&#x2F;3), they might follow their own fork and would eventually eject the terrestrial to finalize their own chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The time between blocks MUST be changed from 12 seconds to 600 seconds (10 minutes).&lt;&#x2F;li&gt;
&lt;li&gt;The per-block validator reward MUST be multiplied by 50&lt;&#x2F;li&gt;
&lt;li&gt;The number of blocks per epoch MUST be reduced from 4 to 2&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The block gas limit is multiplied by fifty to compensate for the time between blocks being multiplied by fifty.&lt;&#x2F;li&gt;
&lt;li&gt;The per-block validator reward is also multiplied by fifty to compensate for the time between blocks being multiplied by fifty.&lt;&#x2F;li&gt;
&lt;li&gt;Epochs are changed to be 2 blocks long so that finality can be reached in a reasonable amount of time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Many applications expect mainnet transactions to be included in a short amount of time. This would clearly no longer be the case. Such applications should switch to planetary rollups. Syncing rollups across heavenly bodies is outside the scope of this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Definitely needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SELFDESTRUCT only in same transaction</title>
        <published>2023-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6780/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/deactivate-selfdestruct-except-where-it-occurs-in-the-same-transaction-in-which-a-contract-was-created/13539" />
        

        <id>https://wg-eips.ritovision.com/6780/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6780"
            label="EIP-6780" />
        

        
        

        
        <summary type="html">SELFDESTRUCT will recover all funds to the target but not delete the account, except when called in the same transaction as creation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6780/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the functionality of the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode. The new functionality will be only to send all Ether in the account to the target, except that the current behaviour is preserved when &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is called in the same transaction a contract was created.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode requires large changes to the state of an account, in particular removing all code and storage. This will not be possible in the future with Verkle trees: Each account will be stored in many different account keys, which will not be obviously connected to the root account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP implements this change. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to retrieve funds will still work. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in the same transaction as they created a contract will also continue to work without any changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The behaviour of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is changed in the following way:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;When &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is executed in a transaction that is not the same as the contract calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; was created:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The current execution frame halts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; does not delete any data (including storage keys, code, or the account itself).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; transfers the entire account balance to the target.&lt;&#x2F;li&gt;
&lt;li&gt;Note that if the target is the same as the contract calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; there is no net change in balances.  Unlike the prior specification, Ether will not be burnt in this case.&lt;&#x2F;li&gt;
&lt;li&gt;Note that no refund is given since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; regarding &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;When &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is executed in the same transaction as the contract was created:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; continues to behave as it did prior to this EIP, this includes the following actions
&lt;ul&gt;
&lt;li&gt;The current execution frame halts.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; deletes data as previously specified.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; transfers the entire account balance to the target&lt;&#x2F;li&gt;
&lt;li&gt;The account balance of the contact calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is set to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Note that if the target is the same as the contract calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; that Ether will be burnt.&lt;&#x2F;li&gt;
&lt;li&gt;Note that no refund is given since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; regarding &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A contract is considered created at the beginning of a create transaction or when a CREATE series operation begins execution (CREATE, CREATE2, and other operations that deploy contracts in the future).  If a balance exists at the contract&#x27;s new address it is still considered to be a contract creation.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode remains deprecated as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6049&#x2F;&quot;&gt;EIP-6049&lt;&#x2F;a&gt;. Any use in newly deployed contracts is strongly discouraged even if this new behaviour is taken into account, and future changes to the EVM might further reduce the functionality of the opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Getting rid of the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode has been considered in the past, and there are currently no strong reasons to use it. This EIP implements a behavior that will attempt to leave some common uses of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; working, while reducing the complexity of the change on EVM implementations that would come from contract versioning.&lt;&#x2F;p&gt;
&lt;p&gt;Handling the account creation and contract creation as two distinct and possibly separate events is needed for use cases such as counterfactual accounts.  By allowing the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to delete the account at contract creation time it will not result in stubs of counterfactually instantiated contracts that never had any on-chain state other than a balance prior to the contract creation. These accounts would never have any storage and thus the trie updates to delete the account would be limited to the account node, which is the same impact a regular transfer of ether would have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts that depended on re-deploying contracts at the same address using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (after a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;) will no longer function properly if the created contract does not call &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; within the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Previously it was possible to burn ether by calling &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; targeting the executing contract as the beneficiary.  If the contract existed prior to the transaction the ether will not be burned.  If the contract was newly created in the transaction the ether will be burned, as before.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for this EIP can be found in the Execution Spec Tests suite &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip6780_selfdestruct&quot;&gt;&lt;code&gt;eip6780_selfdestruct&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following applications of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be broken and applications that use it in this way are not safe anymore:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Where &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is used to redeploy a contract in the same place in order to make a contract upgradable. This is not supported anymore and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2535&#x2F;&quot;&gt;ERC-2535&lt;&#x2F;a&gt; or other types of proxy contracts should be used instead.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Where a contract depended on burning Ether via a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with the contract as beneficiary, in a contract not created within the same transaction.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Revert creation in case of collision</title>
        <published>2023-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Renan Rodrigues de Souza</name><uri>https://github.com/RenanSouza2</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/684/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-revert-on-address-collision/13442" />
        

        <id>https://wg-eips.ritovision.com/684/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:684"
            label="EIP-684" />
        

        
        

        
        <summary type="html">Revert contract creation if address already has code</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/684/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP causes contract creation to throw an error when attempted at an address with pre-existing code. This prevents an attack consisting of deploying contract code and later changing the code arbitrarily by &quot;creating&quot; an account at that existing address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;If a contract creation is attempted due to a creation transaction, the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode, the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode, or any other reason, and the destination address already has either a nonzero nonce, or a nonzero code length, then the creation MUST throw as if the first byte in the init code were an invalid opcode. This change MUST apply retroactively for all existing blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;One of the core tenets of smart contracts is that their code will not change. However with sufficient computing power an attacker can change the code stored in an address to any other code, steal funds or execute other malicious activity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is an execution layer upgrade, and so it requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Given a genesis allocation of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address : 0xd0bBEc6D2c628b7e2E6D5556daA14a5181b604C5,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance : 1000000000000000000, &#x2F;&#x2F; 1 ether&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce   : 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;code    : &amp;quot;&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address : 0x7658771dc6Af74a3d2F8499D349FF9c1a0DF8826,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance : 0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce   : 1,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Code    : &amp;quot;0xB0B0FACE&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A contract created in the first transaction from EOA &lt;code&gt;0xd0bBEc6...&lt;&#x2F;code&gt; (&lt;code&gt;227bcc6959669226360814723ed739f1214201584b6a27409dfb8228b8be5f59&lt;&#x2F;code&gt;), with no salt, should revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a security upgrade: it enforces the immutability of deployed code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethereum state using a unified verkle tree</title>
        <published>2023-03-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Kevaundray Wedderburn</name><uri>https://github.com/kevaundray</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	<author>
		<name>Gottfried Herold</name><uri>https://github.com/GottfriedHerold</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6800/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/proposed-verkle-tree-scheme-for-ethereum-state/5805" />
        

        <id>https://wg-eips.ritovision.com/6800/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6800"
            label="EIP-6800" />
        

        
        

        
        <summary type="html">This introduces a new Verkle state tree alongside the existing MPT.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6800/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new Verkle state tree alongside the existing hexary Patricia tree. After the hard fork, the Verkle tree stores all edits to state and a copy of all accessed state, and the hexary Patricia tree can no longer be modified. This is a first step in a multi-phase transition to Ethereum exclusively relying on Verkle trees to store execution state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Verkle trees solve a key problem standing in the way of Ethereum being stateless-client-friendly: witness sizes. A witness accessing an account in today’s hexary Patricia tree is, in the average case, close to 3 kB, and in the worst case it may be three times larger. Assuming a worst case of 6000 accesses per block (15m gas &#x2F; 2500 gas per access), this corresponds to a witness size of ~18 MB, which is too large to safely broadcast through a p2p network within a 12-second slot. Verkle trees reduce witness sizes to ~200 bytes per account in the average case, allowing stateless client witnesses to be acceptably small.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verkle-tree-definition&quot;&gt;Verkle tree definition&lt;&#x2F;h3&gt;
&lt;p&gt;We define a Verkle tree here by providing the function to compute the root commitment given a set of 32-byte keys and 32-byte values. Algorithms for updating and inserting values are up to the implementer; the only requirement is that the root commitment after the update must continue to match the value computed from this specification. We will then define an embedding that provides the 32-byte key at which any particular piece of state information (account headers, code, storage) should be stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Bandersnatch curve order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BANDERSNATCH_MODULUS = \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;13108968793781547619861935127046491459309155893440570251786403306729687672801&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Bandersnatch Pedersen basis of length 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PEDERSEN_BASIS = [....]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;VERKLE_NODE_WIDTH = len(PEDERSEN_BASIS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def group_to_scalar_field(point: Point) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Not collision resistant. Not random oracle. &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Binding for Pedersen commitments.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert isinstance(point, Point)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if point == bandersnatch.Z:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return point.map_to_base_field() % BANDERSNATCH_MODULUS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def compute_commitment_root(children: Sequence[int]) -&amp;gt; Point:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    o = bandersnatch.Z&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for generator, child in zip(PEDERSEN_BASIS, children):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        o = bandersnatch.add(o, bandersnatch.mul(generator, child))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return o&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def extension_and_suffix_tree(stem: bytes31, values: Dict[byte, bytes32]) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_leaves = [0] * 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for suffix, value in values.items():&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves[2 * suffix] = int.from_bytes(value[:16], &amp;#39;little&amp;#39;) + 2**128&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_leaves[2 * suffix + 1] = int.from_bytes(value[16:], &amp;#39;little&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C1 = compute_commitment_root(sub_leaves[:256])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C2 = compute_commitment_root(sub_leaves[256:])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return compute_commitment_root([1, # Extension marker&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    int.from_bytes(stem, &amp;quot;little&amp;quot;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field(C1),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    group_to_scalar_field(C2)] +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                    [0] * 252)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def compute_main_tree_root(data: Dict[bytes32, int],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                           prefix: bytes) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Empty subtree: 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if len(data) == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif len(data) == 1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return list(data.values())[0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sub_commitments = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            compute_main_tree_root({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    key: value for key, value in data.items() if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    key[:len(prefix) + 1] == prefix + bytes([i])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }, prefix + bytes([i]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            for i in range(VERKLE_NODE_WIDTH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return group_to_scalar_field(compute_commitment_root(sub_commitments))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def compute_verkle_root(data: Dict[bytes32, bytes32]) -&amp;gt; Point:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    stems = set(key[:-1] for key in data.keys())&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data_as_stems = {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    for stem in stems:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        commitment_data = Dict[byte, bytes32]()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for i in range(VERKLE_NODE_WIDTH):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if stem + bytes([i]) in data:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                commitment_data[i] = data[stem + bytes([i])]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        data_as_stems[stem] = extension_and_suffix_tree(stem, commitment_data)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_commitments = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compute_main_tree_root({&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                key: value for key, value in data.items() if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                key[0] == i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }, bytes([i]))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for i in range(VERKLE_NODE_WIDTH)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return compute_commitment_root(sub_commitments)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that a value of zero is not the same thing as a position being empty; a position being empty is represented as 0 in the bottom layer commitment, but a position being zero is represented by a different value in the suffix tree commitment (2**128 is added to value_lower to distinguish it from empty). This distinction between zero and empty is not a property of the existing Patricia tree, but it is a property of the proposed Verkle tree.&lt;&#x2F;p&gt;
&lt;p&gt;In the rest of this document, saving or reading a number at some position in the Verkle tree will mean saving or reading the 32-byte little-endian encoding of that number.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;illustration&quot;&gt;Illustration&lt;&#x2F;h3&gt;
&lt;p&gt;This is an illustration of the tree structure.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;.&#x2F;assets&#x2F;tree_structure.png&quot; alt=&quot;tree structure&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tree-embedding&quot;&gt;Tree embedding&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of a two-layer structure as in the Patricia tree, in the Verkle tree we will embed all information into a single &lt;code&gt;key: value&lt;&#x2F;code&gt; tree. This section specifies which tree keys store the information (account header data, code, storage) in the state.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_HASH_LEAF_KEY&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CODE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;VERKLE_NODE_WIDTH&lt;&#x2F;td&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;td&gt;&lt;td&gt;256**31&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;em&gt;It’s a required invariant that &lt;code&gt;VERKLE_NODE_WIDTH &amp;gt; CODE_OFFSET &amp;gt; HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; and that &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; is greater than the leaf keys. Additionally, &lt;code&gt;MAIN_STORAGE_OFFSET&lt;&#x2F;code&gt; must be a power of &lt;code&gt;VERKLE_NODE_WIDTH&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note that addresses are always passed around as an &lt;code&gt;Address32&lt;&#x2F;code&gt;. To convert existing addresses to &lt;code&gt;Address32&lt;&#x2F;code&gt;, prepend with 12 zero bytes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def old_style_address_to_address32(address: Address) -&amp;gt; Address32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return b&amp;#39;\x00&amp;#39; * 12 + address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;header-values&quot;&gt;Header values&lt;&#x2F;h4&gt;
&lt;p&gt;These are the positions in the tree at which block header fields of an account are stored.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def hash_point_to_bytes(point: Point) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return group_to_scalar_field(point).to_bytes(32, &amp;#39;little&amp;#39;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def pedersen_hash(inp: bytes) -&amp;gt; bytes32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    assert len(inp) &amp;lt;= 255 * 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Interpret input as list of 128 bit (16 byte) integers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ext_input = inp + b&amp;quot;\0&amp;quot; * (255 * 16 - len(inp))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ints = [2 + 256 * len(inp)] + \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;           [int.from_bytes(ext_input[16 * i:16 * (i + 1)], &amp;#39;little&amp;#39;) for i in range(255)]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return compute_commitment_root(ints).hash_point_to_bytes()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key(address: Address32, tree_index: int, sub_index: int):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Assumes VERKLE_NODE_WIDTH = 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pedersen_hash(address + tree_index.to_bytes(32, &amp;#39;little&amp;#39;))[:31] +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes([sub_index])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_basic_data(address: Address32):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Backwards compatibility for EXTCODEHASH    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_code_hash(address: Address32):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(address, 0, CODE_HASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An account&#x27;s &lt;code&gt;version&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are packed with big-endian encoding in the value found at &lt;code&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Offset&lt;&#x2F;th&gt;&lt;th&gt;Size&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;version&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;code_size&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;balance&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Bytes &lt;code&gt;1..4&lt;&#x2F;code&gt; are reserved for future use.&lt;&#x2F;p&gt;
&lt;p&gt;The current layout and encoding allow for an extension of &lt;code&gt;code_size&lt;&#x2F;code&gt; to 4 bytes without changing the account version.&lt;&#x2F;p&gt;
&lt;p&gt;When any account header field is set, the &lt;code&gt;version&lt;&#x2F;code&gt; field is also set to zero. The &lt;code&gt;codehash&lt;&#x2F;code&gt; and &lt;code&gt;code_size&lt;&#x2F;code&gt; fields are set upon contract or EoA creation.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;code&quot;&gt;Code&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_code_chunk(address: Address32, chunk_id: int):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (CODE_OFFSET + chunk_id) &#x2F;&#x2F; VERKLE_NODE_WIDTH,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (CODE_OFFSET + chunk_id)  % VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Chunk &lt;code&gt;i&lt;&#x2F;code&gt; stores a 32 byte value, where bytes 1…31 are bytes &lt;code&gt;i*31...(i+1)*31 - 1&lt;&#x2F;code&gt; of the code (ie. the i’th 31-byte slice of it), and byte 0 is the number of leading bytes that are part of PUSHDATA (eg. if part of the code is &lt;code&gt;...PUSH4 99 98 | 97 96 PUSH1 128 MSTORE...&lt;&#x2F;code&gt; where &lt;code&gt;|&lt;&#x2F;code&gt; is the position where a new chunk begins, then the encoding of the latter chunk would begin &lt;code&gt;2 97 96 PUSH1 128 MSTORE&lt;&#x2F;code&gt; to reflect that the first 2 bytes are PUSHDATA).&lt;&#x2F;p&gt;
&lt;p&gt;For precision, here is an implementation of code chunkification:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH_OFFSET = 95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH1 = PUSH_OFFSET + 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH32 = PUSH_OFFSET + 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def chunkify_code(code: bytes) -&amp;gt; Sequence[bytes32]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Pad to multiple of 31 bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if len(code) % 31 != 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        code += b&amp;#39;\x00&amp;#39; * (31 - (len(code) % 31))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Figure out how much pushdata there is after+including each byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytes_to_exec_data = [0] * (len(code) + 32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    while pos &amp;lt; len(code):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if PUSH1 &amp;lt;= code[pos] &amp;lt;= PUSH32:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes = code[pos] - PUSH_OFFSET&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pushdata_bytes = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos += 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for x in range(pushdata_bytes):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            bytes_to_exec_data[pos + x] = pushdata_bytes - x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos += pushdata_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Output chunks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        bytes([min(bytes_to_exec_data[pos], 31)]) + code[pos: pos+31]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for pos in range(0, len(code), 31)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;storage&quot;&gt;Storage&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def get_tree_key_for_storage_slot(address: Address32, storage_key: int):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if storage_key &amp;lt; (CODE_OFFSET - HEADER_STORAGE_OFFSET):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos = HEADER_STORAGE_OFFSET + storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos = MAIN_STORAGE_OFFSET + storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return get_tree_key(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos &#x2F;&#x2F; VERKLE_NODE_WIDTH,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos % VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that storage slots in the same size &lt;code&gt;VERKLE_NODE_WIDTH&lt;&#x2F;code&gt; range (ie. a range the form &lt;code&gt;x*VERKLE_NODE_WIDTH ... (x+1)*VERKLE_NODE_WIDTH-1)&lt;&#x2F;code&gt; are all, with the exception of the &lt;code&gt;HEADER_STORAGE_OFFSET&lt;&#x2F;code&gt; special case, part of a single commitment. This is an optimization to make witnesses more efficient when related storage slots are accessed together. If desired, this optimization can be exposed to the gas schedule, making it more gas-efficient to make contracts that store related slots together (however, Solidity already stores in this way by default).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fork&quot;&gt;Fork&lt;&#x2F;h4&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;access-events&quot;&gt;Access events&lt;&#x2F;h4&gt;
&lt;p&gt;Described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This implements all of the logic in transitioning to a Verkle tree, and at the same time reforms gas costs, but does so in a minimally disruptive way that does not require simultaneously changing the whole tree structure. Instead, we add a new Verkle tree that starts out empty, and only new changes to state and copies of accessed state are stored in the tree. The Patricia tree continues to exist, but is frozen.&lt;&#x2F;p&gt;
&lt;p&gt;This sets the stage for a future hard fork that swaps the Patricia tree in-place with a Verkle tree storing the same data. Unlike &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2584&#x2F;&quot;&gt;EIP-2584&lt;&#x2F;a&gt;, this replacement Verkle tree does not need to be computed by clients in real time. Instead, because the Patricia tree would at that point be fixed, the replacement Verkle tree can be computed off-chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verkle-tree-design&quot;&gt;Verkle tree design&lt;&#x2F;h3&gt;
&lt;p&gt;The Verkle tree uses a single-layer tree structure with 32-byte keys and values for several reasons:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Simplicity&lt;&#x2F;strong&gt;: working with the abstraction of a key&#x2F;value store makes it easier to write code dealing with the tree (eg. database reading&#x2F;writing, caching, syncing, proof creation and verification) as well as to upgrade it to other trees in the future. Additionally, witness gas rules can become simpler and clearer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Uniformity&lt;&#x2F;strong&gt;: the state is uniformly spread out throughout the tree; even if a single contract has many millions of storage slots, the contract’s storage slots are not concentrated in one place. This is useful for state syncing algorithms. Additionally, it helps reduce the effectiveness of unbalanced tree filling attacks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Extensibility&lt;&#x2F;strong&gt;: account headers and code being in the same structure as storage makes it easier to extend the features of both, and even add new structures if later desired.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-reform&quot;&gt;Gas reform&lt;&#x2F;h3&gt;
&lt;p&gt;Gas costs for reading storage and code are reformed to more closely reflect the gas costs under the new Verkle tree design. WITNESS_CHUNK_COST is set to charge 6.25 gas per byte for chunks, and WITNESS_BRANCH_COST is set to charge ~13,2 gas per byte for branches on average (assuming 144 byte branch length) and ~2.5 gas per byte in the worst case if an attacker fills the tree with keys deliberately computed to maximize proof length.&lt;&#x2F;p&gt;
&lt;p&gt;The main differences from gas costs in Berlin are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;200 gas charged per 31 byte chunk of code. This has been estimated to increase average gas usage by ~6-12%&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing adjacent storage slots (&lt;code&gt;key1 &#x2F;&#x2F; 256 == key2 &#x2F;&#x2F; 256&lt;&#x2F;code&gt;) decreases from 2100 to 200 for all slots after the first in the group,&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing storage slots 0…63 decreases from 2100 to 200, including the first storage slot. This is likely to significantly improve performance of many existing contracts, which use those storage slots for single persistent variables.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Gains from the latter two properties have not yet been analyzed, but are likely to significantly offset the losses from the first property. It’s likely that once compilers adapt to these rules, efficiency will increase further.&lt;&#x2F;p&gt;
&lt;p&gt;The precise specification of when access events take place, which makes up most of the complexity of the gas repricing, is necessary to clearly specify when data needs to be saved to the period 1 tree.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The main backwards-compatibility-breaking changes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(1) Gas costs for code chunk access making some applications less economically viable&lt;&#x2F;li&gt;
&lt;li&gt;(2) Tree structure change makes in-EVM proofs of historical state no longer work&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(1) can be mitigated by increasing the gas limit at the same time as implementing this EIP, reducing the risk that applications will no longer work at all due to transaction gas usage rising above the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;github.com&#x2F;gballet&#x2F;go-ethereum, branch beverly-hills-just-after-pbss - a geth implementation&lt;&#x2F;li&gt;
&lt;li&gt;github.com&#x2F;NethermindEth&#x2F;nethermind, branch verkle&#x2F;tree - a nethermind implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EVM Modular Arithmetic Extensions</title>
        <published>2023-03-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jared Wasinger</name><uri>https://github.com/jwasinger</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Radosław Zagórowicz</name><uri>https://github.com/rodiazet</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6690/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6690-evm-modular-arithmetic-extensions/13322" />
        

        <id>https://wg-eips.ritovision.com/6690/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6690"
            label="EIP-6690" />
        

        
        

        
        <summary type="html">Expanded-width, efficient modular arithmetic operations for the EVM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6690/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes new EVM modular arithmetic opcodes which support operations on odd or power-of-two moduli between 3 and 2**768-1&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current opcodes for modular arithmetic only support values up to 256 bits wide.  In addition, they are permissive and accept any representable value for the inputs.&lt;&#x2F;p&gt;
&lt;p&gt;Many cryptographic operations are heavily-bottlenecked by modular arithmetic.  To expand the range of cryptographic primitives that can be implemented efficiently as EVM contracts, we propose new modular arithmetic opcodes designed for efficiency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COST_SETMODX_BASE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;static cost component for the &lt;code&gt;SETMODX&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COST_STOREX_BASE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;static cost for the &lt;code&gt;STOREX&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COST_LOADX_BASE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;static cost for the &lt;code&gt;LOADX&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;The use of &lt;code&gt;assert&lt;&#x2F;code&gt; implies that if the assertion fails, the current call frame will consume all call gas and terminate call execution in an exceptional state.&lt;&#x2F;li&gt;
&lt;li&gt;Unless otherwise stated, the implied unit for size is bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The execution state of an EVM call frame is modified to include a mapping of &lt;code&gt;id&lt;&#x2F;code&gt; (a number 0-256) to a field context.  A field context comprises a modulus and an allocated space of virtual registers to perform modular arithmetic operations on.&lt;&#x2F;p&gt;
&lt;p&gt;An executing contract uses a new instruction &lt;code&gt;SETMODX&lt;&#x2F;code&gt; to set the active field context, allocating a new one in the mapping if it does not already exist for &lt;code&gt;id&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;New arithmetic opcodes perform modular addition, subtraction and multiplication with inputs&#x2F;outputs from virtual registers of the active field context.&lt;&#x2F;p&gt;
&lt;p&gt;New load&#x2F;store opcodes copy values to and from EVM memory and the virtual registers allocated by the active field context.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-opcodes&quot;&gt;New Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;setmodx-0xc0&quot;&gt;&lt;code&gt;SETMODX(0xc0)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;Input&lt;&#x2F;strong&gt;: &lt;code&gt;&amp;lt;top of stack&amp;gt; id modulus_offset modulus_size alloc_count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Output&lt;&#x2F;strong&gt;: none&lt;&#x2F;p&gt;
&lt;h5 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h5&gt;
&lt;p&gt;Charge &lt;code&gt;COST_SETMODX_BASE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Assert &lt;code&gt;0 &amp;lt;= id &amp;lt;= 256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If a field context for &lt;code&gt;id&lt;&#x2F;code&gt; exists in this call scope:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set it as the active one.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Otherwise:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Assert &lt;code&gt;modulus_size &amp;lt;= 96&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the byte range&lt;code&gt;[modulus_offset, modulus_offset+modulus_size]&lt;&#x2F;code&gt; falls within EVM memory.&lt;&#x2F;li&gt;
&lt;li&gt;Load the byte range from EVM memory, interpreting it as a big endian &lt;code&gt;modulus&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;modulus&lt;&#x2F;code&gt; is odd or is a power of two.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;3 &amp;lt;= modulus &amp;lt;= 2**768 - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;0 &amp;lt; alloc_count &amp;lt;= 256&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Define the size of elements stored in virtual registers: &lt;code&gt;element_size&lt;&#x2F;code&gt; as the size needed to represent the modulus padded to be a multiple of 64 bits.  Implementations will align virtual register values along system-word lines.&lt;&#x2F;li&gt;
&lt;li&gt;assert that the new size of all virtual registers allocated in the current call-context does not exceed 24576 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;Charge EVM memory expansion cost to expand memory by &lt;code&gt;alloc_count * element_size&lt;&#x2F;code&gt; bytes:.&lt;&#x2F;li&gt;
&lt;li&gt;if the modulus is odd, charge the dynamic cost component (defined below)&lt;&#x2F;li&gt;
&lt;li&gt;Allocate the new field context with &lt;code&gt;alloc_count&lt;&#x2F;code&gt; initially-zeroed registers. Associate it with &lt;code&gt;id&lt;&#x2F;code&gt; in the mapping.&lt;&#x2F;li&gt;
&lt;li&gt;The new field context is now set as the active one.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;dynamic-cost-component-for-odd-moduli&quot;&gt;Dynamic Cost Component for Odd Moduli&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Modulus size (padded to nearest 64 bits)&lt;&#x2F;th&gt;&lt;th&gt;cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;64 bits&lt;&#x2F;td&gt;&lt;td&gt;23&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128 bits&lt;&#x2F;td&gt;&lt;td&gt;26&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;192 bits&lt;&#x2F;td&gt;&lt;td&gt;29&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256 bits&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;320 bits&lt;&#x2F;td&gt;&lt;td&gt;36&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;384 bits&lt;&#x2F;td&gt;&lt;td&gt;39&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;448 bits&lt;&#x2F;td&gt;&lt;td&gt;42&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512 bits&lt;&#x2F;td&gt;&lt;td&gt;45&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;576 bits&lt;&#x2F;td&gt;&lt;td&gt;48&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;640 bits&lt;&#x2F;td&gt;&lt;td&gt;51&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;704 bits&lt;&#x2F;td&gt;&lt;td&gt;54&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;768 bits&lt;&#x2F;td&gt;&lt;td&gt;58&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The values in this table are based on the following linear cost model:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def cost_setmodx_dynamic(modulus_size: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limb_count = (modulus_size + 7) &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return round(limb_count * 3.13 + 19.94)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;arithmetic-opcodes&quot;&gt;Arithmetic Opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;Opcodes &lt;code&gt;ADDMODX(0xc3)&lt;&#x2F;code&gt;, &lt;code&gt;SUBMODX(0xc4)&lt;&#x2F;code&gt;, &lt;code&gt;MULMODX(0xc5)&lt;&#x2F;code&gt; take a 7 byte immediate interpreted as byte values &lt;code&gt;out_idx&lt;&#x2F;code&gt;, &lt;code&gt;out_stride&lt;&#x2F;code&gt;, &lt;code&gt;x_idx&lt;&#x2F;code&gt;, &lt;code&gt;x_stride&lt;&#x2F;code&gt;, &lt;code&gt;y_idx&lt;&#x2F;code&gt;, &lt;code&gt;y_stride&lt;&#x2F;code&gt;, &lt;code&gt;count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Define cost tables for each arithmetic operation based on the modulus:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Modulus size (padded to nearest 64 bits)&lt;&#x2F;th&gt;&lt;th&gt;cost per add&#x2F;sub&lt;&#x2F;th&gt;&lt;th&gt;cost per mul&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;64&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;128&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;192&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;256&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;320&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;384&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;448&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;512&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;576&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;640&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;704&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;768&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The values in this table correspond to the following cost models:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def cost_add_or_sub(modulus_size: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limb_count = (modulus_size + 7) &#x2F;&#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return round(limb_count * 0.12 + 0.58)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def cost_mul(modulus_size: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    limb_count = (modulus_size + 7) &#x2F;&#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return round((0.08 * limb_count**2) + (-0.06 * limb_count) + 0.75)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Execution asserts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;all accessed values fall within bounds: &lt;code&gt;max([out_idx + (out_stride * count), x_idx + (x_stride * count), y_idx + (y_stride * count)]) &amp;lt; len(field_context.registers)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;out_stride != 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;count != 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;an active field context &lt;code&gt;active_ctx&lt;&#x2F;code&gt; is set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then, charge &lt;code&gt;count * operation_cost&lt;&#x2F;code&gt; where &lt;code&gt;operation_cost&lt;&#x2F;code&gt; is drawn from the cost table. Compute:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;for i in range(count):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    active_ctx.registers[out_idx+i*out_stride] = operation(active_ctx.registers[x_idx+i*x_stride], active_ctx.registers[y_idx+i*y_stride])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;operation&lt;&#x2F;code&gt; computes modular addition, subtraction or multiplication depending on the opcode.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Inputs&#x2F;outputs can overlap. &lt;code&gt;active_ctx.registers&lt;&#x2F;code&gt; is not modified until all operations in the loop have completed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-transfer-opcodes&quot;&gt;Data Transfer Opcodes&lt;&#x2F;h4&gt;
&lt;p&gt;Note: serialization format for values in EVM memory: big-endian padded to &lt;code&gt;active_ctx.element_size&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;loadx-0xc1&quot;&gt;&lt;code&gt;LOADX(0xc1)&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Stack in&lt;&#x2F;strong&gt;: &lt;code&gt;(top of stack) dest source count&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Stack out&lt;&#x2F;strong&gt;: none&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: copies values from registers in the currently-active field context to EVM memory.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;execution-1&quot;&gt;Execution&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;Assert that a field context is set as active in the current call frame.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the range &lt;code&gt;[source, source + count]&lt;&#x2F;code&gt; falls within the active field context&#x27;s zero-indexed value space.&lt;&#x2F;li&gt;
&lt;li&gt;Assert that the range &lt;code&gt;[dest, dest + count * active_ctx.element_size]&lt;&#x2F;code&gt; falls entirely within EVM memory.&lt;&#x2F;li&gt;
&lt;li&gt;If modulus is a power of two:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;(active_ctxt.element_size + 31) &#x2F;&#x2F; 32 * 3&lt;&#x2F;code&gt; gas (the same as the memory copying component for the &lt;code&gt;MCOPY&lt;&#x2F;code&gt; opcode)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If modulus is odd:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;count * operation_cost&lt;&#x2F;code&gt; gas, where &lt;code&gt;operation_cost&lt;&#x2F;code&gt; is looked up from the multiplication cost table, given &lt;code&gt;active_ctxt.element_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;copy virtual register values &lt;code&gt;[source, source + count]&lt;&#x2F;code&gt; to memory &lt;code&gt;[dest, dest + count * active_ctx.element_size]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;storex-0xc2&quot;&gt;&lt;code&gt;STOREX(0xc2)&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;strong&gt;Stack in&lt;&#x2F;strong&gt;: &lt;code&gt;dest source count&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Stack out&lt;&#x2F;strong&gt;: none&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Description&lt;&#x2F;strong&gt;: copies values from EVM memory into registers of the currently-active field context.&lt;&#x2F;p&gt;
&lt;h6 id=&quot;execution-2&quot;&gt;Execution&lt;&#x2F;h6&gt;
&lt;ul&gt;
&lt;li&gt;Assert that a field context is set as active in the current call frame.&lt;&#x2F;li&gt;
&lt;li&gt;Assert &lt;code&gt;dest + count&lt;&#x2F;code&gt; is less than or equal to the number of the active field context&#x27;s virtual registers.&lt;&#x2F;li&gt;
&lt;li&gt;If modulus of the active context is a power of two:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;cost_mem_copy(count * active_ctx.element_size)&lt;&#x2F;code&gt; (TBD: deliberately didn&#x27;t choose &lt;code&gt;mcopy&lt;&#x2F;code&gt; gas model to see if this can consider a cheaper one).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Else if modulus of the active context is odd:
&lt;ul&gt;
&lt;li&gt;charge &lt;code&gt;count * operation_cost&lt;&#x2F;code&gt; gas, where &lt;code&gt;operation_cost&lt;&#x2F;code&gt; is looked up from the multiplication cost table, given &lt;code&gt;active_ctxt.element_size&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Assert that &lt;code&gt;[source, source + count * active_context.element_size]&lt;&#x2F;code&gt; falls entirely within EVM memory.  Interpret it as &lt;code&gt;count&lt;&#x2F;code&gt; number of values, asserting that each is less than the modulus and storing them in the registers &lt;code&gt;[dest, dest + count]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;evm-memory-expansion-cost-modification&quot;&gt;EVM Memory Expansion Cost Modification&lt;&#x2F;h3&gt;
&lt;p&gt;When expanding EVM memory or allocating a new field context via &lt;code&gt;SETMODX&lt;&#x2F;code&gt;, expansion cost will now consider the size of all allocated virtual registers in the current call frame.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;separation-of-evm-memory-and-evmmax-virtual-register-space&quot;&gt;Separation of EVM Memory and EVMMAX Virtual Register Space&lt;&#x2F;h3&gt;
&lt;p&gt;It is assumed that optimized implementations will not store values in EVM-compatible big-endian serialization format, but instead convert them to an internal working representation.  The costs in the spec explicitly reflect the choice of Montgomery form as an optimal internal representation.&lt;&#x2F;p&gt;
&lt;p&gt;Values represented in Montgomery form can make use of optimized modular reduction for multiplication.  See the dedicated section on Montgomery multiplication in the rationale for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;total-virtual-register-allocation-cap&quot;&gt;Total Virtual Register Allocation Cap&lt;&#x2F;h3&gt;
&lt;p&gt;24576 bytes is chosen as the per-call-context allocation limit with the goal of ensuring that the virtual register space can be contained in the L1 CPU data cache of most machines (with room to spare), in order that arithmetic operation costs do not have to account for memory access latency.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setmodx-cost&quot;&gt;SETMODX cost&lt;&#x2F;h3&gt;
&lt;p&gt;For odd moduli, &lt;code&gt;SETMODX&lt;&#x2F;code&gt; precomputes two values used for optimized modular multiplication via Montgomery reduction.  This is dominated by a modular reduction by the modulus, so the cost model is assumed to be linear.&lt;&#x2F;p&gt;
&lt;p&gt;Power-of-two moduli require no precomputation for optimized modular arithmetic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;loadx-storex-costs&quot;&gt;LOADX&#x2F;STOREX costs&lt;&#x2F;h3&gt;
&lt;p&gt;For power-of-two moduli, &lt;code&gt;LOADX&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;STOREX&lt;&#x2F;code&gt; are assumed to copy values directly between EVM&#x2F;EVMMAX memories without measurable conversion cost to convert between EVM big-endian serialization and whatever internal representation is used.&lt;&#x2F;p&gt;
&lt;p&gt;For odd moduli, the spec assumes that the internal representation is Montgomery form.  Conversion between canonical&#x2F;Montgomery form requires one modular multiplication per value per direction.  The cost of memory copying is baked in to the multiplication price model.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;arithmetic-costs&quot;&gt;Arithmetic Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Addition&#x2F;subtraction&#x2F;multiplication are assumed to have constant-time implementations.  Addition&#x2F;subtraction can be implemented with linear complexity, while multiplication is quadratic in the size of the modulus.&lt;&#x2F;p&gt;
&lt;p&gt;The costs for power-of-two modular multiplication are provisional, and likely be brought down when an optimized arithmetic implementation is rolled out and benchmarked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;montgomery-modular-multiplication&quot;&gt;Montgomery Modular Multiplication&lt;&#x2F;h3&gt;
&lt;p&gt;For a value &lt;code&gt;A&lt;&#x2F;code&gt;, an odd modulus &lt;code&gt;M&lt;&#x2F;code&gt; and a value &lt;code&gt;R&lt;&#x2F;code&gt; (must be coprime and greater than &lt;code&gt;M&lt;&#x2F;code&gt;, chosen as a power of two for efficient performance), the Montgomery representation is &lt;code&gt;A * R % M&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Define the Montgomery modular multiplication of two values &lt;code&gt;A&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt;: &lt;code&gt;mulmont(A, B, M): A * B * R**-1 % M&lt;&#x2F;code&gt; where &lt;code&gt;R**-1 % M&lt;&#x2F;code&gt; is the modular inverse of &lt;code&gt;R&lt;&#x2F;code&gt; with respect to &lt;code&gt;M&lt;&#x2F;code&gt;.  There is various literature and algorithms for computing &lt;code&gt;mulmont&lt;&#x2F;code&gt; which have been published since 1985, and the operation is used ubiquitously where execution is bottlenecked by operations over odd moduli.&lt;&#x2F;p&gt;
&lt;p&gt;Note that normal modular addition and subtraction algorithms work for Montgomery form values.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conversion-of-canonical-to-montgomery-representation&quot;&gt;Conversion of Canonical to Montgomery Representation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;mulmont(canon_val, R**2 % M, M) = mont_val&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;conversion-from-montgomery-to-canonical-representation&quot;&gt;Conversion from Montgomery to Canonical representation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;mulmont(mont_val, 1, M) = canon_val&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Basic Montgomery Multiplication&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   x, y, mod (int) - x &amp;lt; mod and y &amp;lt; mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   mod (int) - an odd modulus&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   R (int) -  a power of two, and greater than mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#   mont_const (int) - pow(-mod, -1, R), precomputed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#  (x * y * pow(R, -1, mod)) % mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def mulmont(x: int, y: int, mod: int, mont_const: int, R: int) -&amp;gt; int:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t = x * y&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    m = ((t % R) * mont_const) % R&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t = t + m * mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    t &#x2F;= R&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if t &amp;gt;= mod:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        t -= mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;There are various optimized algorithms for computing Montgomery Multiplication of bigint numbers expressed as arrays of system words.&lt;&#x2F;p&gt;
&lt;p&gt;These all use a different precomputed constant &lt;code&gt;mont_const = pow(-mod, -1, 2**SYSTEM_WORD_SIZE_BITS)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There are tests contained in the Geth implementation.  However, no cross-client tests exist yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an implementation of this EIP in an open PR to Go Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ transaction signature scheme</title>
        <published>2023-02-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6493/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6493-ssz-transaction-signature-scheme/13050" />
        

        <id>https://wg-eips.ritovision.com/6493/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:6493"
            label="EIP-6493" />
        

        
        

        
        <summary type="html">Signature scheme for native SSZ transactions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6493/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a signature scheme for native &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt; encoded transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; introduces SSZ transactions by converting from RLP transactions. Defining a signature scheme for native SSZ transactions further reduces required conversions and unlocks the forward compatibility benefits of SSZ &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;&lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-signature-scheme&quot;&gt;Transaction signature scheme&lt;&#x2F;h3&gt;
&lt;p&gt;Native SSZ transactions are based on the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; and emit an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6466&#x2F;&quot;&gt;EIP-6466&lt;&#x2F;a&gt; &lt;code&gt;Receipt&lt;&#x2F;code&gt;. To distinguish native SSZ transactions from those converted from RLP, native SSZ transactions do not contain the RLP &lt;code&gt;TransactionType&lt;&#x2F;code&gt; field in their &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All native SSZ transactions follow a scheme based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;&lt;code&gt;hash_tree_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to compute their signing hash (&lt;code&gt;sig_hash&lt;&#x2F;code&gt;). Likewise, native SSZ authorizations use such a scheme to derive their signing hash (&lt;code&gt;auth_hash&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Additional information is mixed into &lt;code&gt;sig_hash&lt;&#x2F;code&gt; and &lt;code&gt;auth_hash&lt;&#x2F;code&gt; to uniquely identify the underlying specification and avoid hash collisions across different signature kinds. Vendor-defined networks MUST use a different &lt;code&gt;DomainType&lt;&#x2F;code&gt; for signing custom transaction or authorization types.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_TX_SSZ&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x01000008&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;DomainType&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; for signing native SSZ transactions compatible with this EIP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOMAIN_AUTH_SSZ&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;DomainType(&#x27;0x02000008&#x27;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;DomainType&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; for signing native SSZ authorizations compatible with this EIP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionSigningData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    object_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    domain_type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; DomainType&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_ssz_sig_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SszTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSigningData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        object_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        domain_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DOMAIN_TX_SSZ&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_ssz_auth_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SszAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSigningData&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        object_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        domain_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;DOMAIN_AUTH_SSZ&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;native-transactions&quot;&gt;Native transactions&lt;&#x2F;h3&gt;
&lt;p&gt;New &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; definitions are introduced to represent native SSZ transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BasicTransactionPayload&lt;&#x2F;code&gt; and &lt;code&gt;CreateTransactionPayload&lt;&#x2F;code&gt; share the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;#specification&quot;&gt;EIP-1559&lt;&#x2F;a&gt; fee market transactions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BlobTransactionPayload&lt;&#x2F;code&gt; shares the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#parameters&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blob transactions&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SetCodeTransactionPayload&lt;&#x2F;code&gt; shares the functionality of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;#parameters&quot;&gt;EIP-7702&lt;&#x2F;a&gt; set code transactions; native SSZ types are introduced for authorizations&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in EIP-6493]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;SetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SszTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    CreateTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BlobTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    SetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SszAuthorizationPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    BasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transaction-helpers&quot;&gt;Transaction helpers&lt;&#x2F;h4&gt;
&lt;p&gt;The helpers from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;&quot;&gt;EIP-6404&lt;&#x2F;a&gt; are updated to support native SSZ transactions.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;04&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;07&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;08&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;09&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [New in EIP-6493]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;11&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; CreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;14&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc&quot;&gt;JSON-RPC&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSZ_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TransactionType(0x1f)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Endpoint specific SSZ object&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Certain JSON-RPC endpoints such as &lt;code&gt;eth_getTransactionByHash&lt;&#x2F;code&gt; indicate the corresponding &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; envelope type prefix in a &lt;code&gt;type&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;When representing native SSZ transactions on such endpoints, &lt;code&gt;SSZ_TX_TYPE&lt;&#x2F;code&gt; SHOULD be indicated as their &lt;code&gt;type&lt;&#x2F;code&gt;. Omitting the &lt;code&gt;type&lt;&#x2F;code&gt; is NOT RECOMMENDED as certain client applications could confuse the omission with untyped &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unique-transaction-identifier&quot;&gt;Unique transaction identifier&lt;&#x2F;h3&gt;
&lt;p&gt;The unique RPC transaction identifier &lt;code&gt;tx_hash&lt;&#x2F;code&gt; for native SSZ transactions is defined to match the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#unique-transaction-identifier&quot;&gt;EIP-6404&lt;&#x2F;a&gt; &lt;code&gt;tx_root&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The SSZ signature scheme reduces hashing overhead and ensures that &lt;code&gt;tx_hash&lt;&#x2F;code&gt; commitments are available on-chain. It also provides a flexible basis for future transaction functionality.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new transaction signature scheme is solely used for native SSZ transactions and is representable using a unique &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; envelope type prefix (&lt;code&gt;SSZ_TX_TYPE&lt;&#x2F;code&gt;) different from existing RLP transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;SSZ signatures MUST NOT collide with RLP transaction and message hashes.&lt;&#x2F;p&gt;
&lt;p&gt;As RLP messages are hashed using keccak256, and all SSZ objects are hashed using SHA256. These two hashing algorithms are both considered cryptographically secure and are based on fundamentally different approaches, minimizing the risk of hash collision between those two hashing algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, RLP messages are hashed linearly across their serialization, while SSZ objects are hashed using a recursive Merkle tree. Having a different mechanism further reduces the risk of hash collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ Optional</title>
        <published>2023-02-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Zahary Karadjov</name><uri>https://github.com/zah</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6475/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6475-ssz-optional/12891" />
        

        <id>https://wg-eips.ritovision.com/6475/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6475"
            label="EIP-6475" />
        

        
        

        
        <summary type="html">New SSZ type to represent optional values</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6475/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;67c2f9ee9eb562f7cc02b2ff90d92c56137944e1&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ) type&lt;&#x2F;a&gt; to represent &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Optional values are currently only representable in SSZ using workarounds. Adding proper support provides these benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Better readability:&lt;&#x2F;strong&gt; SSZ structures with optional values can be represented with idiomatic types of the underlying programming language, e.g., &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; in Python, making them easier to interact with.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Compact serialization:&lt;&#x2F;strong&gt; SSZ serialization can rely on the binary nature of optional values; they either exist or they don&#x27;t. This allows more compact serialization than using alternative approaches based on workarounds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;type-definition&quot;&gt;Type definition&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Optional[T]&lt;&#x2F;code&gt; is defined as a type that can represent:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A value of SSZ type &lt;code&gt;T&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Absence of a value, indicated by &lt;code&gt;None&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;default-value&quot;&gt;Default value&lt;&#x2F;h3&gt;
&lt;p&gt;The default value of &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; is &lt;code&gt;None&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;serialization&quot;&gt;Serialization&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x01&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; serialize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;deserialization&quot;&gt;Deserialization&lt;&#x2F;h3&gt;
&lt;p&gt;The deserialization of an &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; depends on the input length:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the input length is 0, the value is &lt;code&gt;None&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the first byte of the deserialization scope must be checked to be &lt;code&gt;0x01&lt;&#x2F;code&gt;, the remainder of the scope is deserialized same as &lt;code&gt;T&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;merkleization&quot;&gt;Merkleization&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; is merkleized as a &lt;code&gt;List[T, 1]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the value is &lt;code&gt;None&lt;&#x2F;code&gt;, the list length is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, the list length is &lt;code&gt;1&lt;&#x2F;code&gt;, and the first list element contains the underlying value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-union-none-t&quot;&gt;Why not &lt;code&gt;Union[None, T]&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Union[None, T]&lt;&#x2F;code&gt; leaves ambiguity about the intention whether the type may be extended in the future, i.e., &lt;code&gt;Union[None, T, U]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, SSZ Union types are currently not used in any final Ethereum specification and do not have a finalized design themselves. If the only use case is a workaround for lack of &lt;code&gt;Optional[T]&lt;&#x2F;code&gt;, the simpler &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; type is sufficient, and support for general unions could be delayed until really needed. Note that the design of &lt;code&gt;Optional[T]&lt;&#x2F;code&gt; could be used as basis for a more general &lt;code&gt;Union&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-list-t-1&quot;&gt;Why not &lt;code&gt;List[T, 1]&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The serialization is less compact for variable-length &lt;code&gt;T&lt;&#x2F;code&gt;, due to the extra offset table at the beginning of the list to indicate the list length.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;Union[None, T]&lt;&#x2F;code&gt; and &lt;code&gt;List[T, 1]&lt;&#x2F;code&gt; workarounds are not used at this time to represent &lt;code&gt;Optional[T]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6475&#x2F;.&#x2F;assets&#x2F;tests.py&quot;&gt;EIP assets&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Python:&lt;&#x2F;strong&gt; See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6475&#x2F;.&#x2F;assets&#x2F;optional.py&quot;&gt;EIP assets&lt;&#x2F;a&gt;, based on &lt;code&gt;protolambda&#x2F;remerkleable&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Nim:&lt;&#x2F;strong&gt; &lt;code&gt;status-im&#x2F;nim-ssz-serialization&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ withdrawals root</title>
        <published>2023-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6465/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6465-ssz-withdrawals-root/12883" />
        

        <id>https://wg-eips.ritovision.com/6465/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6465"
            label="EIP-6465" />
        

        
        

        
        <summary type="html">Migration of withdrawals MPT commitment to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6465/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of the existing Merkle Patricia Trie (MPT) commitment for withdrawals to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the consensus &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; and the execution block header map to each other conceptually, they are encoded differently. This EIP aims to align the encoding of the &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt;, taking advantage of the more modern SSZ format. This brings several advantages:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reducing complexity:&lt;&#x2F;strong&gt; The proposed design reduces the number of use cases that require support for Merkle Patricia Trie (MPT).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Reducing ambiguity:&lt;&#x2F;strong&gt; The name &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; is currently used to refer to different roots. While the execution block header refers to a Merkle Patricia Trie (MPT) root, the consensus &lt;code&gt;ExecutionPayloadHeader&lt;&#x2F;code&gt; instead refers to an SSZ root. With these changes, &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; consistently refers to the same SSZ root.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-definitions&quot;&gt;Existing definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions from existing specifications that are used throughout this document are replicated here for reference.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ValidatorIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Gwei&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;WithdrawalIndex&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;withdrawals&quot;&gt;Withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;New withdrawals use a normalized SSZ representation. The existing consensus &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#withdrawal&quot;&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; SSZ container is migrated to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7495&#x2F;&quot;&gt;EIP-7495 &lt;code&gt;ProgressiveContainer&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; WithdrawalIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validator_index&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ValidatorIndex&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Gwei&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&#x27;s &lt;code&gt;withdrawals-root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is transitioned from MPT to SSZ.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;When building a consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;withdrawals&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; list is based on the new progressive container type.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Withdrawal&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The state transition function is updated to limit withdrawals to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;capella&#x2F;beacon-chain.md#execution&quot;&gt;&lt;code&gt;MAX_WITHDRAWALS_PER_PAYLOAD&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This change was originally a candidate for inclusion in Shanghai, but was postponed to accelerate the rollout of withdrawals.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that rely on the replaced MPT &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; in the block header require migration to the SSZ &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;RLP and SSZ withdrawals may clash when encoded. It is essential to use only a single format within one channel. The block header corresponding to the withdrawals can be consulted to identify the underlying fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ receipts</title>
        <published>2023-02-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6466/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6466-ssz-receipts/12884" />
        

        <id>https://wg-eips.ritovision.com/6466/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6466"
            label="EIP-6466" />
        

        
        

        
        <summary type="html">Migration of RLP receipts to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6466/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; Recursive-Length Prefix (RLP) receipts to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;RLP receipts have a number of shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Limited proving support:&lt;&#x2F;strong&gt; Due to receipt data being linearly hashed as part of the &lt;code&gt;receipts_root&lt;&#x2F;code&gt; Merkle-Patricia Trie (MPT), it is not possible to efficiently proof individual parts of receipts, such as logs. Requiring the full receipt data to be present can be prohibitive for smart contract based applications such as L2 fraud proofs or client applications verifying log data.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Incomplete data:&lt;&#x2F;strong&gt; JSON-RPC provides &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;gasUsed&lt;&#x2F;code&gt;, and &lt;code&gt;contractAddress&lt;&#x2F;code&gt; fields for receipts, but the on-chain receipt does not contain the required information to verify them.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP defines a universal receipt format based on SSZ to address these concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-definitions&quot;&gt;Existing definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions from existing specifications that are used throughout this document are replicated here for reference.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;GasAmount&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;logs&quot;&gt;Logs&lt;&#x2F;h3&gt;
&lt;p&gt;Logs are represented as an SSZ &lt;code&gt;Container&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_TOPICS_PER_LOG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;LOG0&lt;&#x2F;code&gt; through &lt;code&gt;LOG4&lt;&#x2F;code&gt; opcodes allow 0-4 topics per log&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Log&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    topics&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Bytes32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_TOPICS_PER_LOG&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;New receipts use a normalized SSZ representation.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Receipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicReceipt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; CreateReceipt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; SetCodeReceipt&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;basic-receipts&quot;&gt;Basic receipts&lt;&#x2F;h4&gt;
&lt;p&gt;This receipt is emitted for these transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyReplayableBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpAccessListBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpBasicTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpBlobTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicReceipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;create-receipts&quot;&gt;Create receipts&lt;&#x2F;h4&gt;
&lt;p&gt;This receipt is emitted for these transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyReplayableCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpLegacyCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpAccessListCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpCreateTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CreateReceipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    contract_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-7702-set-code-receipts&quot;&gt;EIP-7702 set code receipts&lt;&#x2F;h4&gt;
&lt;p&gt;This receipt is emitted for these transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6404&#x2F;#normalized-transactions&quot;&gt;&lt;code&gt;RlpSetCodeTransaction&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; SetCodeReceipt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    from_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Log&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; boolean&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    authorities&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;receipt-construction&quot;&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; construction&lt;&#x2F;h3&gt;
&lt;p&gt;Receipts are constructed as follows.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;from&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The transaction sender&#x27;s address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;gas_used&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;How much gas this individual transaction used&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;contract_address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;For transactions deploying a contract, the new contract address. Present only in &lt;code&gt;CreateReceipt&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;logs&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Logs emitted during transaction execution&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;status&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;658&#x2F;&quot;&gt;EIP-658&lt;&#x2F;a&gt; transaction status code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;authorities&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;For transactions with an authorization list, the list of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; &lt;code&gt;authority&lt;&#x2F;code&gt; addresses. Non-successful authorizations are represented with an all-zero address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The &lt;code&gt;logs_bloom&lt;&#x2F;code&gt;, intermediate state &lt;code&gt;root&lt;&#x2F;code&gt; (Homestead scheme), and &lt;code&gt;cumulative_gas_used&lt;&#x2F;code&gt; (pre &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8116&#x2F;&quot;&gt;EIP-8116&lt;&#x2F;a&gt;) fields are not present in SSZ receipts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&#x27;s &lt;code&gt;receipts-root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is transitioned from MPT to SSZ.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;receipts&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Receipt&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipt_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receipt_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; receipt_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; receipts&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;json-rpc-api&quot;&gt;JSON-RPC API&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction receipt objects in the context of the JSON-RPC API are extended to include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;authorities&lt;&#x2F;code&gt;: &lt;code&gt;Array of DATA|null&lt;&#x2F;code&gt; - Array of &lt;code&gt;DATA&lt;&#x2F;code&gt; entries each containing 20 Bytes, corresponding to the receipt&#x27;s &lt;code&gt;authorities&lt;&#x2F;code&gt; field&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;logsBloom&lt;&#x2F;code&gt; field is no longer returned for new receipts. It continues to be returned for historical receipts conforming to earlier schemes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;gasUsed&lt;&#x2F;code&gt;, and &lt;code&gt;contractAddress&lt;&#x2F;code&gt; are already provided via JSON-RPC and are left unchanged. For &lt;code&gt;BasicReceipt&lt;&#x2F;code&gt; and &lt;code&gt;SetCodeReceipt&lt;&#x2F;code&gt;, &lt;code&gt;contractAddress&lt;&#x2F;code&gt; will be &lt;code&gt;null&lt;&#x2F;code&gt; as these receipt types do not contain the &lt;code&gt;contract_address&lt;&#x2F;code&gt; field. &lt;code&gt;logIndex&lt;&#x2F;code&gt; indicates the log index position in the individual receipt (rather than the entire block), as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8116&#x2F;&quot;&gt;EIP-8116&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;When building a consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;receipts_root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is now based on the &lt;code&gt;Receipt&lt;&#x2F;code&gt; type, changing the type of &lt;code&gt;receipts_root&lt;&#x2F;code&gt; from an MPT &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Hash32&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; to an SSZ &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b3e83f6691c61e5b35136000146015653b22ed38&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayloadHeader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;payload_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts_root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;forward-compatibility&quot;&gt;Forward compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;All receipts share the same Merkle tree shape with a stable &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;merkle-proofs.md#generalized-merkle-tree-index&quot;&gt;generalized index (gindex)&lt;&#x2F;a&gt; assigned to each field. Future transaction features can introduce additional receipt fields or drop existing fields without breaking verifiers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier-improvements&quot;&gt;Verifier improvements&lt;&#x2F;h3&gt;
&lt;p&gt;Committing to &lt;code&gt;from&lt;&#x2F;code&gt;, &lt;code&gt;contract_address&lt;&#x2F;code&gt; and &lt;code&gt;authorities&lt;&#x2F;code&gt; in the receipt allows efficient verification without the expensive &lt;code&gt;ecrecover&lt;&#x2F;code&gt; mechanism. This allows future EIPs to change how these addresses are computed without breaking verifiers, e.g., when future signature schemes are introduced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-client-improvements&quot;&gt;Execution client improvements&lt;&#x2F;h3&gt;
&lt;p&gt;Execution Layer implementations no longer need access to the transaction and additional indices when serving receipts based on SSZ.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that rely on the replaced MPT &lt;code&gt;receipts_root&lt;&#x2F;code&gt; in the block header require migration to the SSZ &lt;code&gt;receipts_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;RLP and SSZ receipts may clash when encoded. It is essential to use only a single format within one channel. When requesting receipts by hash over the network, the block header corresponding to the containing receipts root can be consulted to identify the underlying fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SSZ transactions</title>
        <published>2023-01-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Etan Kissling</name><uri>https://github.com/etan-status</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6404/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6404-ssz-transactions/12783" />
        

        <id>https://wg-eips.ritovision.com/6404/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:6404"
            label="EIP-6404" />
        

        
        

        
        <summary type="html">Migration of RLP transactions to SSZ</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6404/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a migration process of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; Recursive-Length Prefix (RLP) transactions to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;ssz&#x2F;simple-serialize.md&quot;&gt;Simple Serialize (SSZ)&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;RLP transactions have a number of shortcomings:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Linear hashing:&lt;&#x2F;strong&gt; The signing hash (&lt;code&gt;sig_hash&lt;&#x2F;code&gt;) and unique identifier (&lt;code&gt;tx_hash&lt;&#x2F;code&gt;) of an RLP transaction are computed by linear keccak256 hashes across its serialization. Even if only partial data is of interest, linear hashes require the full transaction data to be present, including potentially large calldata or access lists. This also applies when computing the &lt;code&gt;from&lt;&#x2F;code&gt; address of a transaction based on the &lt;code&gt;sig_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inefficient inclusion proofs:&lt;&#x2F;strong&gt; The Merkle-Patricia Trie (MPT) backing the execution block header&#x27;s &lt;code&gt;transactions_root&lt;&#x2F;code&gt; is constructed from the serialized transactions, internally prepending a prefix to the transaction data before it is keccak256 hashed into the MPT. Due to this prefix, there is no on-chain commitment to the &lt;code&gt;tx_hash&lt;&#x2F;code&gt; and inclusion proofs require the full transaction data to be present.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Incompatible representation:&lt;&#x2F;strong&gt; As part of the consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the RLP serialization of transactions is hashed using SSZ merkleization. These SSZ hashes are incompatible with both the &lt;code&gt;tx_hash&lt;&#x2F;code&gt; and the MPT &lt;code&gt;transactions_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Technical debt:&lt;&#x2F;strong&gt; All client applications and smart contracts handling RLP transactions have to correctly deal with caveats such as &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt; lacking a prefix byte, the inconsistent &lt;code&gt;chain_id&lt;&#x2F;code&gt; and &lt;code&gt;v&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;y_parity&lt;&#x2F;code&gt; semantics, and the introduction of &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt; between other fields instead of at the end. As existing transaction types tend to remain valid perpetually, this technical debt builds up over time.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Inappropriate opaqueness:&lt;&#x2F;strong&gt; The Consensus Layer treats RLP transaction data as opaque, but requires validation of consensus &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; against transaction &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt;, resulting in a more complex than necessary engine API.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP addresses these by defining a lossless conversion mechanism to normalize transaction representation across both Consensus Layer and Execution Layer while retaining support for processing RLP transaction types.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;existing-definitions&quot;&gt;Existing definitions&lt;&#x2F;h3&gt;
&lt;p&gt;Definitions from existing specifications that are used throughout this document are replicated here for reference.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#constants&quot;&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(32)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#blob&quot;&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64(4096)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;phase0&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;Hash32&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;bellatrix&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;ExecutionAddress&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#custom-types&quot;&gt;&lt;code&gt;VersionedHash&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;KZGProof&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#custom-types&quot;&gt;&lt;code&gt;Blob&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ByteVector[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;signatures&quot;&gt;Signatures&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction signatures are represented by their native, opaque representation, prefixed by a value indicating their algorithm.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ExecutionSignature&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ProgressiveByteList&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ExecutionSignatureAlgorithm&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;secp256k1&quot;&gt;Secp256k1&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SECP256K1_ALGORITHM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8(0xFF)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Defined from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;verification&quot;&gt;Verification&lt;&#x2F;h4&gt;
&lt;p&gt;The following functions are imported from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7932&#x2F;&quot;&gt;EIP-7932&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;calculate_penalty&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;validate_signature&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;verify_signature&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;pubkey_to_address&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_signature_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    sig_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_algorithm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSignatureAlgorithm&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; calculate_penalty&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_execution_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;    expected_algorithm&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Optional&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;ExecutionSignatureAlgorithm&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;None&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; recover_execution_signer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; sig_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    public_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; verify_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sig_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey_to_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;public_key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-fees&quot;&gt;Gas fees&lt;&#x2F;h3&gt;
&lt;p&gt;The different kinds of gas fees are combined into a single structure.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FeePerGas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Fee per unit of gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    regular&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FeePerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    regular&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FeePerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; FeePerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;normalized-transactions&quot;&gt;Normalized transactions&lt;&#x2F;h3&gt;
&lt;p&gt;RLP transactions are converted to a normalized SSZ representation. Their original RLP &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is retained to enable recovery of their original RLP representation and associated &lt;code&gt;sig_hash&lt;&#x2F;code&gt; and historical &lt;code&gt;tx_hash&lt;&#x2F;code&gt; values.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;SSZ equivalent&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, range &lt;code&gt;[0x00, 0x7F]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ChainId&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain ID&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GasAmount&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Amount in units of gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;replayable-legacy-transactions&quot;&gt;Replayable legacy transactions&lt;&#x2F;h4&gt;
&lt;p&gt;The original RLP representation of these transactions is replayable across networks with different chain ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-155-legacy-transactions&quot;&gt;EIP-155 legacy transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions are locked to a single &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; chain ID.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;legacy-transactions&quot;&gt;Legacy transactions&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RlpLegacyTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-2930-access-list-transactions&quot;&gt;EIP-2930 access list transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; access list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage_keys&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Hash32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RlpAccessListTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-1559-fee-market-transactions&quot;&gt;EIP-1559 fee market transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; priority fees.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RlpFeeMarketTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-4844-blob-transactions&quot;&gt;EIP-4844 blob transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt; blobs.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BlobFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;eip-7702-set-code-transactions&quot;&gt;EIP-7702 set code transactions&lt;&#x2F;h4&gt;
&lt;p&gt;These transactions support specifying an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; authorization list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpSetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpReplayableBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicAuthorizationPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpSetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeAuthorizationPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity&quot;&gt;    ProgressiveContainer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;active_fields&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionType&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0x04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ChainId&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; GasAmount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionAddress&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; uint256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    input_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveByteList&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;AccessTuple&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_priority_fees_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; BasicFeesPerGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;RlpSetCodeAuthorization&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;transaction-helpers&quot;&gt;Transaction helpers&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;CompatibleUnion&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyReplayableCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;04&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;06&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;07&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBasicTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;08&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpCreateTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;09&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0a&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;Container&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; TransactionPayload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ExecutionSignature&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity&quot;&gt;IntEnum&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    LEGACY&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ACCESS_LIST&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    FEE_MARKET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SET_CODE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    SET_CODE_MAGIC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;05&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calculate_transaction_intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; uint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; FIXME&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: Should this be defined from another EIP?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;authorization_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_signature_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_signature_gas_cost&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gas_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;type_&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SECP256K1_ALGORITHM&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        match&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;type_&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;LEGACY&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpLegacyTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ACCESS_LIST&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpAccessListTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FEE_MARKET&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpFeeMarketTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOB&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpBlobTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_CODE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; RlpSetCodeTransactionPayload&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            case&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;authorization_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;authorization_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            auth_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;magic&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; auth_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;magic&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; RlpTxType&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SET_CODE_MAGIC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hasattr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; auth_data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validate_execution_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_auth_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;auth&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_execution_signature&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signature&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; compute_sig_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; expected_algorithm&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;expected_signature_algorithm&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution-block-header-changes&quot;&gt;Execution block header changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md#block-encoding-and-validity&quot;&gt;execution block header&#x27;s &lt;code&gt;txs-root&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; is transitioned from MPT to SSZ.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    tx_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;block_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;engine-api&quot;&gt;Engine API&lt;&#x2F;h3&gt;
&lt;p&gt;In the engine API, the semantics of the &lt;code&gt;transactions&lt;&#x2F;code&gt; field in &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; versions adopting this EIP are changed to emit transactions using SSZ serialization.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;transactions&lt;&#x2F;code&gt; - &lt;code&gt;Array&lt;&#x2F;code&gt; of &lt;code&gt;DATA&lt;&#x2F;code&gt; - Array of transaction objects, each object is a byte list (&lt;code&gt;DATA&lt;&#x2F;code&gt;) representing &lt;code&gt;ssz.serialize(tx)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;consensus-executionpayload-changes&quot;&gt;Consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt; changes&lt;&#x2F;h3&gt;
&lt;p&gt;When building a consensus &lt;code&gt;ExecutionPayload&lt;&#x2F;code&gt;, the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;b5c3b619887c7850a8c1d3540b471092be73ad84&#x2F;specs&#x2F;deneb&#x2F;beacon-chain.md#executionpayload&quot;&gt;&lt;code&gt;transactions&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; list is no longer opaque and uses the new &lt;code&gt;Transaction&lt;&#x2F;code&gt; type, aligning the &lt;code&gt;transactions_root&lt;&#x2F;code&gt; across execution blocks and execution payloads.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ExecutionPayload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; ProgressiveList&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;unique-transaction-identifier&quot;&gt;Unique transaction identifier&lt;&#x2F;h3&gt;
&lt;p&gt;For each transaction, an additional identifier &lt;code&gt;tx_root&lt;&#x2F;code&gt; SHALL be assigned:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_tx_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Hash32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash_tree_root&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that this &lt;code&gt;tx_root&lt;&#x2F;code&gt; differs from the existing &lt;code&gt;tx_hash&lt;&#x2F;code&gt;. Existing APIs based on &lt;code&gt;tx_hash&lt;&#x2F;code&gt; remain available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;forward-compatibility&quot;&gt;Forward compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed transaction design is extensible with new fee types, new signature types, and entirely new transaction features (e.g., CREATE2), while retaining compatibility with the proposed transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;verifier-improvements&quot;&gt;Verifier improvements&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;transactions_root&lt;&#x2F;code&gt; is effectively constructed from the list of &lt;code&gt;tx_root&lt;&#x2F;code&gt;, enabling transaction inclusion proofs. Further, partial data becomes provable, such as destination &#x2F; amount without requiring the full calldata. This can reduce gas cost or zk proving cost when verifying L2 chain data in an L1 smart contract.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-client-improvements&quot;&gt;Consensus client improvements&lt;&#x2F;h3&gt;
&lt;p&gt;Consensus Layer implementations may drop invalid blocks early if consensus &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; do not validate against transaction &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; and no longer need to query the Execution Layer for that validation. Future versions of the engine API could be simplified to drop the transfers of &lt;code&gt;blob_kzg_commitments&lt;&#x2F;code&gt; to the EL.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Applications that rely on the replaced MPT &lt;code&gt;transactions_root&lt;&#x2F;code&gt; in the block header require migration to the SSZ &lt;code&gt;transactions_root&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;While there is no on-chain commitment of the &lt;code&gt;tx_hash&lt;&#x2F;code&gt;, it is widely used in JSON-RPC and the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;devp2p&#x2F;blob&#x2F;bc76b9809a30e6dc5c8dcda996273f0f9bcf7108&#x2F;caps&#x2F;eth.md&quot;&gt;Ethereum Wire Protocol&lt;&#x2F;a&gt; to uniquely identify transactions. The conversion from RLP transactions to SSZ is lossless. The original RLP &lt;code&gt;sig_hash&lt;&#x2F;code&gt; and &lt;code&gt;tx_hash&lt;&#x2F;code&gt; can be recovered from the SSZ representation.&lt;&#x2F;p&gt;
&lt;p&gt;RLP and SSZ transactions may clash when encoded. It is essential to use only a single format within one channel.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - JUMPF and non-returning functions</title>
        <published>2022-12-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6206/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4750-eof-functions/8195" />
        

        <id>https://wg-eips.ritovision.com/6206/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6206"
            label="EIP-6206" />
        

        
        

        
        <summary type="html">Introduces instruction for chaining function calls.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6206/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP allows for tail call optimizations in EOF functions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt;) by introducing a new instruction &lt;code&gt;JUMPF&lt;&#x2F;code&gt;, which jumps to a code section without adding a new return stack frame.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally the format of the type sections is extended to allow declaring sections as non-returning, with simplified stack validation for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to such section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is common for functions to make a call at the end of the routine only to then return. &lt;code&gt;JUMPF&lt;&#x2F;code&gt; optimizes this behavior by changing code sections without needing to update the return stack.&lt;&#x2F;p&gt;
&lt;p&gt;Knowing at validation time that a function will never return control allows for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to such function to be treated similar to terminating instructions, where extra items may be left on the operand stack at execution termination. This provides opportunities for compilers to generate more optimal code, both in code size and in spent gas. It is particularly beneficial for small error handling helpers, that end execution with &lt;code&gt;REVERT&lt;&#x2F;code&gt;: they are commonly reused in multiple branches and extracting them into a helper function is efficient, when there is no need to pop extra stack items before &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to such helper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;type-section-changes&quot;&gt;Type section changes&lt;&#x2F;h3&gt;
&lt;p&gt;We define a non-returning section as one that cannot return control to its caller section.&lt;&#x2F;p&gt;
&lt;p&gt;Type section &lt;code&gt;outputs&lt;&#x2F;code&gt; field contains a special value &lt;code&gt;0x80&lt;&#x2F;code&gt; when corresponding code section is non-returning. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6206&#x2F;#non-returning-status-validation&quot;&gt;Non-returning status validation&lt;&#x2F;a&gt; below for validation details.&lt;&#x2F;p&gt;
&lt;p&gt;The first code section MUST have 0 inputs and be non-returning.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-semantics&quot;&gt;Execution Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;A new instruction, &lt;code&gt;JUMPF (0xe5)&lt;&#x2F;code&gt;, is introduced.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; has one immediate argument, &lt;code&gt;target_section_index&lt;&#x2F;code&gt;, encoded as a 16-bit unsigned big-endian value.&lt;&#x2F;li&gt;
&lt;li&gt;If the operand stack size exceeds &lt;code&gt;1024 - type[target_section_index].max_stack_increase&lt;&#x2F;code&gt; (i.e. if the called function may exceed the global stack height limit), execution results in an exceptional halt. This guarantees that the target function does not exceed global stack height limit.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; sets &lt;code&gt;current_section_index&lt;&#x2F;code&gt; to &lt;code&gt;target_section_index&lt;&#x2F;code&gt; and &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;0&lt;&#x2F;code&gt;, but does not change the return stack. Execution continues in the target section.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; costs 5 gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; neither pops nor pushes anything to the operand stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction results in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Let the definition of &lt;code&gt;type[i]&lt;&#x2F;code&gt; be inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt; and define &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; and &lt;code&gt;stack_height_max&lt;&#x2F;code&gt; to be the stack height bounds at a certain instruction during the instruction flow traversal.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The immediate argument of &lt;code&gt;JUMPF&lt;&#x2F;code&gt; MUST be less than the total number of code sections.&lt;&#x2F;li&gt;
&lt;li&gt;For each &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction:
&lt;ul&gt;
&lt;li&gt;either &lt;code&gt;type[current_section_index].outputs&lt;&#x2F;code&gt; MUST be greater or equal &lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;or &lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; MUST be &lt;code&gt;0x80&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The stack height validation at &lt;code&gt;JUMPF&lt;&#x2F;code&gt; depends on whether the target section is non-returning:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; into returning section (&lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; does not equal &lt;code&gt;0x80&lt;&#x2F;code&gt;):  &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; and &lt;code&gt;stack_height_max&lt;&#x2F;code&gt; MUST be equal to &lt;code&gt;type[current_section_index].outputs - type[target_section_index].outputs + type[target_section_index].inputs&lt;&#x2F;code&gt;. This means that target section can output less stack elements than the original code section called by the top element on the return stack, if the current code section leaves the delta &lt;code&gt;type[current_section_index].outputs - type[target_section_index].outputs&lt;&#x2F;code&gt; element(s) on the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; into non-returning section (&lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; equals &lt;code&gt;0x80&lt;&#x2F;code&gt;): &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; MUST be greater than or equal to &lt;code&gt;type[target_section_index].inputs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Stack overflow check at &lt;code&gt;JUMPF&lt;&#x2F;code&gt;: &lt;code&gt;stack_height_max&lt;&#x2F;code&gt; MUST be less than or equal to &lt;code&gt;1024 - types[target_section_index].max_stack_increase&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;JUMPF&lt;&#x2F;code&gt; is considered terminating instruction, i.e. does not have successor instructions in code validation and MAY be final instruction in the section.&lt;&#x2F;li&gt;
&lt;li&gt;The code validation defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; also fails if any &lt;code&gt;RJUMP*&lt;&#x2F;code&gt; offset points to one of the two bytes directly following a &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt; instruction validation is extended to include the rule:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Code section is invalid in case an immediate argument &lt;code&gt;target_section_index&lt;&#x2F;code&gt; of any &lt;code&gt;CALLF&lt;&#x2F;code&gt; targets a non-returning section, i.e. &lt;code&gt;type[target_section_index].outputs&lt;&#x2F;code&gt; equals &lt;code&gt;0x80&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;non-returning-status-validation&quot;&gt;Non-returning status validation&lt;&#x2F;h4&gt;
&lt;p&gt;Section type MUST be non-returning if and only if the section contains no &lt;code&gt;RETF&lt;&#x2F;code&gt; instructions and no &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instructions targeting returning sections (target section&#x27;s status is checked via its output value in type section.)
&lt;em&gt;Note: This implies that section containing only &lt;code&gt;JUMPF&lt;&#x2F;code&gt;s into non-returning sections is non-returning itself.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;allowing-jumpf-to-section-with-less-outputs&quot;&gt;Allowing &lt;code&gt;JUMPF&lt;&#x2F;code&gt; to section with less outputs&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative rule for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; stack validation could require the target section&#x27;s outputs to be exactly equal to the current section&#x27;s outputs. Under such rule, a particular target section (a shared &quot;helper&quot; piece of code) would only &quot;match&quot; sections (requiring some shared &quot;helper&quot; code to execute before returning) &lt;em&gt;with the same number of outputs&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, we allow a given &lt;code&gt;JUMPF&lt;&#x2F;code&gt; target section to be called from sections with more outputs, as long as these sections provide these extra stack elements (the &quot;delta&quot;) themselves. This will reduce duplicated code as it will allow compilers more flexibility during code generation such that certain helpers can be used generically by functions, regardless of their output values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is backward compatible as EOF does not allow undefined instructions to be used or deployed, meaning no contracts will be affected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This new instruction needs to be carefully considered during implementation of the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Nonce Cap</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6188/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6190-functional-selfdestruct/12232" />
        

        <id>https://wg-eips.ritovision.com/6188/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:6188"
            label="EIP-6188" />
        

        
        

        
        <summary type="html">Caps the nonce at 2^64-2</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6188/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP caps the nonce at &lt;code&gt;2^64-2&lt;&#x2F;code&gt;, reserving it for contracts with unusual behavior, as defined in other EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not terribly useful on its own, as it adds additional computation without any useful side effects. However, it can be used by other EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eoa-transactions&quot;&gt;EOA Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;The nonce of a transaction originating from an EOA MUST be less than &lt;code&gt;2^64-2&lt;&#x2F;code&gt;. If the nonce is either &lt;code&gt;2^64-1&lt;&#x2F;code&gt; or &lt;code&gt;2^64-2&lt;&#x2F;code&gt;, the transaction MUST be invalid.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;create-and-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If a nonce would be incremented to &lt;code&gt;2^64-1&lt;&#x2F;code&gt; by &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, it is instead set to &lt;code&gt;2^64-2&lt;&#x2F;code&gt;. &lt;code&gt;2^64-1&lt;&#x2F;code&gt; is reserved for alias or other special contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Capping a nonce allows for contracts with special properties to be created, with their functionality based on their contract code. As such, only one nonce needs to be reserved.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules. The further restriction of nonce should not have an effect on accounts, as reaching a nonce of &lt;code&gt;2^64-2&lt;&#x2F;code&gt; is difficult.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As it is not feasible for contract accounts to get to the nonce limit, any potential problems with opcodes that depend on the value of an account&#x27;s nonce can be safely ignored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Alias Contracts</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6189/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6190-functional-selfdestruct/12232" />
        

        <id>https://wg-eips.ritovision.com/6189/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6189"
            label="EIP-6189" />
        

        
        

        
        <summary type="html">Allows the creation of contracts that forward calls to other contracts</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6189/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP allows contracts to be turned into &quot;alias contracts&quot; using a magic nonce. Alias contracts automatically forward calls to other contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not terribly useful on its own, as it adds additional computation and gas costs without any useful side effects. However, in conjunction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6190&#x2F;&quot;&gt;EIP-6190&lt;&#x2F;a&gt;, it can be used to make SELFDESTRUCT compatible with Verkle trees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;A contract is an alias contract if its nonce is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, and its contract code is equal to &lt;code&gt;0x1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt; MUST be used to protect the magic nonce value of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-changes&quot;&gt;Opcode Changes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;call-callcode-delegatecall-staticcall-pay-and-eoa-transactions&quot;&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;PAY&lt;&#x2F;code&gt;, and EOA Transactions&lt;&#x2F;h4&gt;
&lt;p&gt;The &quot;callee&quot; refers to the account that is being called or being paid.&lt;&#x2F;p&gt;
&lt;p&gt;If the nonce of the callee is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, the call MUST be forwarded to the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the callee (as if the callee was the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the callee). This MUST repeat until a non-alias contract is reached. The &lt;code&gt;CALLER&lt;&#x2F;code&gt; MUST remain unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original callee and all subsequent callees (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract. Then, the call MUST be forwarded as usual. &lt;strong&gt;This MUST occur, even in a read-only context like &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For example, if &lt;code&gt;A&lt;&#x2F;code&gt; is an alias contract that forwards calls to &lt;code&gt;B&lt;&#x2F;code&gt;, which is an alias contract that forwards calls to &lt;code&gt;C&lt;&#x2F;code&gt;, then &lt;code&gt;A&lt;&#x2F;code&gt;&#x27;s &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is set to &lt;code&gt;C&lt;&#x2F;code&gt;&#x27;s address. Then, the call is forwarded to &lt;code&gt;C&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the opcode MUST proceed as usual, using the final non-alias contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcodes and EOA Transactions MUST cost an &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, those opcodes MUST also cost an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;If an infinite loop occurs, the transaction MUST run out of gas and revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;extcodehash-extcodecopy-extcodesize-and-balance&quot;&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &quot;accessed account&quot; refers to the account that is being accessed (i.e. the account whose code is being accessed, or the account whose balance is being accessed).&lt;&#x2F;p&gt;
&lt;p&gt;Similar to the &lt;code&gt;CALL&lt;&#x2F;code&gt; family of opcodes, if the nonce of the accessed account is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, the accessed account&#x27;s address MUST be replaced with the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the accessed account. This MUST repeat until a non-alias contract is reached.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original accessed account and all subsequent accessed accounts (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract. Then, the accessed account MUST be replaced as usual. &lt;strong&gt;This MUST occur, even in a read-only context like &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the opcode MUST proceed as usual, using the final non-alias contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, and &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcodes MUST cost an &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, those opcodes MUST also cost an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;If an infinite loop occurs, the transaction MUST run out of gas and revert.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;create-and-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; would create (or fail to create, depending on which EIPs are used) an account at an address, and that account&#x27;s code is &lt;code&gt;0x1&lt;&#x2F;code&gt;, and its nonce is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, then instead of reverting, an attempt MUST be made to create a contract at the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the existing account. This MUST repeat until a non-alias contract is reached.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original accessed account and all subsequent accessed accounts (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, the opcode MUST proceed as usual, returning the address of the newly-created contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcodes MUST cost an &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, those opcodes must also cost an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;If an infinite loop occurs, the transaction runs out of gas and reverts.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;address&quot;&gt;&lt;code&gt;ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This opcode remains unchanged; &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; points to the address that doesn&#x27;t have a nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.33&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transfers-to-the-zero-address&quot;&gt;Transfers to the zero address&lt;&#x2F;h3&gt;
&lt;p&gt;Transfers to the zero address continue to have the same effect as the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode, and will cost extra gas as discussed in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6189&#x2F;#create-and-create2&quot;&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-validity&quot;&gt;Transaction Validity&lt;&#x2F;h3&gt;
&lt;p&gt;The &quot;origin&quot; refers to the account that sent the transaction to be validated.&lt;&#x2F;p&gt;
&lt;p&gt;If the nonce of the origin is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, the origin MUST be updated to the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the current origin (as if the origin was the address stored in the &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot of the current origin). This MUST repeat until a non-alias contract is reached.&lt;&#x2F;p&gt;
&lt;p&gt;If there is more than one alias contract in the chain, the original origin and all subsequent origins (except the last one) MUST have their &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot set to the address of the final non-alias contract. Then, the call MUST be forwarded as usual.&lt;&#x2F;p&gt;
&lt;p&gt;An additional &lt;code&gt;25&lt;&#x2F;code&gt; gas per account accessed in this manner (including the final one, and including if no aliased accounts were used), in addition to all the regular costs incurred by accessing accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;) is added to the validation costs. For every account whose &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is updated, it also costs an additional &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, validation proceeds as normal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rpc-endpoint-changes&quot;&gt;RPC Endpoint Changes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;eth-getstorageat&quot;&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt; RPC endpoint must error if the target contract has a contract code of &lt;code&gt;0x1&lt;&#x2F;code&gt; and a nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The additional gas cost of &lt;code&gt;25&lt;&#x2F;code&gt; represents the cost of fetching the nonce and comparing it to the given value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;eth_getStorageAt&lt;&#x2F;code&gt; was modified to throw an error because of alias contracts&#x27; special behavior.&lt;&#x2F;p&gt;
&lt;p&gt;The nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt; was chosen since it is the nonce protected by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract code of &lt;code&gt;0x1&lt;&#x2F;code&gt; was chosen arbitrarily. A nonzero code was chosen just in case a non-alias contract with nonce &lt;code&gt;2^64-1&lt;&#x2F;code&gt; somehow had its code set to &lt;code&gt;0x0&lt;&#x2F;code&gt;, or an EOA had its nonce set to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules. No existing contracts should be affected, as they will not have a nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;, nor will they have the contract code &lt;code&gt;0x1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The additional gas costs may cause potential DoS attacks if they access an arbitrary contract&#x27;s data or make frequent contract deactivations. Contract authors must be aware and design contracts accordingly. There may be an effect on existing deployed code performing autonomous destruction and revival.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Verkle-compatible SELFDESTRUCT</title>
        <published>2022-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6190/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6190-functional-selfdestruct/12232" />
        

        <id>https://wg-eips.ritovision.com/6190/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6190"
            label="EIP-6190" />
        

        
        

        
        <summary type="html">Changes SELFDESTRUCT to only cause a finite number of state changes</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6190/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Changes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to only cause a finite number of state changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; instruction has a fixed price, but is unbounded in storage&#x2F;account changes (it needs to delete all keys). This has been an outstanding concern for some time.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, with &lt;em&gt;Verkle trees&lt;&#x2F;em&gt; accounts will be organised differently. Account properties, including storage, would have individual keys. It would not be possible to traverse and find all used keys. This makes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; very challenging to support in Verkle trees. This EIP is a step towards supporting &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in Verkle trees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6189&#x2F;&quot;&gt;EIP-6189&lt;&#x2F;a&gt; must be used for this EIP to function correctly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfdestruct-behaviour&quot;&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of destroying the contract at the end of the transaction, instead, the following will occur at the end of the transaction in which it is invoked:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The contract&#x27;s code is set to &lt;code&gt;0x1&lt;&#x2F;code&gt;, and its nonce is set to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is set to the address that would be issued if the contract used the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode (&lt;code&gt;keccak256(contractAddress, nonce)&lt;&#x2F;code&gt;). Note that the nonce is always &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the contract was self-destructed after the call being forwarded by one or more alias contracts, the alias contract&#x27;s &lt;code&gt;0&lt;&#x2F;code&gt;th storage slot is set to the address calculated in step 2.&lt;&#x2F;li&gt;
&lt;li&gt;The contract&#x27;s balance is transferred, in its entirety, to the address on the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;The top of the stack is popped.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gas-cost-of-selfdestruct&quot;&gt;Gas Cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The base gas cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is set to &lt;code&gt;5000&lt;&#x2F;code&gt;. The gas cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is increased by &lt;code&gt;5000&lt;&#x2F;code&gt; for each alias contract that forwarded to the contract being self-destructed. Finally, the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; gas cost increase is applied.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is designed to be a step towards supporting &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in Verkle trees while making the minimum amount of changes.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;5000&lt;&#x2F;code&gt; base gas cost and additional alias contracts represents the cost of setting the account nonce and first storage slot. The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; gas cost increase is preserved for the reasons mentioned in said EIP&#x27;s Rationale.&lt;&#x2F;p&gt;
&lt;p&gt;The nonce of &lt;code&gt;2^64-1&lt;&#x2F;code&gt; was chosen since it is the nonce protected by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6188&#x2F;&quot;&gt;EIP-6188&lt;&#x2F;a&gt;. The account code of &lt;code&gt;0x1&lt;&#x2F;code&gt; was chosen since it was the code specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6189&#x2F;&quot;&gt;EIP-6189&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The address being the same as the one created by &lt;code&gt;CREATE&lt;&#x2F;code&gt; is designed to reduce possible attack vectors by not introducing a new mechanism by which accounts can be created at specific addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Supply validator deposits on chain</title>
        <published>2022-12-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6110/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-6110-supply-validator-deposits-on-chain/12072" />
        

        <id>https://wg-eips.ritovision.com/6110/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:6110"
            label="EIP-6110" />
        

        
        

        
        <summary type="html">Provides validator deposits as a list of deposit operations added to the Execution Layer block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6110/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Appends validator deposits to the Execution Layer block structure. This shifts responsibility of deposit inclusion and validation to the Execution Layer and removes the need for deposit (or &lt;code&gt;eth1data&lt;&#x2F;code&gt;) voting from the Consensus Layer.&lt;&#x2F;p&gt;
&lt;p&gt;Validator deposits list supplied in a block is obtained by parsing deposit contract log events emitted by each deposit transaction included in a given block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Validator deposits are a core component of the proof-of-stake consensus mechanism. This EIP allows for an in-protocol mechanism of deposit processing on the Consensus Layer and eliminates the proposer voting mechanism utilized currently. This proposed mechanism relaxes safety assumptions and reduces complexity of client software design, contributing to the security of the deposits flow. It also improves validator UX.&lt;&#x2F;p&gt;
&lt;p&gt;Advantages of in-protocol deposit processing consist of, but are not limited to, the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Significant increase of deposits security by supplanting proposer voting. With the proposed in-protocol mechanism, an honest online node can&#x27;t be convinced to process fake deposits even when more than 2&#x2F;3 portion of stake is adversarial.&lt;&#x2F;li&gt;
&lt;li&gt;Decrease of delay between submitting deposit transaction on Execution Layer and its processing on Consensus Layer. That is, ~13 minutes with in-protocol deposit processing compared to ~12 hours with the existing mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;Eliminate beacon block proposal dependency on JSON-RPC API data polling that suffers from failures caused by inconsistencies between JSON-RPC API implementations and dependency of API calls processing on the inner state (e.g. syncing) of client software.&lt;&#x2F;li&gt;
&lt;li&gt;Eliminate requirement to maintain and distribute deposit contract snapshots (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4881&#x2F;&quot;&gt;EIP-4881&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Reduction of design and engineering complexity of Consensus Layer client software on a component that has proven to be brittle.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;execution-layer&quot;&gt;Execution Layer&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPOSIT_REQUEST_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;b&#x27;0&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request type byte for deposit operation&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;configuration&quot;&gt;Configuration&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x00000000219ab540356cbb839cbe05303d7705fa&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;code&gt; parameters &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included into client software binary distribution.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- the first block in a blockchain after this EIP has been activated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;deposit-request&quot;&gt;Deposit request&lt;&#x2F;h4&gt;
&lt;p&gt;The structure denoting the new deposit request consists of the following fields:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;pubkey: Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;withdrawal_credentials: Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;amount: uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;signature: Bytes96&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;index: uint64&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Deposits are a type of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7685&#x2F;&quot;&gt;EIP-7685&lt;&#x2F;a&gt; request, with the following encoding:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_type&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_REQUEST_TYPE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;request_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; get_deposit_request_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;receipts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;block-validity&quot;&gt;Block validity&lt;&#x2F;h4&gt;
&lt;p&gt;Beginning with the &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, each deposit accumulated in the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; appear in the EIP-7685 requests list
in the order they appear in the logs. To illustrate:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parse_deposit_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;  Parses deposit data from DepositContract.DepositEvent data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;  &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_valid_deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verifies the layout of the DepositEvent. Returns `False` if the layout is unsupported,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    `True` if the layout is of the expected format.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 576&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 160&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; amount_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 320&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; signature_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 384&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        or&lt;&#x2F;span&gt;&lt;span&gt; index_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 512&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; These sizes are the sizes of the relevant data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pubkey_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;pubkey_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_credentials_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_credentials_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;amount_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;amount_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;signature_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;signature_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;from_bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;index_offset&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;index_offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; byteorder&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;big&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; signed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pubkey_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 48&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; amount_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; signature_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        and&lt;&#x2F;span&gt;&lt;span&gt; index_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; event_data_to_deposit_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parse_deposit_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes48&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawal_credentials&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 8 bytes uint64 LE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Bytes96&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; deposit_data&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 8 bytes uint64 LE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_credentials&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; signature&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_deposit_request_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;receipts&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Retrieve all deposits made in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    deposit_requests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; receipt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; receipts&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; log&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; receipt&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;logs&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;topics&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    assert&lt;&#x2F;span&gt;&lt;span&gt; is_valid_deposit_event_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid deposit log: unsupported data layout&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    deposit_request&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; event_data_to_deposit_request&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;log&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    deposit_requests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_request&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Concatenate list of deposit request data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;join&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;deposit_requests&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;consensus-layer&quot;&gt;Consensus layer&lt;&#x2F;h3&gt;
&lt;p&gt;Consensus layer changes can be summarized into the following list:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ExecutionRequests&lt;&#x2F;code&gt; is extended with a new &lt;code&gt;deposit_requests&lt;&#x2F;code&gt; field to accommodate deposit requests list.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BeaconState&lt;&#x2F;code&gt; is appended with &lt;code&gt;deposit_requests_start_index&lt;&#x2F;code&gt; used to switch from the former deposit mechanism to the new one.&lt;&#x2F;li&gt;
&lt;li&gt;As a part of transition logic a new beacon block validity condition is added to constrain the usage of &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;code&gt;process_deposit_request&lt;&#x2F;code&gt; function is added to the block processing routine to handle &lt;code&gt;deposit_requests&lt;&#x2F;code&gt; processing.&lt;&#x2F;li&gt;
&lt;li&gt;Validator guide provides a logic switching off &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll once transition is completed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Detailed consensus layer specification can be found in following documents:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;eba62dbf00132dfdc97fbfab663a99cb23b9e8f1&#x2F;specs&#x2F;electra&#x2F;beacon-chain.md&quot;&gt;&lt;code&gt;electra&#x2F;beacon-chain.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; -- state transition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;eba62dbf00132dfdc97fbfab663a99cb23b9e8f1&#x2F;specs&#x2F;electra&#x2F;validator.md&quot;&gt;&lt;code&gt;electra&#x2F;validator.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; -- validator guide.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;eba62dbf00132dfdc97fbfab663a99cb23b9e8f1&#x2F;specs&#x2F;electra&#x2F;fork.md&quot;&gt;&lt;code&gt;electra&#x2F;fork.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; -- EIP activation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;validator-index-invariant&quot;&gt;Validator index invariant&lt;&#x2F;h4&gt;
&lt;p&gt;Due to the large follow distance of &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll an index of a new validator assigned during deposit processing remains the same across different branches of a block tree, i.e. with existing mechanism &lt;code&gt;(pubkey, index)&lt;&#x2F;code&gt; cache utilized by consensus layer clients is re-org resilient. The new deposit machinery breaks this invariant and consensus layer clients will have to deal with a fact that a validator index becomes fork dependent, i.e. a validator with the same &lt;code&gt;pubkey&lt;&#x2F;code&gt; can have different indexes in different block tree branches.&lt;&#x2F;p&gt;
&lt;p&gt;Detailed &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;assets&#x2F;pubkey_to_index_cache_analysis&#x2F;&quot;&gt;analysis&lt;&#x2F;a&gt; shows that &lt;code&gt;process_deposit&lt;&#x2F;code&gt; function is &lt;em&gt;the only&lt;&#x2F;em&gt; place requiring a fork dependent &lt;code&gt;(pubkey, index)&lt;&#x2F;code&gt; cache.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eth1data-poll-deprecation&quot;&gt;&lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll deprecation&lt;&#x2F;h4&gt;
&lt;p&gt;Consensus layer clients will be able to remove &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll mechanism in an uncoordinated fashion once transition period is finished. The transition period is considered as finished when a network reaches the point where &lt;code&gt;state.eth1_deposit_index == state.deposit_requests_start_index&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;index-field&quot;&gt;&lt;code&gt;index&lt;&#x2F;code&gt; field&lt;&#x2F;h3&gt;
&lt;p&gt;Deposit &lt;code&gt;index&lt;&#x2F;code&gt; is used to deterministically initialize &lt;code&gt;deposit_requests_start_index&lt;&#x2F;code&gt; in the &lt;code&gt;BeaconState&lt;&#x2F;code&gt;, this prevents same deposit from being applied twice during &lt;code&gt;Eth1Data&lt;&#x2F;code&gt; poll deprecation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;not-limiting-the-size-of-deposit-operations-list&quot;&gt;Not limiting the size of deposit operations list&lt;&#x2F;h3&gt;
&lt;p&gt;The list is unbounded because of negligible data complexity and absence of potential DoS vectors. See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;#security-considerations&quot;&gt;Security Considerations&lt;&#x2F;a&gt; for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;filtering-events-by-deposit-contract-address-and-deposit-event-signature-hash&quot;&gt;Filtering events by &lt;code&gt;DEPOSIT_CONTRACT_ADDRESS&lt;&#x2F;code&gt; and &lt;code&gt;DEPOSIT_EVENT_SIGNATURE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Depending on the design, Deposit smart contract can emit different type of events when deposit is being processed. For instance, Deposit smart contract on Sepolia emits &lt;code&gt;Transfer&lt;&#x2F;code&gt; in addition to &lt;code&gt;DepositEvent&lt;&#x2F;code&gt;. Thus it is important to filter out irrelevant events.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block structure and block validation rule set. But neither of these changes break anything related to user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;data-complexity&quot;&gt;Data complexity&lt;&#x2F;h3&gt;
&lt;p&gt;At the time of the latest update of this document, the total number of submitted deposits is 1,899,120 which is 348MB of deposit data. Assuming frequency of deposit transactions remains the same, historic chain data complexity induced by this EIP can be estimated as 84MB per year which is negligible in comparison to other historical data.&lt;&#x2F;p&gt;
&lt;p&gt;After the beacon chain launch in December 2020, the biggest observed spike in a number of submitted deposits was on June 1, 2023. More than 12,000 deposit transactions were submitted during 24 hours which on average is less than 2 deposit, or 384 bytes of data, per block.&lt;&#x2F;p&gt;
&lt;p&gt;Considering the above, we conclude that data complexity introduced by this proposal is negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dos-vectors&quot;&gt;DoS vectors&lt;&#x2F;h3&gt;
&lt;p&gt;The code in the deposit contract costs 15,650 gas to run in the cheapest case (when all storage slots are hot and only a single leaf has to be modified). Some deposits in a batch deposit are more expensive, but those costs, when amortized over a large number of deposits, are small at around ~1,000 gas per deposit. Under current gas pricing rules an extra 6,900 gas is charged to make a &lt;code&gt;CALL&lt;&#x2F;code&gt; that transfers ETH, this is a case of inefficient gas pricing and may be reduced in the future. For future robustness the beacon chain needs to be able to withstand 1,916 deposits in a 30M gas block (15,650 gas per deposit). The limit under current rules is less than 1,271 deposits in a 30M gas block.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;execution-layer-1&quot;&gt;Execution layer&lt;&#x2F;h4&gt;
&lt;p&gt;With 1 ETH as a minimum deposit amount, the lowest cost of a byte of deposit data is 1 ETH&#x2F;192 ~ 5,208,333 Gwei. This is several orders of magnitude higher than the cost of a byte of transaction&#x27;s calldata, thus adding deposit operations to a block does not increase DoS attack surface of the execution layer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;consensus-layer-1&quot;&gt;Consensus layer&lt;&#x2F;h4&gt;
&lt;p&gt;The most consuming computation of deposit processing is signature verification. Its complexity is bounded by a maximum number of deposits per block which is around 1,271 with 30M gas block at the moment. So, it is ~1,271 signature verifications which is roughly ~1.2 seconds of processing (without optimisations like batched signatures verification). An attacker would need to spend 1,000 ETH to slow down block processing by a second which isn&#x27;t sustainable and viable attack long term.&lt;&#x2F;p&gt;
&lt;p&gt;An optimistically syncing node may be susceptible to a more severe attack scenario. Such a node can&#x27;t validate a list of deposits provided in a payload which makes it possible for attacker to include as many deposits as the limitation allows to. Currently, it is 8,192 deposits (1.5MB of data) with rough processing time of 8s. Considering an attacker would need to sign off on this block with its crypto economically viable signature (which requires building an alternative chain and feeding it to a syncing node), this attack vector is not considered as viable as it can&#x27;t result in a significant slow down of a sync process.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optimistic-sync&quot;&gt;Optimistic sync&lt;&#x2F;h3&gt;
&lt;p&gt;An optimistically syncing node has to rely on the honest majority assumption. That is, if adversary is powerful enough to finalize a deposit sequence, a syncing node will have to apply these deposits disregarding the validity of deposit requests with respect to the execution of a given block. Thus, an adversary that can finalize an invalid chain can also convince an honest node to accept fake deposits. The same is applicable to the validity of execution layer world state today and a new deposit processing design is within boundaries of the existing security model in that regard.&lt;&#x2F;p&gt;
&lt;p&gt;Online nodes can&#x27;t be tricked into this situation because their execution layer validates supplied deposits with respect to the block execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;weak-subjectivity-period&quot;&gt;Weak subjectivity period&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP removes a hard limit on a number of deposits per epoch and makes a block gas limit the only limitation on this number. That is, the limit on deposits per epoch shifts from &lt;code&gt;MAX_DEPOSITS * SLOTS_PER_EPOCH = 512&lt;&#x2F;code&gt; to &lt;code&gt;max_deposits_per_30m_gas_block * SLOTS_PER_EPOCH ~ 32,768&lt;&#x2F;code&gt; at 30M gas block (we consider &lt;code&gt;max_deposits_per_30m_gas_block = 1,024&lt;&#x2F;code&gt; for simplicity).&lt;&#x2F;p&gt;
&lt;p&gt;This change affects a number of top ups per epoch which is one of the inputs to the weak subjectivity period computation. One can top up own validators to instantly increase a portion of stake it owns with respect to those validators that are leaking. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6110&#x2F;assets&#x2F;ws_period_analysis&#x2F;&quot;&gt;The analysis&lt;&#x2F;a&gt; does not demonstrate significant reduction of a weak subjectivity period sizes. Moreover, such an attack is not considered as viable because it requires a decent portion of stake to be burned as one of preliminaries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Replace SELFDESTRUCT with DEACTIVATE</title>
        <published>2022-11-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/6046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/almost-self-destructing-selfdestruct-deactivate/11886" />
        

        <id>https://wg-eips.ritovision.com/6046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:6046"
            label="EIP-6046" />
        

        
        

        
        <summary type="html">Change SELFDESTRUCT to not delete storage keys and use a special value in the account nonce to signal deactivation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/6046/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Change &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to not delete all storage keys, and to use a special value in the account nonce to signal &lt;em&gt;deactivated&lt;&#x2F;em&gt; accounts. Because the semantics of revival change (storage keys may exists), we also rename the instruction to &lt;code&gt;DEACTIVATE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; instruction currently has a fixed price, but is unbounded in terms of how many storage&#x2F;account changes it performs (it needs to delete all keys). This has been an outstanding concern for some time.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, with &lt;em&gt;Verkle trees&lt;&#x2F;em&gt;, accounts will be organised differently: account properties, including storage, will have individual keys. It will not be possible to traverse and find all used keys. This makes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; very challenging to support in Verkle trees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Change the rules introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2681&#x2F;&quot;&gt;EIP-2681&lt;&#x2F;a&gt; such that regular nonce increase is bound by &lt;code&gt;2^64-2&lt;&#x2F;code&gt; instead of &lt;code&gt;2^64-1&lt;&#x2F;code&gt;. This applies from genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The behaviour of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is changed such that:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Does not delete any storage keys and also leave the account in place.&lt;&#x2F;li&gt;
&lt;li&gt;Transfer the account balance to the target &lt;strong&gt;and&lt;&#x2F;strong&gt; set account balance to &lt;code&gt;0.&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set the account nonce to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that no refund is given since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that the rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; regarding &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Modify account execution (triggered both via external transactions or CALL* instructions), such that execution succeeds and returns an empty buffer if the nonce equals &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Note that the account can still receive non-executable value transfers (such as coinbase transactions or other &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;s).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Modify &lt;code&gt;CREATE2&lt;&#x2F;code&gt; such that it allows account creation if the nonce equals &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;Note that the account (especially code and storage) might not be empty prior to &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Note that a successful &lt;code&gt;CREATE2&lt;&#x2F;code&gt; will change the account code, nonce and potentially balance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Rename the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; instruction to &lt;code&gt;DEACTIVATE&lt;&#x2F;code&gt;, because the semantics of &quot;account revival&quot; are changed: the old storage items will remain, and newly deployed code must be aware of this.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There have been various proposals of removing &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and many would just outright remove the deletion capability. This breaks certain usage patterns, which the &lt;em&gt;deactivation&lt;&#x2F;em&gt; option leaves intact, albeit with minor changes. This only affects &lt;em&gt;newly&lt;&#x2F;em&gt; deployed code, and not existing one.&lt;&#x2F;p&gt;
&lt;p&gt;All the proposals would leave data in the state, but this proposal provides the flexibility to reuse or remove storage slots one-by-one should the revived contract choose to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a protocol upgrade, since it modifies consensus rules. The further restriction of nonce should not have an effect on accounts, as &lt;code&gt;2^64-2&lt;&#x2F;code&gt; is an unfeasibly high limit.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts using the revival pattern will still work, but the code deployed during revival may need to be made aware that storage keys can already exist in the account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The new behaviour of preserving storage has a potential effect on security. Contract authors must be aware and design contracts accordingly. There may be an effect on existing deployed code performing autonomous destruction and revival.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add Poseidon hash function precompile</title>
        <published>2022-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	<author>
		<name>Eli Ben Sasson</name><uri>https://github.com/Elistark</uri>
	</author>
	
	<author>
		<name>Avihu Levy</name><uri>https://github.com/avihu28</uri>
	</author>
	
	<author>
		<name>David Levit Gurevich</name><uri>https://github.com/DavidLevitGurevich</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5988/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5988-add-poseidon-hash-function-precompile/11772" />
        

        <id>https://wg-eips.ritovision.com/5988/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5988"
            label="EIP-5988" />
        

        
        

        
        <summary type="html">Add a precompiled contract which implements the hash function used in the Poseidon cryptographic hashing algorithm</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5988/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new precompiled contract which implements the hash function used in the Poseidon cryptographic hashing algorithm, for the purpose of allowing interoperability between the EVM and ZK &#x2F; Validity rollups, as well as introducing more flexible cryptographic hash primitives to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;poseidon_paper.pdf&quot;&gt;Poseidon&lt;&#x2F;a&gt; is an arithmetic hash function that is designed to be efficient for Zero-Knowledge Proof Systems.
Ethereum adopts a rollup centric roadmap and hence must adopt facilities for L2s to be able to communicate with the EVM in an optimal manner.&lt;&#x2F;p&gt;
&lt;p&gt;ZK-Rollups have particular needs for cryptographic hash functions that can allow for efficient verification of proofs.&lt;&#x2F;p&gt;
&lt;p&gt;The Poseidon hash function is a set of permutations over a prime field, which makes it particularly well-suited for the purpose of building efficient ZK &#x2F; Validity rollups on Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;Poseidon is one of the most efficient hashing algorithms that can be used in this context.
Moreover it is compatible with all major proof systems (SNARKs, STARKs, Bulletproofs, etc...).
This makes it a good candidate for a precompile that can be used by many different ZK-Rollups.&lt;&#x2F;p&gt;
&lt;p&gt;An important point to note is that ZK rollups using Poseidon have chosen different sets of parameters, which makes it harder to build a single precompile for all of them.&lt;&#x2F;p&gt;
&lt;p&gt;However, we can still build a generic precompile that supports arbitrary parameters, and allow the ZK rollups to choose the parameters they want to use.&lt;&#x2F;p&gt;
&lt;p&gt;This is the approach that we have taken in this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POSEIDON_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xA&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Here are the Poseidon parameters that the precompile will support:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter name&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;th&gt;Encoding size (in bytes)&lt;&#x2F;th&gt;&lt;th&gt;Comments&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;p&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Prime field modulus&lt;&#x2F;td&gt;&lt;td&gt;32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;security_level&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Security level measured in bits. Denoted &lt;code&gt;M&lt;&#x2F;code&gt; in the Poseidon paper&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;alpha&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Power of S-box&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;input_rate&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Size of input&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;t&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Size of the state&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;full_round&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of full rounds. Denoted as &lt;code&gt;R_F&lt;&#x2F;code&gt; in the Poseidon paper.&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;partial_round&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Number of partial rounds. Denoted as &lt;code&gt;R_P&lt;&#x2F;code&gt; in the Poseidon paper.&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;input&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Input to the hash function&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;input_rate&lt;&#x2F;code&gt; * 32&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The encoding of the precompile input is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[32 bytes for p][2 bytes for security_level][1 byte for alpha][2 bytes for input_rate][1 byte for t][1 byte for full_round][1 byte for partial_round][input_rate * 32 bytes for input]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The precompile should compute the hash function as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;poseidon_paper.pdf&quot;&gt;specified in the Poseidon paper&lt;&#x2F;a&gt; and return hash output.&lt;&#x2F;p&gt;
&lt;!--### Example Usage in Solidity

The precompile can be wrapped easily in Solidity to provide a more development-friendly interface to `poseidon_hash` function.

```solidity
&#x2F;&#x2F; TODO: Add solidity example
```--&gt;
&lt;!--### Gas Costs

```
TODO: Fill gas costs section
```--&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: Add rationale&lt;&#x2F;p&gt;
&lt;p&gt;TODO: Add rationale for gas cost e.g. benchmark and computation cost estimation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is very little risk of breaking backwards-compatibility with this EIP, the sole issue being if someone were to build a contract relying on the address at &lt;code&gt;0xPOSEIDON_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; being empty. The likelihood of this is low, and should specific instances arise, the address could be chosen to be any arbitrary value with negligible risk of collision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The Poseidon reference implementation contains test vectors that can be used to test the precompile.
Those tests are available &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;test&#x2F;poseidon&#x2F;test_vectors.txt&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;!--## Reference Implementation

TODO: Add initial Geth implementation--&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Quoting Vitalik Buterin from &lt;code&gt;Arithmetic hash based alternatives to KZG for proto-danksharding&lt;&#x2F;code&gt; thread on EthResearch:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The Poseidon hash function was officially introduced in 2019. Since then it has seen considerable attempts at cryptanalysis and optimization. However, it is still very young compared to popular “traditional” hash functions (eg. SHA256 and Keccak), and its general approach of accepting a high level of algebraic structure to minimize constraint count is relatively untested.
There are layer-2 systems live on the Ethereum network and other systems that already rely on these hashes for their security, and so far they have seen no bugs for this reason. Use of Poseidon in production is still somewhat “brave” compared to decades-old tried-and-tested hash functions, but this risk should be weighed against the risks of proposed alternatives (eg. pairings with trusted setups) and the risks associated with centralization that might come as a result of dependence on powerful provers that can prove SHA256.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;It is true that arithmetic hash functions are relatively untested compared to traditional hash functions.
However, Poseidon has been thoroughly tested and is considered secure by multiple independent research groups and layers 2 systems are already using it in production (StarkWare, Polygon, Loopring) and also by other projects (e.g. Filecoin).&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, the impact of a potential vulnerability in the Poseidon hash function would be limited to the rollups that use it.&lt;&#x2F;p&gt;
&lt;p&gt;We can see the same rationale for the KZG ceremony in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;, arguing that the risk of a vulnerability in the KZG ceremony is limited to the rollups that use it.&lt;&#x2F;p&gt;
&lt;p&gt;List of projects (non exhaustive) using Poseidon:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;StarkWare plans to use Poseidon as the main hash function for StarkNet, and to add a Poseidon built-in in Cairo.&lt;&#x2F;li&gt;
&lt;li&gt;Filecoin employs POSEIDON for Merkle tree proofs with different arities and for two-value commitments.&lt;&#x2F;li&gt;
&lt;li&gt;Dusk Network uses POSEIDON to build a Zcash-like protocol for securities trading.11 It also uses POSEIDON
for encryption as described above.&lt;&#x2F;li&gt;
&lt;li&gt;Sovrin uses POSEIDON for Merkle-tree based revocation.&lt;&#x2F;li&gt;
&lt;li&gt;Loopring uses POSEIDON for private trading on Ethereum.&lt;&#x2F;li&gt;
&lt;li&gt;Polygon uses Poseidon for Hermez ZK-EVM.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In terms of security, the choice of parameters is important.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-of-the-poseidon-parameters&quot;&gt;Security of the Poseidon parameters&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;choice-of-the-mds-matrix&quot;&gt;Choice of the MDS matrix&lt;&#x2F;h4&gt;
&lt;p&gt;The MDS matrix is a square matrix of size &lt;code&gt;t&lt;&#x2F;code&gt; * &lt;code&gt;t&lt;&#x2F;code&gt; that is used to mix the state.&lt;&#x2F;p&gt;
&lt;p&gt;This matrix is used during the &lt;code&gt;MixLayer&lt;&#x2F;code&gt; phase of the Poseidon hash function.&lt;&#x2F;p&gt;
&lt;p&gt;The matrix must be chosen s.t. no subspace trail with inactive&#x2F;active S-boxes can be set up for more than &lt;code&gt;t -1&lt;&#x2F;code&gt; rounds.&lt;&#x2F;p&gt;
&lt;p&gt;There are some efficient algorithms to detect weak MDS matrices.&lt;&#x2F;p&gt;
&lt;p&gt;Those algorithms are described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;proving_resistance_linear_layer.pdf&quot;&gt;Proving Resistance Against Infinitely Long Subspace Trails: How to Choose the Linear Layer&lt;&#x2F;a&gt; paper.&lt;&#x2F;p&gt;
&lt;p&gt;The process of the generation of the matrix should look like this, as recommended in the Poseidon paper:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Generate a random matrix.&lt;&#x2F;li&gt;
&lt;li&gt;Check if the matrix is secure using Algorithm 1, Algorithm 2, and Algorithm 3 provided &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;proving_resistance_linear_layer.pdf&quot;&gt;Proving Resistance Against Infinitely Long Subspace Trails: How to Choose the Linear Layer&lt;&#x2F;a&gt; paper.&lt;&#x2F;li&gt;
&lt;li&gt;If the matrix is not secure, go back to step 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;papers-and-research-related-to-poseidon-security&quot;&gt;Papers and research related to Poseidon security&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;poseidon_paper.pdf&quot;&gt;Poseidon: A New Hash Function for Zero-Knowledge Proof Systems&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;security_poseidon_non_binary_differential_attacks.pdf&quot;&gt;Security of the Poseidon Hash Function Against Non-Binary Differential and Linear Attacks&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;report_security_stark_friendly_hash.pdf&quot;&gt;Report on the Security of STARK-friendly Hash Functions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5988&#x2F;.&#x2F;assets&#x2F;papers&#x2F;practical_algebraic_attacks.pdf&quot;&gt;Practical Algebraic Attacks against some Arithmetization-oriented Hash Functions&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delegate transaction</title>
        <published>2022-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Hadrien Croubois</name><uri>https://github.com/Amxx</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5806/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5806-delegate-transaction/11409" />
        

        <id>https://wg-eips.ritovision.com/5806/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5806"
            label="EIP-5806" />
        

        
        

        
        <summary type="html">Adds a new transaction type that allows EOAs to execute arbitrary code through delegation</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5806/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new transaction type that allows EOAs to execute arbitrary code using a delegate-call-like mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOA are the most widely used type of account, yet their ability to perform operations is limited to deploying contracts and sending &quot;call&quot; transactions. It is currently not possible for an EOA to execute arbitrary code, which greatly limits the interactions users can have with the blockchain. Account abstraction has been extensively discussed but the path toward mainstream adoption is still unclear. Some approaches, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;ERC-4337&lt;&#x2F;a&gt; hope to improve the usability of smart wallets, without addressing the issue of smart wallet support by applications.&lt;&#x2F;p&gt;
&lt;p&gt;While smart contract wallets have a lot to offer in terms of UX, it is unlikely that all users will migrate any time soon because of the associated cost and the fact that some EOAs have custody of non-transferable assets.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes an approach to allow the execution of arbitrary code by EOAs, with minimal change over the EVM, and using the same security model users are used to. By allowing EOAs to perform delegate calls to a contract (similarly to how contracts can delegate calls to other contracts using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt;), EOAs will be able to have more control over what operations they want to execute. This proposal&#x27;s goal is NOT to provide an account abstraction primitive.&lt;&#x2F;p&gt;
&lt;p&gt;By performing a delegate call to a multicall contract (such as the one deployed to &lt;code&gt;0xcA11bde05977b3631167028862bE2a173976CA11&lt;&#x2F;code&gt;), EOAs would be able to batch multiple transactions into a single one (being the &lt;code&gt;msg.sender&lt;&#x2F;code&gt; of all the sub calls). This would provide a better UX for users that want to interact with protocols (no need for multiple transactions, with variable gas prices and 21k gas overhead) and increase the security of such interactions (by avoiding unsafe token approvals being exploited between an &lt;code&gt;approval&lt;&#x2F;code&gt; and the following &lt;code&gt;transferFrom&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Other unforeseen logic could be implemented in smart contracts and used by EOA. This includes emitting events.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP doesn&#x27;t aim to replace other account abstraction proposals. It hopes to be an easy-to-implement alternative that would significantly improve the user experience of EOA owners in the near future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TX_TYPE&lt;&#x2F;code&gt; = TBD, &amp;gt; 0x03 (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;&quot;&gt;EIP-4844&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;TX_TYPE(TBD)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The definitions of all fields follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;. Note the absence of &lt;code&gt;amount&lt;&#x2F;code&gt; field in this transaction!&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;to&lt;&#x2F;code&gt; field deviates slightly from the semantics with the exception that it MUST NOT be nil and therefore must always represent a 20-byte address. This means that delegate transactions cannot have the form of a create transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, data, access_list]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The execution of this new transaction type is equivalent to the delegate call mechanism introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt;, but performed by an EOA (the transaction sender). This implies that the code present at &lt;code&gt;destination&lt;&#x2F;code&gt;, if any, should be executed in the context of the sender. As a consequence, such a transaction emit an event from the EOA or use &lt;code&gt;Create2&lt;&#x2F;code&gt; with the address of the EOA as the creator. This transaction includes some restrictions though.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-restriction&quot;&gt;Opcode restriction&lt;&#x2F;h3&gt;
&lt;p&gt;For security reasons, some opcodes should not be executed in the context of an EOA:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; (0x55): Setting storage under an EOA breaks many assumptions. In particular storage set through a delegate transaction could cause issues if the accounts later &quot;migrates&quot; using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7377&#x2F;&quot;&gt;EIP-7377&lt;&#x2F;a&gt; or similar. Additionally, storage may be a source of conflicts if a single EOA uses delegate transactions to target codes that interpret the storage layout under this account differently. For all these reasons, EOA should be forbidden from performing &lt;code&gt;SSTORE&lt;&#x2F;code&gt; in the context of a delegate transaction. If a delegate transaction performs a CALL, the target of the call is free to manipulate storage normally.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; (0xF0), &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (0xF5) and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (0xFF): There may be an expectation that transactions from a given sender should have consecutive nonces. This assumption would be broken if an EOA was able to execute one or multiple operations that alter the sender account&#x27;s nonce. Consequently, EOA performing a delegate transaction should not be able to use the &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcodes. If a delegate transaction performs a CALL, the target of the call is free to create contracts normally.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any attempts to make execute one of these restricted operations will instead throw an exception.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EOAs are the most widely used type of wallet.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP would drastically expand the ability of EOAs to interact with smart contracts by using the pre-existing and well-understood delegation mechanism introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt; and without adding new complexity to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues thanks to the transaction envelope (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Due to the inclusion logic and the gas cost being similar to type 2 transactions, it should be possible to include this new transaction type in the same mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The nonce mechanism, already used in other transaction types, prevents replay attacks. Similar to existing transaction types, a delegate transaction can be cancelled by replacing it with a dummy transaction that pays more fees.&lt;&#x2F;p&gt;
&lt;p&gt;Since the object signed by the wallet is a transaction and not a signature that could potentially be processed in many ways (as is the case for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;), the risks associated with the miss-use of the signature are reduced. A wallet could simulate the execution of this delegate transaction and provide good guarantees that the operation that the user signs won&#x27;t be manipulated.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts being called through this mechanism can execute any operation on behalf of the signer. As with other transaction types, signers should be extremely careful when signing a delegate transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>CREATE2COPY Opcode</title>
        <published>2022-08-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5478/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5478-reducing-the-gas-cost-of-contract-creation-with-existing-code/10419" />
        

        <id>https://wg-eips.ritovision.com/5478/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5478"
            label="EIP-5478" />
        

        
        

        
        <summary type="html">Reducing the gas cost of contract creation with existing code</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5478/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adding a new opcode, &lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt;, that is identical to &lt;code&gt;CREATE2&lt;&#x2F;code&gt; but with potentially much lower gas cost by accepting an additional argument &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt; that already stored the code of the new contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP aims to reduce the smart contract creation cost of account abstraction (AA) contracts that have identical code.&lt;&#x2F;p&gt;
&lt;p&gt;The major cost of creating an AA contract is the contract creation cost, especially data gas. For example, creating an AA contract with 10,000 bytes will consume 2,000,000 data gas. Considering the code for each user&#x27;s AA contract is the same, &lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt; can reduce the data gas cost to 2600 (cold account) or even 100 (warm account) if the contract code already exists in the local storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE_DATA_GAS_PER_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, a new opcode is added (&lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt;) at &lt;code&gt;0xf6&lt;&#x2F;code&gt;, which takes 5 stack arguments: &lt;code&gt;endowment&lt;&#x2F;code&gt;, &lt;code&gt;memory_start&lt;&#x2F;code&gt;, &lt;code&gt;memory_length&lt;&#x2F;code&gt;, &lt;code&gt;salt&lt;&#x2F;code&gt;, &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt;. &lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt; behaves identically to &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (&lt;code&gt;0xf5&lt;&#x2F;code&gt; as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt;), except that the code hash of the creating contract MUST be the same as that of &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE2COPY&lt;&#x2F;code&gt; has the same &lt;code&gt;gas&lt;&#x2F;code&gt; schema as &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, but replacing the data gas from &lt;code&gt;CREATE_DATA_GAS_PER_BYTE * CONTRACT_BYTES&lt;&#x2F;code&gt; to the gas cost of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; opcode, which is &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; if the &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt; is first-time accessed in the transaction or &lt;code&gt;WARM_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; if &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt; is already in the access list according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the code of the contract returned from the init code differs from that of &lt;code&gt;existing_contract_address&lt;&#x2F;code&gt;, the creation fails with the error &quot;mismatched contract creation code with existing code&quot;, and will burn all gas for the contract creation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Stack Validation</title>
        <published>2022-08-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5450/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5450-eof-stack-validation/10410" />
        

        <id>https://wg-eips.ritovision.com/5450/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5450"
            label="EIP-5450" />
        

        
        

        
        <summary type="html">Deploy-time validation of stack usage for EOF functions.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5450/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce extended validation of EOF code sections to guarantee that neither stack underflow nor overflow can happen during execution of validated contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current EVM performs a number of validity checks for each executed instruction, such as checking
for instruction being defined, stack overflow and underflow, and enough amount of gas remaining.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP minimizes the number of such checks required at run-time
by verifying that no exceptional conditions can happen
and preventing the execution and deployment of any invalid code.&lt;&#x2F;p&gt;
&lt;p&gt;The operand stack validation provides several benefits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;removes the run-time stack underflow check for all instructions,&lt;&#x2F;li&gt;
&lt;li&gt;removes the run-time stack overflow check for all instructions except &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; (&lt;code&gt;JUMPF&lt;&#x2F;code&gt; introduced in a separate EIP) ,&lt;&#x2F;li&gt;
&lt;li&gt;ensures that execution terminates with one of the terminating instructions,&lt;&#x2F;li&gt;
&lt;li&gt;prevents deployment of code with unreachable instructions, thereby discouraging the use of code sections for data storage.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It also has some disadvantages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;adds constraints to the code structure (similar to JVM, CPython bytecode, WebAssembly, SPIR-V and others); however, these constraints can be lifted in a backward-compatible manner if they are shown to be user-unfriendly,&lt;&#x2F;li&gt;
&lt;li&gt;it is natural to implement stack validation as a second validation pass; however, it is not strictly required and validation&#x27;s computational and space complexity remains linear in any implementation variant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The guarantees created by these validation rules also improve the feasibility of Ahead-Of-Time and Just-In-Time compilation of EVM code. Single pass transpilation passes can be safely executed with the code validation and advanced stack&#x2F;register handling can be applied with the stack height validations. While not as impactful to a Mainnet validator node that is bound mostly by storage state sizes, these can significantly speed up witness validation and other non-Mainnet use cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code validation&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Remark:&lt;&#x2F;em&gt; We rely on the notions of &lt;em&gt;operand stack&lt;&#x2F;em&gt; and &lt;em&gt;type section&lt;&#x2F;em&gt; as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Each code section is validated independently.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;instructions-validation&quot;&gt;Instructions validation&lt;&#x2F;h4&gt;
&lt;p&gt;In the first validation phase defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; (and extended by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4750&#x2F;&quot;&gt;EIP-4750&lt;&#x2F;a&gt;) instructions are inspected independently to check if their opcodes and immediate values are valid.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;operand-stack-validation&quot;&gt;Operand stack validation&lt;&#x2F;h4&gt;
&lt;p&gt;In the second validation phase control-flow analysis is performed on the code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Operand stack height&lt;&#x2F;em&gt; here refers to the number of stack values accessible by this function, i.e. it does not take into account values of caller functions&#x27; frames (but does include this function&#x27;s inputs). Note that validation procedure does not require actual operand stack implementation, but only to keep track of its height.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Terminating instructions&lt;&#x2F;em&gt; refers to the instructions either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ending function execution: &lt;code&gt;RETF&lt;&#x2F;code&gt;, &lt;code&gt;JUMPF&lt;&#x2F;code&gt;, or&lt;&#x2F;li&gt;
&lt;li&gt;ending call frame execution: &lt;code&gt;STOP&lt;&#x2F;code&gt;, &lt;code&gt;RETURN&lt;&#x2F;code&gt;, &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt;, &lt;code&gt;REVERT&lt;&#x2F;code&gt;, &lt;code&gt;INVALID&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;note: &lt;code&gt;JUMPF&lt;&#x2F;code&gt; and &lt;code&gt;RETURNCODE&lt;&#x2F;code&gt; are introduced in separate EIPs.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Forward jump&lt;&#x2F;em&gt; refers to any of &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction with relative offset greater than or equal to 0. &lt;em&gt;Backwards jump&lt;&#x2F;em&gt; refers to any of &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction with relative offset less than 0, including jumps to the same jump instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Instructions in the code are scanned in a single linear pass over the code. For each instruction the operand stack height bounds are recorded as &lt;code&gt;stack_height_min&lt;&#x2F;code&gt; and &lt;code&gt;stack_height_max&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The first instruction&#x27;s recorded stack height bounds are initialized to be equal to the number of inputs to the function type matching the code (&lt;code&gt;stack_height_min = stack_height_max = type[code_section_index].inputs&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For each instruction:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if this instruction has recorded stack height bounds. If it does not, it means it was neither referenced by previous forward jump, nor is part of sequential instruction flow, and this code fails validation.
&lt;ul&gt;
&lt;li&gt;It is a prerequisite to validation algorithm, and code generators are required to order code basic blocks in a way that no block is referenced only by backwards jump. Any program can satisfy this requirement by ordering code basic blocks by the reverse postorder.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Determine the effect the instruction has on the operand stack:
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if the recorded stack height bounds satisfy the instruction requirements. Specifically:
&lt;ul&gt;
&lt;li&gt;for &lt;code&gt;CALLF&lt;&#x2F;code&gt; instruction the recorded stack height lower bound must be at least the number of inputs of the called function according to its type defined in the type section,&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;RETF&lt;&#x2F;code&gt; instruction both the recorded lower and upper bound must be equal and must be exactly the number of outputs of the function matching the code,&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; into returning function both the recorded lower and upper bound must equal exactly &lt;code&gt;type[current_section_index].outputs + type[target_section_index].inputs - type[target_section_index].outputs&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;for &lt;code&gt;JUMPF&lt;&#x2F;code&gt; into non-returning function the recorded stack height lower bound must be at least the number of inputs of the target function according to its type defined in the type section,&lt;&#x2F;li&gt;
&lt;li&gt;for any other instruction the recorded stack height lower bound must be at least the number of inputs required by instruction,&lt;&#x2F;li&gt;
&lt;li&gt;there is no additional check for terminating instructions other than &lt;code&gt;RETF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt;, this implies that extra items left on stack at instruction ending EVM execution are allowed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; &lt;strong&gt;check&lt;&#x2F;strong&gt; for possible stack overflow: if recorded stack height upper bound is greater than &lt;code&gt;1024 - types[target_section_index].max_stack_increase&lt;&#x2F;code&gt;, validation fails.&lt;&#x2F;li&gt;
&lt;li&gt;Compute new stack height bounds after the instruction execution. Upper and lower bound are updated by the same value:
&lt;ul&gt;
&lt;li&gt;after &lt;code&gt;CALLF&lt;&#x2F;code&gt; stack height bounds are adjusted by adding &lt;code&gt;types[target_section_index].outputs - types[target_section_index].inputs&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;after any other non-terminating instruction stack height bounds are adjusted by subtracting the number of instruction inputs and adding the number of instruction outputs,&lt;&#x2F;li&gt;
&lt;li&gt;terminating instructions do not need to update stack height bounds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Determine the list of successor instructions that can follow the current instructions:
&lt;ol&gt;
&lt;li&gt;The next instruction if the current instruction is not a terminating instruction nor unconditional jump (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;All the current instruction targets if the current instruction is a conditional (&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; or &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) or unconditional jump (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For each successor instruction:
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if the instruction is present in the code (i.e. execution must not &quot;fall off&quot; the code).&lt;&#x2F;li&gt;
&lt;li&gt;If the successor is reached via forwards jump or sequential flow from previous instruction:
&lt;ol&gt;
&lt;li&gt;If the instruction does not have stack height bounds recorded (being visited for the first time), record the instruction stack height bound as the value computed in 2.3.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, instruction has been already visited (by previously seen forward jump). Update this instruction&#x27;s recorded stack height bounds so that they contain the bounds computed in 2.3, i.e. &lt;code&gt;target_stack_min = min(target_stack_min, current_stack_min)&lt;&#x2F;code&gt; and &lt;code&gt;target_stack_max = max(target_stack_max, current_stack_max)&lt;&#x2F;code&gt;, where &lt;code&gt;(target_stack_min, target_stack_max)&lt;&#x2F;code&gt; are successor bounds and &lt;code&gt;(current_stack_min, current_stack_max)&lt;&#x2F;code&gt; are bounds computed in 2.3.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the successor is reached via backwards jump, &lt;strong&gt;check&lt;&#x2F;strong&gt; if the recorded stack height bounds equal the value computed in 2.3. Validation fails if they are not equal, i.e. we see backwards jump to a different stack height.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After all instructions are visited, determine the function maximum operand stack height increase:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Compute the maximum stack height &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; as the maximum of all recorded stack height upper bounds.&lt;&#x2F;li&gt;
&lt;li&gt;Compute the maximum stack height increase &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; as &lt;code&gt;max_stack_height - type[current_section_index].inputs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Check&lt;&#x2F;strong&gt; if the maximum stack height increase &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; matches the value corresponding code section&#x27;s within the type section: &lt;code&gt;types[current_section_index].max_stack_increase&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;Note: Although we check only that &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; matches the type section definition, which guarantees that it does not exceed 1023 by EOF header definition, it is also guaranteed that &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; does not exceed 1024, because otherwise validation of &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; into this section would fail at operand stack overflow check. Every section is required to have &lt;code&gt;CALLF&lt;&#x2F;code&gt; or &lt;code&gt;JUMPF&lt;&#x2F;code&gt; targeting it, except 0th section (non-reachable sections are not allowed). 0th section is required to have 0 inputs, which implies &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; equals &lt;code&gt;max_stack_height&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The computational and space complexity of this pass is &lt;em&gt;O(len(code))&lt;&#x2F;em&gt;. Each instruction is visited at most once.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;p&gt;Given the deploy-time validation guarantees, an EVM implementation is not required anymore to have run-time stack underflow nor overflow checks for each executed instruction. The exception is the &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; performing operand stack overflow check for the entire called function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;properties-of-validated-code&quot;&gt;Properties of validated code&lt;&#x2F;h3&gt;
&lt;p&gt;Any code section validated according to operand stack validation has the following properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There are no unreachable instructions&lt;&#x2F;li&gt;
&lt;li&gt;There are no instructions reachable only via backwards jump&lt;&#x2F;li&gt;
&lt;li&gt;Operand stack underflow cannot happen.&lt;&#x2F;li&gt;
&lt;li&gt;Operand stack overflow can only happen at &lt;code&gt;CALLF&lt;&#x2F;code&gt; or &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;Multiple forward jump instructions executing at different stack heights may target the same instruction; the stack of target basic block is validated for all possible heights.&lt;&#x2F;li&gt;
&lt;li&gt;Any backwards jump instruction can only target an instruction that is executed with equal stack height; this prevents deployment of the loops with unbounded stack pushing or popping.&lt;&#x2F;li&gt;
&lt;li&gt;Final instruction in the code section is either terminating instruction or &lt;code&gt;RJUMP&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;stack-overflow-check-only-in-callf-jumpf&quot;&gt;Stack overflow check only in CALLF&#x2F;JUMPF&lt;&#x2F;h3&gt;
&lt;p&gt;In this EIP, we provide a more efficient variant of the EVM where stack overflow check is performed only in &lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;JUMPF&lt;&#x2F;code&gt; instructions using the called function&#x27;s &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; information. This decreases flexibility of an EVM program because &lt;code&gt;max_stack_height&lt;&#x2F;code&gt; corresponds to the worst-case control-flow path in the function.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unreachable-code&quot;&gt;Unreachable code&lt;&#x2F;h3&gt;
&lt;p&gt;The operand stack validation algorithm rejects any code having any unreachable instructions. This check can be performed very cheaply. It prevents deploying degenerated code. Moreover, it enables combining instruction validation and operand stack validation into single pass.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clean-stack-upon-termination&quot;&gt;Clean stack upon termination&lt;&#x2F;h3&gt;
&lt;p&gt;It is currently required that the operand stack is empty (in the current function context) after the &lt;code&gt;RETF&lt;&#x2F;code&gt; instruction.
Otherwise, the &lt;code&gt;RETF&lt;&#x2F;code&gt; semantic would be more complicated. For &lt;code&gt;n&lt;&#x2F;code&gt; function outputs and &lt;code&gt;s&lt;&#x2F;code&gt; the stack height at &lt;code&gt;RETF&lt;&#x2F;code&gt; the EVM would have to erase &lt;code&gt;s-n&lt;&#x2F;code&gt; non-top stack items and move the &lt;code&gt;n&lt;&#x2F;code&gt; stack items to the place of erased ones. Cost of such operation may be relatively cheap but is not constant.
However, lifting the requirement and modifying the &lt;code&gt;RETF&lt;&#x2F;code&gt; semantic as described above is backward
compatible and can be easily introduced in the future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;more-restrictive-stack-validation&quot;&gt;More restrictive stack validation&lt;&#x2F;h3&gt;
&lt;p&gt;Originally another variant of stack validation was proposed, where instead of linear scan of the code section, all code paths were examined by following the target(s) of every jump instruction in a breadth-first-search manner, tracking stack height for each visited instruction and checking that for every possible code path to a particular instruction its stack height remains constant.&lt;&#x2F;p&gt;
&lt;p&gt;The advantage of this variant would be somewhat simpler algorithm (we would not need to track stack height bounds, but only a single stack height value for each instruction) and no extra requirement for ordering of code basic blocks (see below).&lt;&#x2F;p&gt;
&lt;p&gt;However, compiler teams opposed to such restrictive stack height requirements. One prominent pattern used by compilers which wouldn&#x27;t be possible is jumping to terminating helpers (code blocks ending with &lt;code&gt;RETURN&lt;&#x2F;code&gt; or &lt;code&gt;REVERT&lt;&#x2F;code&gt;) from different stack heights. This is common for example for a series of &lt;code&gt;assert&lt;&#x2F;code&gt; statements, each one compiled to a &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; into a shared terminating helper. Enforcing constant stack requirement would mean that before jumping to such helper, extra items on the stack have to be popped, and this noticeably increases code size and consumed gas, and would defeat the purpose of extracting these common terminating sequences into a helper.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ordering-of-basic-blocks&quot;&gt;Ordering of basic blocks&lt;&#x2F;h3&gt;
&lt;p&gt;The prerequisite to stack validation algorithm is ordering of code basic blocks in a way that no block is referenced only by backwards jump.&lt;&#x2F;p&gt;
&lt;p&gt;This is required to make it possible to examine each instruction in one linear pass over the code section. Forward pass over the code section allows for the algorithm to &quot;expand&quot; each forward jump target&#x27;s stack height bounds and still keep the complexity linear. Trying to do jump target stack bounds expansion while scanning the code in the breadth-first-search manner would require to re-examine entire code path after its stack height bounds are expanded, which would result in quadratic complexity.&lt;&#x2F;p&gt;
&lt;p&gt;This requirement is not unique to EOF but also present is some low-level IRs like SPIR-V and LLVM MIR.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a &quot;network upgrade,&quot; since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;It poses no risk to backwards compatibility, as it is introduced only for EOF1 contracts, for which deploying undefined instructions is not allowed, therefore there are no existing contracts using these instructions. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As mentioned above, the proposed validation algorithm has linear computational and space complexity and its cost is covered by the transaction data costs &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Semaphore for Reentrancy Protection</title>
        <published>2022-07-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Sergio D. Lerner</name><uri>https://github.com/SergioDemianLerner</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5283/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5283-a-semaphore-for-parallelizable-reentrancy-protection/10236" />
        

        <id>https://wg-eips.ritovision.com/5283/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5283"
            label="EIP-5283" />
        

        
        

        
        <summary type="html">A Precompile-based parallelizable reentrancy protection using the call stack</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5283/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes adding a precompiled contract that provides a semaphore function for creating a new type of reentrancy protection guard (RPG). This function aims to replace the typical RPG based on modifying a contract storage cell. The benefit is that the precompile-based RPG does not write to storage, and therefore it enables contracts to be forward-compatible with all designs that provide fine-grained (i.e. cell level) parallelization for the multi-threaded execution of EVM transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The typical smart contract RPG uses a contract storage cell. The algorithm is simple: the code checks that a storage cell is 0 (or any other predefined constant) on entry, aborting if not, and then sets it to 1. After executing the required code, it resets the cell back to 0 before exiting. This is the algorithm implemented in OpenZeppelin&#x27;s ReentrancyGuard. The algorithm results in a read-write pattern on the RPG&#x27;s storage cell. This pattern prevents the parallelization of the execution of the smart contract for all known designs that try to provide fine-grained parallelization (detecting conflicts at the storage cell level).&lt;&#x2F;p&gt;
&lt;p&gt;Several EVM-based blockchains have successfully tested designs for the parallelization of the EVM. The best results have been obtained with fine-grained parallelization where conflicts are detected by tracking writes and reads of individual storage cells. The designs based on tracking the use of accounts or contracts provide only minor benefits because most transactions use the same &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; contracts.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize, the only available RPG construction today is based on using a contract storage cell. This construction is clean but it is not forward-compatible with transaction execution parallelization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Starting from an activation block (TBD) a new precompiled contract &lt;code&gt;Semaphore&lt;&#x2F;code&gt; is created at address &lt;code&gt;0x0A&lt;&#x2F;code&gt;. When &lt;code&gt;Semaphore&lt;&#x2F;code&gt; is called, if the caller address is present more than once in the call stack, the contract behaves as if the first instruction had been a &lt;code&gt;REVERT&lt;&#x2F;code&gt;, therefore the CALL returns 0. Otherwise, it executes no code and returns 1. The gas cost of the contract execution is set to 100, which is consumed independently of the call result.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The address &lt;code&gt;0x0A&lt;&#x2F;code&gt; is the next one available within the range defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sample-usage&quot;&gt;Sample usage&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ^0.8.0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;abstract&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReentrancyGuard2&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint8&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; constant&lt;&#x2F;span&gt;&lt;span&gt; SemaphoreAddress &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x0A&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@dev&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevents a contract from calling itself, directly or indirectly.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Calling a `nonReentrant` function from another `nonReentrant`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * function is supported.      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    modifier&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        _nonReentrantBefore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        _&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; _nonReentrantBefore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; private&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    	assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;SemaphoreAddress&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;  0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;parallelizable-storage-based-rpgs&quot;&gt;Parallelizable storage-based RPGs&lt;&#x2F;h3&gt;
&lt;p&gt;The only way to parallelize preexistent contracts that are using the storage RPG construction is that the VM automatically detects that a storage variable is used for the RPG, and proves that it works as required. This requires static code analysis. This is difficult to implement in consensus for two reasons. First, the CPU cost of detection and&#x2F;or proving may be high. Second, some contract functions may not be protected by the RPG, meaning that some execution paths do not alter the RPG, which may complicate proving. Therefore this proposal aims to protect future contracts and let them be parallelizable, rather than to parallelize already deployed ones.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternatives&quot;&gt;Alternatives&lt;&#x2F;h3&gt;
&lt;p&gt;There are alternative designs to implement RPGs on the EVM:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Transient storage opcodes (&lt;code&gt;TLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;TSTORE&lt;&#x2F;code&gt;) provide contract state that is kept between calls in the same transaction but it is not committed to the world state afterward. These opcodes also enable fine-grained parallelization.&lt;&#x2F;li&gt;
&lt;li&gt;An opcode &lt;code&gt;SSTORE_COUNT&lt;&#x2F;code&gt; that retrieves the number of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; instructions executed. It enables also fine-grained execution parallelization, but &lt;code&gt;SSTORE_COUNT&lt;&#x2F;code&gt; is much more complex to use correctly as it returns the number &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcodes executed, not the number of reentrant calls. Reentrancy must be deducted from this value.&lt;&#x2F;li&gt;
&lt;li&gt;A new &lt;code&gt;LOCKCALL&lt;&#x2F;code&gt; opcode that works similar to &lt;code&gt;STATICALL&lt;&#x2F;code&gt; but only blocks storage writes in the caller contract. This results in cheaper RPG, but it doesn&#x27;t allow some contract functions to be free of the RPG.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All these alternative proposals have the downside that they create new opcodes, and this is discouraged if the same functionality can be implemented with the same gas cost using precompiles. A new opcode requires modifying compilers, debuggers and static analysis tools.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;A gas cost of 100 represents a worst-case resource consumption, which occurs when the stack is almost full (approximately 400 addresses) and it is fully scanned. As the stack is always present in RAM, the scanning is fast.&lt;&#x2F;p&gt;
&lt;p&gt;Note: Once code is implemented in geth, it can be benchmarked and the cost can be re-evaluated, as it may result to be lower in practice. As a precompile call currently costs 700 gas, the cost of stack scanning has a low impact on the total cost of the precompile call (800 gas in total).&lt;&#x2F;p&gt;
&lt;p&gt;The storage-based RPG currently costs 200 gas (because of the savings introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt;. Using the &lt;code&gt;Semaphore&lt;&#x2F;code&gt; precompile as a reentrancy check would currently cost 800 gas (a single call from one of the function modifiers). While this cost is higher than the traditional RPG cost and therefore discourages its use, it is still much lower than the pre-EIP-1283 cost. If a reduction in precompile call cost is implemented, then the cost of using the &lt;code&gt;Semaphore&lt;&#x2F;code&gt; precompile will be reduced to approximately 140 gas, below the current 200 gas consumed by a storage-based RPG. To encourage to use of the precompile-based RPG, it is suggested that this EIP is implemented together with a reduction in precompile calls cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a hard fork and therefore all full nodes must be updated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Test&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ReentrancyGuard2&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; second&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; first&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; nonReentrant&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;second&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A call to &lt;code&gt;second()&lt;&#x2F;code&gt; directly from a transaction does not revert, but a call to &lt;code&gt;first()&lt;&#x2F;code&gt; does revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Needs discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Delaying Difficulty Bomb to mid-September 2022</title>
        <published>2022-06-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tomasz Kajetan Stanczak</name><uri>https://github.com/tkstanczak</uri>
	</author>
	
	<author>
		<name>Eric Marti Haynes</name><uri>https://github.com/ericmartihaynes</uri>
	</author>
	
	<author>
		<name>Josh Klopfenstein</name><uri>https://github.com/joshklop</uri>
	</author>
	
	<author>
		<name>Abhimanyu Nag</name><uri>https://github.com/AbhiMan1601</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5133/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5133-delaying-difficulty-bomb-to-mid-september-2022/9622" />
        

        <id>https://wg-eips.ritovision.com/5133/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5133"
            label="EIP-5133" />
        

        
        

        
        <summary type="html">Delays the difficulty bomb by a further 700000 blocks, to the middle of September 2022.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5133/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 11,400,000 blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;To avoid network degradation due to a premature activation of the difficulty bomb.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11_400_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The following script predicts the bomb will go off at block 15530314, which is expected to be mined around mid-September.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; math&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predict_bomb_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;current_difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Predicts the block number at which the difficulty bomb will become noticeable.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_difficulty: the current difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    diff_adjust_coeff: intuitively, the percent increase in work that miners have to exert to find a PoW&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    block_adjustment: the number of blocks to delay the bomb by&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; round&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; math&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;log2&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; current_difficulty = 13891609586928851 (Jun 01, 2022)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; diff_adjust_coeff = 0.1 (historically, the bomb is noticeable when the coefficient is &amp;gt;= 0.1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block_adjustment = 11400000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;predict_bomb_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13891609586928851&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0.1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11400000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Precise increases in block times are very difficult to predict (especially after the bomb is noticeable).
However, based on past manifestations of the bomb, we can anticipate 0.1s delays by mid-September and 0.6-1.2s delays by early October.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications.&lt;&#x2F;p&gt;
&lt;p&gt;In this specific instance, it is possible that the network hashrate drops considerably before The Merge, which could accelerate the timeline by which the bomb is felt in block times. The offset value chosen aims to take this into account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Expirable Transaction</title>
        <published>2022-05-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/Arachnid</uri>
	</author>
	
	<author>
		<name>Konrad Feldmeier</name><email>konrad@brainbot.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5081/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5081-expirable-transaction/9208" />
        

        <id>https://wg-eips.ritovision.com/5081/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5081"
            label="EIP-5081" />
        

        
        

        
        <summary type="html">This EIP adds a new transaction type of that includes expiration with a blocknum</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5081/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a new transaction type of that includes expiration with a blocknum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When a user sends a transaction &lt;code&gt;tx0&lt;&#x2F;code&gt; with a low gas price, sometimes it might not be high enough to be executed.
A common resolution is for the user to submit the transaction again with the same nonce and higher gas price.&lt;&#x2F;p&gt;
&lt;p&gt;That previous &lt;code&gt;tx0&lt;&#x2F;code&gt; can theoretically be included in any time in the future unless a &lt;code&gt;tx&lt;&#x2F;code&gt; with the exact same nonce is already executed.&lt;&#x2F;p&gt;
&lt;p&gt;When network is congested, gas price are high, for critical transactions user might try gas price that is much higher than an average day.
This cause the &lt;code&gt;tx0&lt;&#x2F;code&gt; choice might be very easy to executed in the average day.&lt;&#x2F;p&gt;
&lt;p&gt;If user already uses a &lt;code&gt;tx1&lt;&#x2F;code&gt; with different nonce or from another account to execute the intended transaction,
there is currently no clean way to cancel it,
except for signing a new &lt;code&gt;tx0&#x27;&lt;&#x2F;code&gt; that shares the same nonce but with higher gas fee hoping that it will execute to &lt;em&gt;preempt&lt;&#x2F;em&gt;- than &lt;code&gt;tx0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given &lt;code&gt;tx0&lt;&#x2F;code&gt; was already high gas price, the current way of &lt;em&gt;preempting&lt;&#x2F;em&gt; &lt;code&gt;tx0&lt;&#x2F;code&gt; could be both unreliable and very costly.&lt;&#x2F;p&gt;
&lt;p&gt;TODO(@xinbenlv): to include in the motivation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Expiring transactions are transactions that have low time preference, but can easily become invalid in the future. For example, you may want to do a swap on an AMM but you don&#x27;t want to pay a very high fee for it so you set the max fee to a low number. However, your transaction will almost certainly fail if it takes longer than a couple minutes to be mined. In this scenario, you would rather fail cheaply if your transaction doesn&#x27;t get included quickly.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Similarly, there are situations where there is a limited window of availability of some asset and if your transaction doesn&#x27;t mine within that period you know with certainty that it will fail. In these cases, it would be nice to be able to express that to the system and not waste unnecessary resources just to have the transaction fail.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TX_TYPE&lt;&#x2F;code&gt; = TBD, &amp;gt; 0x02 (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; = &lt;code&gt;TX_TYPE(TBD)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([chain_id, expire_by, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The definition of &lt;code&gt;expire_by&lt;&#x2F;code&gt; is a block number the latest possible block to
execute this transaction. Any block with a block number &lt;code&gt;block_num &amp;gt; expire_by&lt;&#x2F;code&gt; MUST NOT execute this transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The definitions of all other fields share the same meaning with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x02 || rlp([chain_id, expire_by, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;If &lt;code&gt;current_block_num&lt;&#x2F;code&gt; is available, client MUST drop and stop propagating&#x2F;broadcasting any transactions that has a
&lt;code&gt;transaction_type == TX_TYPE&lt;&#x2F;code&gt; AND &lt;code&gt;current_block_num &amp;gt; expire_by&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is suggested but not required that a &lt;code&gt;currentBlockNum&lt;&#x2F;code&gt; SHOULD be made available to client. Any client doing PoW calculation on blocks expire tx or propagating such are essentially penalized for wasting of work, mitigating possible denial of service attack.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is suggested but not required that client SHOULD introduce a
&lt;code&gt;gossip_ttl&lt;&#x2F;code&gt; in unit of block_num as a safe net so that it only propagate
a tx if &lt;code&gt;current_block_num + gossip_ttl &amp;lt;= expire_by&lt;&#x2F;code&gt;. Backward compatibility:
for nodes that doesn&#x27;t have &lt;code&gt;current_block_num&lt;&#x2F;code&gt; or &lt;code&gt;gossip_ttl&lt;&#x2F;code&gt; available,
they should be presumed to be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It is suggested by not required that any propagating client SHOULD properly deduct the &lt;code&gt;gossip_ttl&lt;&#x2F;code&gt;
based on the network environment it sees fit.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Instruction for transferring ether</title>
        <published>2022-04-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mudit Gupta</name><uri>https://github.com/maxsam4</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5065/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5065-instruction-for-transferring-ether/9107" />
        

        <id>https://wg-eips.ritovision.com/5065/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5065"
            label="EIP-5065" />
        

        
        

        
        <summary type="html">Instruction for just transferring ether without transferring the flow of execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5065/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new instruction that transfers ether to a destination address without handing over the flow of execution to it. It should work similarly to how &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt; transfers ether to the destination without making a call to it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;From an architectural point of view, execution flow should never be handed over to an untrusted contract. Ethereum currently does not have any ideal way to transfer ether without transferring the flow of execution. People have come up with reentrancy guards and similar solutions to prevent some types of attacks but it&#x27;s not an ideal solution. The only way to transfer ether from smart contracts without triggering a call is to create a dummy contract, send the precise amount of ether to it and then call &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt; from it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new instruction, &lt;code&gt;AIRDROP&lt;&#x2F;code&gt; (&lt;code&gt;0xFG&lt;&#x2F;code&gt;) that transfers ether to the destination without making a call to it.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;stack-input&quot;&gt;Stack input&lt;&#x2F;h3&gt;
&lt;p&gt;address: the account to send ether to.
value: value in wei to send to the account.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;The total gas cost should be the sum of a static cost + address_access_cost + value_to_empty_account_cost.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Static cost: 6700&lt;&#x2F;li&gt;
&lt;li&gt;Dynamic cost:
&lt;ol&gt;
&lt;li&gt;address_access_cost: If the target is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; gas, and add the address to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;. Otherwise, charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas. Currently, &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; is 2600 while &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; is 100.&lt;&#x2F;li&gt;
&lt;li&gt;value_to_empty_account_cost: If value is not 0 and the address given points to an empty account, then value_to_empty_account_cost is the account creation gas cost which currently is 25000. An account is empty if its balance is 0, its nonce is 0 and it has no code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This behavior is already possible by deploying a new contract that does &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt; but it is prohibitively expensive. In most scenarios, the contract author only wants to transfer ether rather than transferring control of the execution. ERC20 can be used as a case study for this where most users transfer funds without a post-transfer hook.&lt;&#x2F;p&gt;
&lt;p&gt;This instruction allows contracts to safely pass ether to an untrusted address without worrying about reentrancy or other malicious things an untrusted contract can do on.&lt;&#x2F;p&gt;
&lt;p&gt;The static gas cost is derived by subtracting the gas stipend (2300) from the positive_value_cost of &lt;code&gt;CALL (0xF1)&lt;&#x2F;code&gt; opcode which is currently set to 9000.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues as this is a new instruction that does not affect any old instructions and does not break any valid assumptions since it make not anything impossible possible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No known security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;publicdomain&#x2F;zero&#x2F;1.0&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove the limit on contract code size</title>
        <published>2022-04-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Qi Zhou</name><uri>https://github.com/qizhou</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5027/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5027-unlimit-contract-code-size/9010" />
        

        <id>https://wg-eips.ritovision.com/5027/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5027"
            label="EIP-5027" />
        

        
        

        
        <summary type="html">Change the limit on contract size from 24576 to infinity</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5027/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Remove the limit on the contract code size, i.e., only limit the contract code size by block gas limit, with minimal changes to existing code and proper gas metering adjustment to avoid possible attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation is to remove the limit on the code size so that users can deploy a large-code contract without worrying about splitting the contract into several sub-contracts.&lt;&#x2F;p&gt;
&lt;p&gt;With the dramatic growth of dApplications, the functionalities of smart contracts are becoming more and more complicated, and thus, the sizes of newly developed contracts are steadily increasing.  As a result, we are facing more and more issues with the 24576-bytes contract size limit.  Although several techniques such as splitting a large contract into several sub-contracts can alleviate the issue, these techniques inevitably increase the burden of developing&#x2F;deploying&#x2F;maintaining smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;The proposal implements a solution to remove the existing 24576-bytes limit of the code size.  Further, the proposal aims to minimize the changes in the client implementation (e.g., Geth) with&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;proper gas metering to avoid abusing the node resources for contract-related opcodes, i.e, &lt;code&gt;CODESIZE (0x38)&#x2F;CODECOPY (0x39)&#x2F;EXTCODESIZE (0x3B)&#x2F;EXTCODECOPY (0x3C)&#x2F;EXTCODEHASH (0x3F)&#x2F;DELEGATECALL (0xF4)&#x2F;CALL (0xF1)&#x2F;CALLCODE (0xF2)&#x2F;STATICCALL (0xFA)&#x2F;CREATE (0xF0)&#x2F;CREATE2 (0xF5)&lt;&#x2F;code&gt;; and&lt;&#x2F;li&gt;
&lt;li&gt;no change to the existing structure of the Ethereum state.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;24576&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_CODE_ACCESS_COST_PER_UNIT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CREATE_DATA_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, the contract creation initialization can return data with any length, but the contract-related opcodes will take extra gas as defined below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;CODESIZE&#x2F;CODECOPY&#x2F;EXTCODESIZE&#x2F;EXTCODEHASH&lt;&#x2F;code&gt;, the gas is unchanged.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For CREATE&#x2F;CREATE2, if the newly created contract size &amp;gt; &lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;, the opcodes will take extra write gas as&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;(CODE_SIZE - CODE_SIZE_UNIT) * CREATE_DATA_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;EXTCODECOPY&#x2F;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt;, if the contract code size &amp;gt; &lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;, then the opcodes will take extra gas as&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(CODE_SIZE - 1) &#x2F;&#x2F; CODE_SIZE_UNIT * COLD_ACCOUNT_CODE_ACCESS_COST_PER_UNIT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;if the contract is not in &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt; or &lt;code&gt;0&lt;&#x2F;code&gt; if the contract is in &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt;, where &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is the integer divide operator, and &lt;code&gt;accessed_code_in_addresses: Set[Address]&lt;&#x2F;code&gt; is a transaction-context-wide set similar to &lt;code&gt;access_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When a transaction execution begins, &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt; will include &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, &lt;code&gt;tx.to&lt;&#x2F;code&gt;, and all precompiles.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;CREATE&#x2F;CREATE2&#x2F;EXTCODECOPY&#x2F;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt; is called, immediately add the address to &lt;code&gt;accessed_code_in_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-metering&quot;&gt;Gas Metering&lt;&#x2F;h3&gt;
&lt;p&gt;The goal is to measure the CPU&#x2F;IO cost of the contract read&#x2F;write operations reusing existing gas metering so that the resources will not be abused.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For code-size-related opcodes (&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;), we would expect the client to implement a mapping from the hash of code to the size, so reading the code size of a large contract should still be O(1).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, the data is already loaded in memory (as part of &lt;code&gt;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt;), so we do not charge extra gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, the value is already in the account, so we do not charge extra gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;EXTCODECOPY&#x2F;CALL&#x2F;CALLCODE&#x2F;DELEGATECALL&#x2F;STATICCALL&lt;&#x2F;code&gt;, since it will read extra data from the database, we will additionally charge &lt;code&gt;COLD_ACCOUNT_CODE_ACCESS_COST_PER_UNIT&lt;&#x2F;code&gt; per extra &lt;code&gt;CODE_SIZE_UNIT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;For &lt;code&gt;CREATE&#x2F;CREATE2&lt;&#x2F;code&gt;, since it will create extra data to the database, we will additionally charge &lt;code&gt;CREATE_DATA_GAS&lt;&#x2F;code&gt; per extra bytes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All existing contracts will not be impacted by the proposal.&lt;&#x2F;p&gt;
&lt;p&gt;Only contracts deployed before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; could possibly be longer than the current max code size, and the reference implementation was able to successfully import all blocks before that fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference implementation on Geth is available at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5027&#x2F;.&#x2F;assets&#x2F;0001-unlimit-code-size.patch&quot;&gt;0001-unlimit-code-size.patch&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase price of SSTORE from zero to non-zero to 40k gas</title>
        <published>2022-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Green</name><uri>https://github.com/greenlucid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5022/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-proposal-increase-cost-of-sstore-from-20k-to-x-when-creating-new-storage/7614" />
        

        <id>https://wg-eips.ritovision.com/5022/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:5022"
            label="EIP-5022" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5022/">&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;Increase the price of the SSTORE opcode from &lt;code&gt;20_000&lt;&#x2F;code&gt; gas to &lt;code&gt;40_000&lt;&#x2F;code&gt; gas when the original slot is zero and the resultant slot is non-zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of creating a piece of new state increases as state is larger. However, the price for creating every new storage slot has not increased.
All resources are merged into the same pricing mechanism. If the price for creating new storage slots is fixed, then it needs to be manually changed.&lt;&#x2F;p&gt;
&lt;p&gt;One of the main reasons for not increasing gas limit is the increase of state. In that regard, because the cost of creating storage is higher than its price, all the users of all the other opcodes are subsidizing the creation of state. If state creation was more precisely priced, raising gas limit would be more feasible, and would benefit the users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-also-raise-the-cost-of-non-zero-to-non-zero&quot;&gt;Why not also raise the cost of non-zero to non-zero?&lt;&#x2F;h3&gt;
&lt;p&gt;Rewriting storage does not affect state growth, which is the main issue this EIP is addressing. Rewriting storage may also be underpriced.
Increasing the price of state growth will, at least, incentivize developers to reuse storage instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-also-increase-the-gas-refund-from-setting-non-zero-to-zero&quot;&gt;Why not also increase the gas refund from setting non-zero to zero?&lt;&#x2F;h3&gt;
&lt;p&gt;More discussion is needed on this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-a-better-state-solution&quot;&gt;Why not a better state solution?&lt;&#x2F;h3&gt;
&lt;p&gt;Whereas solutions like state rent, or state expiry have been researched for a long time, they will not be ready on the short to medium term. So, it is desirable to patch pricing for the short term. Opcode repricing has been done before, so it should not impose a large development time investment for clients.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-was-that-specific-amount-chosen&quot;&gt;Why was that specific amount chosen?&lt;&#x2F;h3&gt;
&lt;p&gt;The current pricing was made off a naive approach of benchmarking opcodes in a laptop. Not only it did not consider the long term problem of having the same price for a resource that costs more over time, the benchmark itself was wrong. This price is closer to what the naive original benchmark should have been. It could go higher, but that may be too disruptive.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;is-this-too-disruptive&quot;&gt;Is this too disruptive?&lt;&#x2F;h3&gt;
&lt;p&gt;This change will severely impact the gas cost of many applications. The network does not have to subsidize state growth at the expense of more expensive regular transactions, so even if it is too disruptive, it will increase the health of the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NEW_STORAGE_PRICE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;40_000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, a new gas schedule applies. Make &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt;, the price when a slot is set from zero to non-zero, equal &lt;code&gt;NEW_STORAGE_PRICE&lt;&#x2F;code&gt;. All other costs remain the same.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts that depend on hardcoded gas costs will break if they create state.&lt;&#x2F;p&gt;
&lt;p&gt;It is a gas schedule change, so transactions from an epoch before FORK_BLOCK should be treated with previous gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;24725&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Insert Code into EOAs with AUTHUSURP</title>
        <published>2022-03-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dan Finlay</name><uri>https://github.com/danfinlay</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5003/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5003-auth-usurp-publishing-code-at-an-eoa-address/8979" />
        

        <id>https://wg-eips.ritovision.com/5003/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:5003"
            label="EIP-5003" />
        

        
        

        
        <summary type="html">Allow migrating away from ECDSA by deploying code in place of an externally owned account.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5003/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode, &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt;, which deploys code at an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; authorized address. For externally owned accounts (EOAs), together with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt;, this effectively revokes the original signing key&#x27;s authority.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EOAs currently hold a significant amount of user-controlled value on Ethereum blockchains, but are limited by the protocol in a variety of critical ways. These accounts do not support rotating keys for security, batching to save gas, or sponsored transactions to reduce the need to hold ether yourself. There are countless other benefits that come from having a contract account or account abstraction, like choosing one&#x27;s own authentication algorithm, setting spending limits, enabling social recovery, allowing key rotation, arbitrarily and transitively delegating capabilities, and just about anything else we can imagine.&lt;&#x2F;p&gt;
&lt;p&gt;New users have access to these benefits using smart contract wallets, and new contracts can adopt recent standards to enable app-layer account abstraction (like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4337&#x2F;&quot;&gt;EIP-4337&lt;&#x2F;a&gt;), but these would neglect the vast majority of existing Ethereum users&#x27; accounts. These users exist today, and they also need a path to achieving their security goals.&lt;&#x2F;p&gt;
&lt;p&gt;Those added benefits would mostly come along with EIP-3074 itself, but with one significant shortcoming: the original signing key has ultimate authority for the account. While an EOA could delegate its authority to some &lt;em&gt;additional&lt;&#x2F;em&gt; contract, the key itself would linger, continuing to provide an attack vector, and a constantly horrifying question lingering: have I been leaked? In other words, EIP-3074 can only grant authority to additional actors, but never revoke it.&lt;&#x2F;p&gt;
&lt;p&gt;Today&#x27;s EOAs have no option to rotate their keys. A leaked private key (either through phishing, or accidental access) cannot be revoked. A prudent user concerned about their key security might migrate to a new secret recovery phrase but at best this requires a transaction per asset (making it extremely expensive), and at worst, some powers (like hard-coded owners in a smart contract) might not be transferable at all.&lt;&#x2F;p&gt;
&lt;p&gt;We know that EOAs cannot provide ideal user experience or safety, and there is a desire in the community to change the norm to contract-based accounts, but if that transition is designed without regard for the vast majority of users today—for whom Ethereum has always meant EOAs—we will be continually struggling against the need to support both of these userbases. This EIP provides a path not to enshrine EOAs, but to provide a migration path off of them, once and for all.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal combines well with, but is distinct from, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt;, which provides opcodes that could enable any externally owned account (EOA) to delegate its signing authority to an arbitrary smart contract. It allows an EOA to authorize a contract account to act on its behalf &lt;em&gt;without forgoing its own powers&lt;&#x2F;em&gt;, while this EIP provides a final migration path off the EOA&#x27;s original signing key.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;top - N&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - the &lt;code&gt;N&lt;&#x2F;code&gt;th most recently pushed value on the EVM stack, where &lt;code&gt;top - 0&lt;&#x2F;code&gt; is the most recent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;invalid execution&lt;&#x2F;strong&gt; - execution that is invalid and must exit the current execution frame immediately, consuming all remaining gas (in the same way as a stack underflow or invalid jump).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;empty account&lt;&#x2F;strong&gt; - account where its balance is 0, its nonce is 0, and it has no code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authusurp-0xf8&quot;&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; (&lt;code&gt;0xf8&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; shall be created at &lt;code&gt;0xf8&lt;&#x2F;code&gt;. It shall take two stack elements and return one stack element.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; behaves identically to &lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xf0&lt;&#x2F;code&gt;), except as described below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;authorized&lt;&#x2F;code&gt; (as defined in EIP-3074) is unset, execution is invalid.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;authorized&lt;&#x2F;code&gt; points to an empty account, then &lt;code&gt;static_gas&lt;&#x2F;code&gt; remains 32,000. Otherwise, &lt;code&gt;static_gas&lt;&#x2F;code&gt; shall be 7,000.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; does not check the nonce of the &lt;code&gt;authorized&lt;&#x2F;code&gt; account.&lt;&#x2F;li&gt;
&lt;li&gt;The initcode runs at the address &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the initcode returns no bytes, its execution frame must be reverted, and &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; returns zero.&lt;&#x2F;li&gt;
&lt;li&gt;After executing the initcode, but before the returned code is deployed, if the account&#x27;s code is non-empty, the initcode&#x27;s execution frame must be reverted, and &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; returns zero.&lt;&#x2F;li&gt;
&lt;li&gt;The code is deployed into the account with the address &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; does not check the nonce of the &lt;code&gt;authorized&lt;&#x2F;code&gt; account because it must work with accounts that have previously sent transactions.&lt;&#x2F;p&gt;
&lt;p&gt;When using &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt;, if the initcode were to deploy a zero-length contract, there would be no way to prevent using &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; again later.&lt;&#x2F;p&gt;
&lt;p&gt;The account&#x27;s code must be checked immediately before deploying to catch the situation where the initcode attempts to &lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; at the same address. This is unnecessary with other deployment instructions because they increment and check the account&#x27;s nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;AUTHUSURP&lt;&#x2F;code&gt; with EIP-3607 revokes the authority of the original ECDSA signature to send transactions from the account. This is completely new behavior, although it is somewhat similar to the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts using ECDSA signatures outside of transactions will not be aware that the usurped account is no longer controlled by a private key. This means that, for example, the private key will &lt;em&gt;always&lt;&#x2F;em&gt; have access to the &lt;code&gt;permit&lt;&#x2F;code&gt; function on token contracts. This can—and should—be mitigated by modifying the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; pre-compiled contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MULDIV instruction</title>
        <published>2022-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Harikrishnan Mulackal</name><uri>https://github.com/hrkrshnn</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5000/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/muldiv-instruction/9930" />
        

        <id>https://wg-eips.ritovision.com/5000/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:5000"
            label="EIP-5000" />
        

        
        

        
        <summary type="html">Introduce a new instruction to perform x * y &#x2F; z in 512-bit precision</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5000/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new instruction, &lt;code&gt;MULDIV(x, y, z)&lt;&#x2F;code&gt;, to perform &lt;code&gt;((x * y) &#x2F; z) % 2**256&lt;&#x2F;code&gt; in 512-bit precision. &lt;code&gt;z = 0&lt;&#x2F;code&gt; is a special case for &lt;code&gt;(x * y) &#x2F; 2**256&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Fixed point operations in high level languages are very commonly used on Ethereum, especially in the domain of financial applications.&lt;&#x2F;p&gt;
&lt;p&gt;While fixed point addition and subtraction can be done with merely &lt;code&gt;add&lt;&#x2F;code&gt; and &lt;code&gt;sub&lt;&#x2F;code&gt; respectively, being able to efficiently do fixedpoint multiplication and division is a very sought after feature. A commonly used workaround relies on a &lt;code&gt;mulmod&lt;&#x2F;code&gt;-based, rather complex implementation (taking around 50 instructions, excluding stack manipulation). This instruction reduces that to a single opcode.&lt;&#x2F;p&gt;
&lt;p&gt;A secondary use case is likely in cryptographic applications, where the &lt;code&gt;muldiv&lt;&#x2F;code&gt; instruction allows full precision 256x256-&amp;gt;512 multiplication. &lt;code&gt;mul(x y)&lt;&#x2F;code&gt; (or &lt;code&gt;muldiv(x, y, 1)&lt;&#x2F;code&gt;) computes the lower order 256 bits and &lt;code&gt;muldiv(x, y, 0)&lt;&#x2F;code&gt; computes the higher order 256 bits.&lt;&#x2F;p&gt;
&lt;p&gt;Finally we aimed to provide an instruction which can be efficiently used both in &lt;em&gt;checked&lt;&#x2F;em&gt; and &lt;em&gt;unchecked arithmetic&lt;&#x2F;em&gt; use cases. By &lt;em&gt;checked&lt;&#x2F;em&gt; we mean to abort on conditions including division-by-zero and wrapping behaviour.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new instruction is introduced: &lt;code&gt;MULDIV&lt;&#x2F;code&gt; (&lt;code&gt;0x1e&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pops 3 values from the stack, first &lt;code&gt;x&lt;&#x2F;code&gt;, then &lt;code&gt;y&lt;&#x2F;code&gt; and &lt;code&gt;z&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;z == 0&lt;&#x2F;code&gt;, &lt;code&gt;r = (uint512(x) * y) &#x2F; 2**256&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise &lt;code&gt;r = (uint512(x) * y &#x2F; z) % 2**256&lt;&#x2F;code&gt;, where the intermediate calculation is performed with 512-bit precision.&lt;&#x2F;li&gt;
&lt;li&gt;Pushes &lt;code&gt;r&lt;&#x2F;code&gt; on the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; operations `*` and `&#x2F;&#x2F;` are done in 512 bit precision&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; muldiv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; z&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The cost of the instruction is 8 gas (aka &lt;code&gt;mid&lt;&#x2F;code&gt;), the same as for &lt;code&gt;addmod&lt;&#x2F;code&gt; and &lt;code&gt;mulmod&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-special-0-case&quot;&gt;The special 0 case&lt;&#x2F;h3&gt;
&lt;p&gt;All the arithmetic instructions in EVM handle division or modulo 0 specially: the instructions return 0. We have decided to break consistency in order to provide a flexible opcode, which can be used to detect wrapping behaviour.&lt;&#x2F;p&gt;
&lt;p&gt;Alternate options include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Returning a flag for wrapping&lt;&#x2F;li&gt;
&lt;li&gt;Returning two stack items, higher and lower order bits&lt;&#x2F;li&gt;
&lt;li&gt;Compute the higher order 256 bits in EVM:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Returns `hi` such that `x × y = hi × 2**256 + mul(x, y)`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; hob&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; hi&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint&lt;&#x2F;span&gt;&lt;span&gt; uint_max &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; lo &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mul&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        let&lt;&#x2F;span&gt;&lt;span&gt; mm &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; mulmod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; uint_max&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hi &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sub&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; lt&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mm&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lo&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;While this feature is clever and useful, callers must be aware that unlike other EVM instructions, passing 0 will have a vastly different behaviour.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;argument-ordering&quot;&gt;Argument ordering&lt;&#x2F;h3&gt;
&lt;p&gt;The order of arguments matches &lt;code&gt;addmod&lt;&#x2F;code&gt; and &lt;code&gt;mulmod&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a new instruction not present prior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MULDIV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MULDIV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000de0b6b3a7640000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x000000000000000000000000000000000000000000000000016345785d8a0000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00000000000000000000000000000000000000000000d3c21bcecceda1000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MULDIV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x00000000000000000000000000000000000000000000152d02c7e14af6800000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PAY opcode</title>
        <published>2022-03-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin John</name><uri>https://github.com/Pandapip1</uri>
	</author>
	
	<author>
		<name>Zainan Victor Zhou</name><uri>https://github.com/xinbenlv</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5920/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5920-pay-opcode/11717" />
        

        <id>https://wg-eips.ritovision.com/5920/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:5920"
            label="EIP-5920" />
        

        
        

        
        <summary type="html">Introduces a new opcode, PAY, to send ether to an address without calling any of its functions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5920/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode, &lt;code&gt;PAY&lt;&#x2F;code&gt;, taking two stack parameters, &lt;code&gt;addr&lt;&#x2F;code&gt; and &lt;code&gt;val&lt;&#x2F;code&gt;, that transfers &lt;code&gt;val&lt;&#x2F;code&gt; wei to the address &lt;code&gt;addr&lt;&#x2F;code&gt; without calling any of its functions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, to send ether to an address requires you to call into that address, which transfers execution context to that address, which creates several issues:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;First of all, it opens a reentrancy attack vector, as the recipient can call back into the sender. More generally, the recipient can unilaterally execute arbitrary state changes, limited only by the gas forwarded, which is not desirable from the point of view of the sender.
&lt;ul&gt;
&lt;li&gt;In practice, when calling into another account and sending ether, 2300 gas (the &quot;gas stipend&quot;) is always available &quot;for free&quot; in the newly created call frame. Although it is currently not possible to make storage state changes with the 2300 gas stipend (see the last minute rejection of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; from Constantinople to be replaced with the &quot;gas stipend safe&quot; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; version in Istanbul), it is possible to do this with transient storage (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;). This is a security risk where potentially the transient storage gets changed unintentionally. The goal is to send ether, and not have to consider these potential unintuitive security problems.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Secondly, it opens a DoS vector. Contracts wanting to send ether must be cognizant of the possibility that the recipient will run out of gas or revert.&lt;&#x2F;li&gt;
&lt;li&gt;Future potential call-like opcodes may not provide a way to restrict the amount of gas being forwarded to the recipient, so the meager mitigation against unintended side effects in use today (gas limit) is not guaranteed to be available.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;EXTCALL&lt;&#x2F;code&gt; opcodes will execute code on the recipient, which is unintended when wanting to send ether and which could lead to unintentional operations. The code execution also has to be paid for in gas, even when the intention is to only send ether, which is thus an unnecessary waste of gas.&lt;&#x2F;li&gt;
&lt;li&gt;Finally, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; allows to delegate externally owned accounts (EOAs) to other accounts, which breaks the invariant that EOAs cannot contain code. Therefore, calling such EOA with the intention to send ether will thus also execute code and cost unnecessary gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Having a dedicated opcode for ether transfers solves all of these issues, and would be a useful addition to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Definition&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L52&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-specs&#x2F;blob&#x2F;4d953035fb0cceda7cf21d71b2ab7a9a6f4632f0&#x2F;src&#x2F;ethereum&#x2F;frontier&#x2F;vm&#x2F;gas.py#L53&quot;&gt;EELS&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode is introduced: &lt;code&gt;PAY&lt;&#x2F;code&gt; (&lt;code&gt;0xfc&lt;&#x2F;code&gt;), which:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Halt with exceptional failure if the current frame is static, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;214&#x2F;&quot;&gt;EIP-214&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Pops two values from the stack: &lt;code&gt;addr&lt;&#x2F;code&gt; then &lt;code&gt;val&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Exceptionally halts if &lt;code&gt;addr&lt;&#x2F;code&gt; has any of the high 12 bytes set to a non-zero value (i.e. it does not contain a 20-byte address).&lt;&#x2F;li&gt;
&lt;li&gt;Charges the gas cost detailed below.&lt;&#x2F;li&gt;
&lt;li&gt;Marks &lt;code&gt;addr&lt;&#x2F;code&gt; as warm (adding &lt;code&gt;addr&lt;&#x2F;code&gt; to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Transfers &lt;code&gt;val&lt;&#x2F;code&gt; wei from the current address to the address &lt;code&gt;addr&lt;&#x2F;code&gt;, only if the current address has a balance greater than or equal to &lt;code&gt;val&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Push &lt;code&gt;1&lt;&#x2F;code&gt; on the stack if the &lt;code&gt;PAY&lt;&#x2F;code&gt; operation was successful, or &lt;code&gt;0&lt;&#x2F;code&gt; if it failed.
&lt;ul&gt;
&lt;li&gt;Currently only insufficient balance would produce a &lt;code&gt;0&lt;&#x2F;code&gt; return value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for &lt;code&gt;PAY&lt;&#x2F;code&gt; is the sum of the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Is &lt;code&gt;addr&lt;&#x2F;code&gt; in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;?
&lt;ul&gt;
&lt;li&gt;If yes, &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Does &lt;code&gt;addr&lt;&#x2F;code&gt; exist or is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes to either, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Is &lt;code&gt;val&lt;&#x2F;code&gt; zero?
&lt;ul&gt;
&lt;li&gt;If yes, zero;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;GAS_CALL_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;PAY&lt;&#x2F;code&gt; cannot be implemented on networks with empty accounts (see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7523&#x2F;&quot;&gt;EIP-7523&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;argument-order&quot;&gt;Argument order&lt;&#x2F;h3&gt;
&lt;p&gt;The order of arguments mimics that of &lt;code&gt;CALL&lt;&#x2F;code&gt;, which pops &lt;code&gt;addr&lt;&#x2F;code&gt; before &lt;code&gt;val&lt;&#x2F;code&gt;. Beyond consistency, though, this ordering aids validators pattern-matching MEV opportunities, so &lt;code&gt;PAY&lt;&#x2F;code&gt; always appears immediately after &lt;code&gt;COINBASE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;halting-for-invalid-address&quot;&gt;Halting for invalid address&lt;&#x2F;h3&gt;
&lt;p&gt;The halting behavior is designed to allow for Address Space Extension.
If the high bytes were truncated, as in &lt;code&gt;CALL&lt;&#x2F;code&gt;, contracts could depend on the truncating behavior.
If the address space were extended beyond 20 bytes, &lt;code&gt;PAY&lt;&#x2F;code&gt; would either not be able to target those accounts, or code expecting truncation could send ether to the wrong address.&lt;&#x2F;p&gt;
&lt;p&gt;Because this behavior may be changed, contracts should not rely on this halting behavior and use methods designated to intentionally halt (such as the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;141&#x2F;&quot;&gt;&lt;code&gt;INVALID&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; opcode).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change requires a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Existing contracts should not rely on their balance being under their control, since it is already possible to send ether to an address without calling it, by using the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode (somewhat restricted in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6780&#x2F;&quot;&gt;EIP-6780&lt;&#x2F;a&gt;).
It is also possible to involuntarily fund an account with priority fees sent to a &lt;code&gt;block.coinbase&lt;&#x2F;code&gt;.
However, this opcode does make this process cheaper and easier. It thus does not break an invariant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Beacon chain push withdrawals as operations</title>
        <published>2022-03-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4895/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4895-beacon-chain-withdrawals-as-system-level-operations/8568" />
        

        <id>https://wg-eips.ritovision.com/4895/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4895"
            label="EIP-4895" />
        

        
        

        
        <summary type="html">Support validator withdrawals from the beacon chain to the EVM via a new &quot;system-level&quot; operation type.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4895/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a system-level &quot;operation&quot; to support validator withdrawals that are &quot;pushed&quot; from the beacon chain to the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;These operations create unconditional balance increases to the specified recipients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a way for validator withdrawals made on the beacon chain to enter into the EVM.
The architecture is &quot;push&quot;-based, rather than &quot;pull&quot;-based, where withdrawals are required to be processed in the execution layer as soon as they are dequeued from the consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;Withdrawals are represented as a new type of object in the execution payload -- an &quot;operation&quot; -- that separates the withdrawals feature from user-level transactions.
This approach is more involved than the prior approach introducing a new transaction type but it cleanly separates this &quot;system-level&quot; operation from regular transactions.
The separation simplifies testing (so facilitates security) by reducing interaction effects generated by mixing this system-level concern with user data.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, this approach is more complex than &quot;pull&quot;-based alternatives with respect to the core protocol but does provide tighter integration of a critical feature into the protocol itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;constants&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;units&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1681338455&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Beginning with the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; introduce the following extensions to payload validation and processing:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-level-operation-withdrawal&quot;&gt;System-level operation: withdrawal&lt;&#x2F;h3&gt;
&lt;p&gt;Define a new payload-level object called a &lt;code&gt;withdrawal&lt;&#x2F;code&gt; that describes withdrawals that have been validated at the consensus layer.
&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;s are syntactically similar to a user-level transaction but live in a different domain than user-level transactions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt;s provide key information from the consensus layer:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;a monotonically increasing &lt;code&gt;index&lt;&#x2F;code&gt;, starting from 0, as a &lt;code&gt;uint64&lt;&#x2F;code&gt; value that increments by 1 per withdrawal to uniquely identify each withdrawal&lt;&#x2F;li&gt;
&lt;li&gt;the &lt;code&gt;validator_index&lt;&#x2F;code&gt; of the validator, as a &lt;code&gt;uint64&lt;&#x2F;code&gt; value, on the consensus layer the withdrawal corresponds to&lt;&#x2F;li&gt;
&lt;li&gt;a recipient for the withdrawn ether &lt;code&gt;address&lt;&#x2F;code&gt; as a 20-byte value&lt;&#x2F;li&gt;
&lt;li&gt;a nonzero &lt;code&gt;amount&lt;&#x2F;code&gt; of ether given in Gwei (1e9 wei) as a &lt;code&gt;uint64&lt;&#x2F;code&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;NOTE&lt;&#x2F;em&gt;: the &lt;code&gt;index&lt;&#x2F;code&gt; for each withdrawal is a global counter spanning the entire sequence of withdrawals.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;Withdrawal&lt;&#x2F;code&gt; objects are serialized as a RLP list according to the schema: &lt;code&gt;[index, validator_index, address, amount]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-field-in-the-execution-payload-withdrawals&quot;&gt;New field in the execution payload: withdrawals&lt;&#x2F;h3&gt;
&lt;p&gt;The execution payload gains a new field for the &lt;code&gt;withdrawals&lt;&#x2F;code&gt; which is an RLP list of &lt;code&gt;Withdrawal&lt;&#x2F;code&gt; data.&lt;&#x2F;p&gt;
&lt;p&gt;For example:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawal_0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;index_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_index_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount_0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawal_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;index_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; validator_index_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; address_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; amount_1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;withdrawal_0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawal_1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This new field is encoded after the existing fields in the execution payload structure and is considered part of the execution payload&#x27;s body.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_body_rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; withdrawals&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;NOTE: the empty list in this schema is due to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt; that sets the &lt;code&gt;ommers&lt;&#x2F;code&gt; value to a fixed constant.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-field-in-the-execution-payload-header-withdrawals-root&quot;&gt;New field in the execution payload header: withdrawals root&lt;&#x2F;h3&gt;
&lt;p&gt;The execution payload header gains a new field committing to the &lt;code&gt;withdrawals&lt;&#x2F;code&gt; in the execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;This commitment is constructed identically to the transactions root in the existing execution payload header by inserting
each withdrawal into a Merkle-Patricia trie keyed by index in the list of &lt;code&gt;withdrawals&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; compute_trie_root_from_indexed_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    trie&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Trie&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; obj&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; obj&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; enumerate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; trie&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compute_trie_root_from_indexed_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The execution payload header is extended with a new field containing the 32 byte root of the trie committing to the list of withdrawals provided in a given execution payload.&lt;&#x2F;p&gt;
&lt;p&gt;To illustrate:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;execution_payload_header_rlp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; RLP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  parent_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  coinbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  txs_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  receipts_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;  0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  extradata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  prev_randao&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0000000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;NOTE: field names and constant value in this example reflect &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;&quot;&gt;EIP-4399&lt;&#x2F;a&gt;. Refer to those EIPs for further information.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-payload-validity&quot;&gt;Execution payload validity&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming the execution payload is well-formatted, the execution client has an additional payload validation to ensure that the &lt;code&gt;withdrawals_root&lt;&#x2F;code&gt; matches the expected value given the list in the payload.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; execution_payload_header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals_root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; compute_trie_root_from_indexed_data&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;execution_payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;withdrawals&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;state-transition&quot;&gt;State transition&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;withdrawals&lt;&#x2F;code&gt; in an execution payload are processed &lt;strong&gt;after&lt;&#x2F;strong&gt; any user-level transactions are applied.&lt;&#x2F;p&gt;
&lt;p&gt;For each &lt;code&gt;withdrawal&lt;&#x2F;code&gt; in the list of &lt;code&gt;execution_payload.withdrawals&lt;&#x2F;code&gt;, the implementation increases the balance of the &lt;code&gt;address&lt;&#x2F;code&gt; specified by the &lt;code&gt;amount&lt;&#x2F;code&gt; given.&lt;&#x2F;p&gt;
&lt;p&gt;Recall that the &lt;code&gt;amount&lt;&#x2F;code&gt; is given in units of Gwei so a conversion to units of wei must be performed when working with account balances in the execution state.&lt;&#x2F;p&gt;
&lt;p&gt;This balance change is unconditional and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not fail.&lt;&#x2F;p&gt;
&lt;p&gt;This operation has no associated gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-a-new-transaction-type&quot;&gt;Why not a new transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP suggests a new type of object -- the &quot;withdrawal operation&quot; -- as it has special semantics different from other existing types of EVM transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Operations are initiated by the overall system, rather than originating from end users like typical transactions.&lt;&#x2F;p&gt;
&lt;p&gt;An entirely new type of object firewalls off generic EVM execution from this type of processing to simplify testing and security review of withdrawals.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-gas-costs-for-the-withdrawal-type&quot;&gt;Why no (gas) costs for the withdrawal type?&lt;&#x2F;h3&gt;
&lt;p&gt;The maximum number of withdrawals that can reach the execution layer at a given time is bounded (enforced by the consensus layer) and this limit has been chosen so that
any execution layer operational costs are negligible in the context of the broader payload execution.&lt;&#x2F;p&gt;
&lt;p&gt;This bound applies to both computational cost (only a few balance updates in the state) and storage&#x2F;networking cost as the additional payload footprint is kept small (current parameterizations put the additional overhead at ~1% of current average payload size).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-only-balance-updates-no-general-evm-execution&quot;&gt;Why only balance updates? No general EVM execution?&lt;&#x2F;h3&gt;
&lt;p&gt;More general processing introduces the risk of failures, which complicates accounting on the beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP suggests a route for withdrawals that provides most of the benefits for a minimum of the (complexity) cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Consensus-layer validation of withdrawal transactions is critical to ensure that the proper amount of ETH is withdrawn back into the execution layer.
This consensus-layer to execution-layer ETH transfer does not have a current analog in the EVM and thus deserves very high security scrutiny.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Beacon chain push withdrawals</title>
        <published>2022-02-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4863/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4863-beacon-chain-push-withdrawals/8465" />
        

        <id>https://wg-eips.ritovision.com/4863/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4863"
            label="EIP-4863" />
        

        
        

        
        <summary type="html">Support validator withdrawals from the beacon chain to the EVM via a new &quot;push-style&quot; transaction type.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4863/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718 transaction type&lt;&#x2F;a&gt; to support validator withdrawals that are &quot;pushed&quot; from the beacon chain to the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;Add block validations to ensure the withdrawal transactions are sound with respect to withdrawal processing on the beacon chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a way for validator withdrawals made on the beacon chain to enter into the EVM.
The architecture is &quot;push&quot;-based, rather than &quot;pull&quot;-based, where withdrawals are required to be processed in the execution block as soon as they are dequeued from the beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This approach is more involved than &quot;pull&quot;-based alternatives (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; + user-space withdrawal contract) with respect to the core protocol (by providing a new transaction type with special semantics) but does provide tighter integration of a critical feature into the protocol itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;constants&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;units&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;byte&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Beginning with the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; introduce the following extensions to transaction processing and block validation:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New transaction type&lt;&#x2F;h3&gt;
&lt;p&gt;Define a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is an RLP-encoded list &lt;code&gt;RLP([index, address, amount])&lt;&#x2F;code&gt; where the &lt;code&gt;index&lt;&#x2F;code&gt; is a 64-bit value uniquely labeling a specific withdrawal, the &lt;code&gt;address&lt;&#x2F;code&gt; refers to an execution layer account and the &lt;code&gt;amount&lt;&#x2F;code&gt; refers to an ether value given in units of wei.&lt;&#x2F;p&gt;
&lt;p&gt;These values are provided by the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validity&quot;&gt;Block validity&lt;&#x2F;h3&gt;
&lt;p&gt;If a block contains &lt;em&gt;any&lt;&#x2F;em&gt; transactions with &lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt; type, they &lt;strong&gt;MUST&lt;&#x2F;strong&gt; come after &lt;strong&gt;ALL&lt;&#x2F;strong&gt; other transactions in the block.&lt;&#x2F;p&gt;
&lt;p&gt;If the execution client receives a block where this is not the case, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; consider the block invalid.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-processing&quot;&gt;Transaction processing&lt;&#x2F;h3&gt;
&lt;p&gt;When processing a transaction with &lt;code&gt;WITHDRAWAL_TX_TYPE&lt;&#x2F;code&gt; type, the implementation should increase the balance of the &lt;code&gt;address&lt;&#x2F;code&gt; specified by
the &lt;code&gt;WithdrawalTransaction&lt;&#x2F;code&gt; by the &lt;code&gt;amount&lt;&#x2F;code&gt; of wei specified.&lt;&#x2F;p&gt;
&lt;p&gt;This balance change is unconditional and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; not fail.&lt;&#x2F;p&gt;
&lt;p&gt;This transaction type has no associated gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: add logs?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;push-vs-pull-approach&quot;&gt;Push vs pull approach&lt;&#x2F;h3&gt;
&lt;p&gt;This push approach gives validators a small subsidy with respect to processing, in lieu of needing to buy gas via normal EVM processing that would be required for a pull-based approach.&lt;&#x2F;p&gt;
&lt;p&gt;This style also happens automatically when the requisite conditions are met on the beacon chain which is nicer UX for validators.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-a-new-transaction-type&quot;&gt;Why a new transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP suggests a new transaction type as it has special semantics different from other existing types of EVM transactions.&lt;&#x2F;p&gt;
&lt;p&gt;An entirely new transaction type firewalls off generic EVM execution from this type of processing to simplify testing and security review of withdrawals.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-no-gas-costs-for-new-transaction-type&quot;&gt;Why no (gas) costs for new transaction type?&lt;&#x2F;h3&gt;
&lt;p&gt;The maximum number of this transaction type that can reach the execution layer at a given time is bounded (enforced by the consensus layer) and this limit is kept small so that
any execution layer operational costs are negligible in the context of the broader block execution.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-only-balance-updates-no-general-evm-execution&quot;&gt;Why only balance updates? No general EVM execution?&lt;&#x2F;h3&gt;
&lt;p&gt;More general processing introduces the risk of failures, which complicates accounting on the beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP suggests a route for withdrawals that provides most of the benefits for a minimum of the (complexity) cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-new-block-validations&quot;&gt;Why new block validations?&lt;&#x2F;h3&gt;
&lt;p&gt;The beacon chain must be able to efficiently validate that the withdrawal transactions in a given execution block are
the ones expected based on its own internal scheduling logic to maintain the soundness of the withdrawal mechanism.&lt;&#x2F;p&gt;
&lt;p&gt;By requiring all withdrawal transactions to be at the back of every block where they are applicable, the algorithm to
check consistency becomes a straightforward linear walk from the start of the set until a known, bounded (small) number.&lt;&#x2F;p&gt;
&lt;p&gt;Having a simple ordering scheme like this facilitates optimizations clients may do with respect to withdrawal processing, which
would be hampered if withdrawal transactions could be placed in the block freely.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Consensus-layer validation of withdrawal transactions is critical to ensure that the proper amount of ETH is withdrawn back into the execution layer.
This consensus-layer to execution-layer ETH transfer does not have a current analog in the EVM and thus deserves very high security scrutiny.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Shard Blob Transactions</title>
        <published>2022-02-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Diederik Loerakker</name><uri>https://github.com/protolambda</uri>
	</author>
	
	<author>
		<name>George Kadianakis</name><uri>https://github.com/asn-d6</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Mofi Taiwo</name><uri>https://github.com/Inphi</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4844/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4844-shard-blob-transactions/8430" />
        

        <id>https://wg-eips.ritovision.com/4844/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4844"
            label="EIP-4844" />
        

        
        

        
        <summary type="html">Shard Blob Transactions scale data-availability of Ethereum in a simple, forwards-compatible manner.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4844/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new transaction format for &quot;blob-carrying transactions&quot; which contain a large amount of data that cannot be
accessed by EVM execution, but whose commitment can be accessed.
The format is intended to be fully compatible with the format that will be used in full sharding.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Rollups are in the short and medium term, and possibly in the long term, the only trustless scaling solution for Ethereum.
Transaction fees on L1 have been very high for months and there is greater urgency in doing anything required to help facilitate an ecosystem-wide move to rollups.
Rollups are significantly reducing fees for many Ethereum users: Optimism and Arbitrum frequently provide fees that are ~3-8x lower than the Ethereum base layer itself,
and ZK rollups, which have better data compression and can avoid including signatures, have fees ~40-100x lower than the base layer.&lt;&#x2F;p&gt;
&lt;p&gt;However, even these fees are too expensive for many users. The long-term solution to the long-term inadequacy of rollups
by themselves has always been data sharding, which would add ~16 MB per block of dedicated data space to the chain that rollups could use.
However, data sharding will still take a considerable amount of time to finish implementing and deploying.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP provides a stop-gap solution until that point by implementing the &lt;em&gt;transaction format&lt;&#x2F;em&gt; that would be used in sharding,
but not actually sharding those transactions. Instead, the data from this transaction format is simply part of the beacon chain and is fully downloaded
by all consensus nodes (but can be deleted after only a relatively short delay).
Compared to full data sharding, this EIP has a reduced cap on the number of these transactions that can be included, corresponding to a target of ~0.375 MB per block and a limit of ~0.75 MB.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x03)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BYTES_PER_FIELD_ELEMENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLS_MODULUS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;52435875175126190479447740508185965837690552500527637822603658699938581184513&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VERSIONED_HASH_VERSION_KZG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x01)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes20(0x0A)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;50000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;786432&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;393216&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3338477&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_PER_BLOB&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**17&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HASH_OPCODE_BYTE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes1(0x49)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HASH_OPCODE_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;4de1d156c78b555421b72d6067c73b614ab55584&#x2F;configs&#x2F;mainnet.yaml#L148&quot;&gt;&lt;code&gt;MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4096&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;type-aliases&quot;&gt;Type aliases&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Base type&lt;&#x2F;th&gt;&lt;th&gt;Additional checks&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Blob&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;ByteVector[BYTES_PER_FIELD_ELEMENT * FIELD_ELEMENTS_PER_BLOB]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VersionedHash&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Perform IETF BLS signature &quot;KeyValidate&quot; check but do allow the identity point&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;KZGProof&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;Bytes48&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Same as for &lt;code&gt;KZGCommitment&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;cryptographic-helpers&quot;&gt;Cryptographic Helpers&lt;&#x2F;h3&gt;
&lt;p&gt;Throughout this proposal we use cryptographic methods and classes defined in the corresponding &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&quot;&gt;consensus 4844 specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Specifically, we use the following methods from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md&quot;&gt;&lt;code&gt;polynomial-commitments.md&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#verify_kzg_proof&quot;&gt;&lt;code&gt;verify_kzg_proof()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;86fb82b221474cc89387fa6436806507b3849d88&#x2F;specs&#x2F;deneb&#x2F;polynomial-commitments.md#verify_blob_kzg_proof_batch&quot;&gt;&lt;code&gt;verify_blob_kzg_proof_batch()&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;helpers&quot;&gt;Helpers&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kzg_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; KZGCommitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; VersionedHash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERSIONED_HASH_VERSION_KZG&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; sha256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Approximates &lt;code&gt;factor * e ** (numerator &#x2F; denominator)&lt;&#x2F;code&gt; using Taylor expansion:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;factor&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; denominator&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; numerator_accum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;numerator_accum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; numerator&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;denominator&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; denominator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;blob-transaction&quot;&gt;Blob transaction&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce a new type of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction, &quot;blob transaction&quot;, where the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; is &lt;code&gt;BLOB_TX_TYPE&lt;&#x2F;code&gt; and the &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is the RLP serialization of the following &lt;code&gt;TransactionPayloadBody&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes, y_parity, r, s]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The fields &lt;code&gt;chain_id&lt;&#x2F;code&gt;, &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;max_priority_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;max_fee_per_gas&lt;&#x2F;code&gt;, &lt;code&gt;gas_limit&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;data&lt;&#x2F;code&gt;, and &lt;code&gt;access_list&lt;&#x2F;code&gt; follow the same semantics as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The field &lt;code&gt;to&lt;&#x2F;code&gt; deviates slightly from the semantics with the exception that it MUST NOT be &lt;code&gt;nil&lt;&#x2F;code&gt; and therefore must always represent a 20-byte address. This means that blob transactions cannot have the form of a create transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The field &lt;code&gt;max_fee_per_blob_gas&lt;&#x2F;code&gt; is a &lt;code&gt;uint256&lt;&#x2F;code&gt; and the field &lt;code&gt;blob_versioned_hashes&lt;&#x2F;code&gt; represents a list of hash outputs from &lt;code&gt;kzg_to_versioned_hash&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;signature&quot;&gt;Signature&lt;&#x2F;h4&gt;
&lt;p&gt;The signature values &lt;code&gt;y_parity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt; are calculated by constructing a secp256k1 signature over the following digest:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;keccak256(BLOB_TX_TYPE || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, to, value, data, access_list, max_fee_per_blob_gas, blob_versioned_hashes]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;header-extension&quot;&gt;Header extension&lt;&#x2F;h3&gt;
&lt;p&gt;The current header encoding is extended with two new 64-bit unsigned integer fields:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;blob_gas_used&lt;&#x2F;code&gt; is the total amount of blob gas consumed by the transactions within the block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; is a running total of blob gas consumed in excess of the target, prior to the block. Blocks with above-target blob gas consumption increase this value, blocks with below-target blob gas consumption decrease it (bounded at 0).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, # ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0, # difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x0000000000000000, # nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The value of &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; can be calculated using the parent header.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For the first post-fork block, both &lt;code&gt;parent.blob_gas_used&lt;&#x2F;code&gt; and &lt;code&gt;parent.excess_blob_gas&lt;&#x2F;code&gt; are evaluated as &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-accounting&quot;&gt;Gas accounting&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce blob gas as a new type of gas. It is independent of normal gas and follows its own targeting rule, similar to EIP-1559.
We use the &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; header field to store persistent data needed to compute the blob gas base fee. For now, only blobs are priced in blob gas.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; calc_blob_fee&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_PER_BLOB&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;header&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fake_exponential&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        MIN_BASE_FEE_PER_BLOB_GAS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The block validity conditions are modified to include blob gas checks (see the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#execution-layer-validation&quot;&gt;Execution layer validation&lt;&#x2F;a&gt; section below).&lt;&#x2F;p&gt;
&lt;p&gt;The actual &lt;code&gt;blob_fee&lt;&#x2F;code&gt; as calculated via &lt;code&gt;calc_blob_fee&lt;&#x2F;code&gt; is deducted from the sender balance before transaction execution and burned, and is not refunded in case of transaction failure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode-to-get-versioned-hashes&quot;&gt;Opcode to get versioned hashes&lt;&#x2F;h3&gt;
&lt;p&gt;We add an instruction &lt;code&gt;BLOBHASH&lt;&#x2F;code&gt; (with opcode &lt;code&gt;HASH_OPCODE_BYTE&lt;&#x2F;code&gt;) which reads &lt;code&gt;index&lt;&#x2F;code&gt; from the top of the stack
as big-endian &lt;code&gt;uint256&lt;&#x2F;code&gt;, and replaces it on the stack with &lt;code&gt;tx.blob_versioned_hashes[index]&lt;&#x2F;code&gt;
if &lt;code&gt;index &amp;lt; len(tx.blob_versioned_hashes)&lt;&#x2F;code&gt;, and otherwise with a zeroed &lt;code&gt;bytes32&lt;&#x2F;code&gt; value.
The opcode has a gas cost of &lt;code&gt;HASH_OPCODE_GAS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;point-evaluation-precompile&quot;&gt;Point evaluation precompile&lt;&#x2F;h3&gt;
&lt;p&gt;Add a precompile at &lt;code&gt;POINT_EVALUATION_PRECOMPILE_ADDRESS&lt;&#x2F;code&gt; that verifies a KZG proof which claims that a blob
(represented by a commitment) evaluates to a given value at a given point.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile costs &lt;code&gt;POINT_EVALUATION_PRECOMPILE_GAS&lt;&#x2F;code&gt; and executes the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; point_evaluation_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Verify p(z) = y given commitment that corresponds to the polynomial p(x) and a KZG proof.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Also verify that the provided commitment matches the provided versioned_hash.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The data is encoded as follows: versioned_hash | z | y | commitment | proof | with z and y being padded 32 byte big endian values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    versioned_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    commitment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;144&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    proof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;144&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;192&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify commitment matches versioned_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; kzg_to_versioned_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; versioned_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Verify KZG proof with z and y in big endian format&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; verify_kzg_proof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;commitment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; y&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; proof&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Return FIELD_ELEMENTS_PER_BLOB and BLS_MODULUS as padded 32 byte big endian values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; Bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FIELD_ELEMENTS_PER_BLOB&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; U256&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;BLS_MODULUS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to_be_bytes32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The precompile MUST reject non-canonical field elements (i.e. provided field elements MUST be strictly less than &lt;code&gt;BLS_MODULUS&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consensus-layer-validation&quot;&gt;Consensus layer validation&lt;&#x2F;h3&gt;
&lt;p&gt;On the consensus layer the blobs are referenced, but not fully encoded, in the beacon block body.
Instead of embedding the full contents in the body, the blobs are propagated separately, as &quot;sidecars&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;This &quot;sidecar&quot; design provides forward compatibility for further data increases by black-boxing &lt;code&gt;is_data_available()&lt;&#x2F;code&gt;:
with full sharding &lt;code&gt;is_data_available()&lt;&#x2F;code&gt; can be replaced by data-availability-sampling (DAS) thus avoiding all blobs being downloaded by all beacon nodes on the network.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the consensus layer is tasked with persisting the blobs for data availability, the execution layer is not.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; repository defines the following consensus layer changes involved in this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Beacon chain: process updated beacon blocks and ensure blobs are available.&lt;&#x2F;li&gt;
&lt;li&gt;P2P network: gossip and sync updated beacon block types and new blob sidecars.&lt;&#x2F;li&gt;
&lt;li&gt;Honest validator: produce beacon blocks with blobs; sign and publish the associated blob sidecars.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution-layer-validation&quot;&gt;Execution layer validation&lt;&#x2F;h3&gt;
&lt;p&gt;On the execution layer, the block validity conditions are extended as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check that the excess blob gas was updated correctly&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;excess_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; calc_excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; modify the check for sufficient balance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        max_total_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; get_tx_type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            max_total_fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; max_total_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; add validity logic specific to blob txs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; get_tx_type&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOB_TX_TYPE&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; there must be at least one blob&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; all versioned blob hashes must start with VERSIONED_HASH_VERSION_KZG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_versioned_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                assert&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERSIONED_HASH_VERSION_KZG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure that the user was willing to at least pay the current blob base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; get_base_fee_per_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keep track of total blob gas spent in the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; get_total_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure the total blob gas spent is at most equal to the limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure blob_gas_used matches header&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;blob_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; blob_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;networking&quot;&gt;Networking&lt;&#x2F;h3&gt;
&lt;p&gt;Blob transactions have two network representations. During transaction gossip responses (&lt;code&gt;PooledTransactions&lt;&#x2F;code&gt;), the EIP-2718 &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; of the blob transaction is wrapped to become:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp([tx_payload_body, blobs, commitments, proofs])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each of these elements are defined as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; - is the &lt;code&gt;TransactionPayloadBody&lt;&#x2F;code&gt; of standard EIP-2718 &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4844&#x2F;#blob-transaction&quot;&gt;blob transaction&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;blobs&lt;&#x2F;code&gt; - list of &lt;code&gt;Blob&lt;&#x2F;code&gt; items&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;commitments&lt;&#x2F;code&gt; - list of &lt;code&gt;KZGCommitment&lt;&#x2F;code&gt; of the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;proofs&lt;&#x2F;code&gt; - list of &lt;code&gt;KZGProof&lt;&#x2F;code&gt; of the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;commitments&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The node MUST validate &lt;code&gt;tx_payload_body&lt;&#x2F;code&gt; and verify the wrapped data against it. To do so, ensure that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;There are an equal number of &lt;code&gt;tx_payload_body.blob_versioned_hashes&lt;&#x2F;code&gt;, &lt;code&gt;blobs&lt;&#x2F;code&gt;, &lt;code&gt;commitments&lt;&#x2F;code&gt;, and &lt;code&gt;proofs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; hash to the versioned hashes, i.e. &lt;code&gt;kzg_to_versioned_hash(commitments[i]) == tx_payload_body.blob_versioned_hashes[i]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The KZG &lt;code&gt;commitments&lt;&#x2F;code&gt; match the corresponding &lt;code&gt;blobs&lt;&#x2F;code&gt; and &lt;code&gt;proofs&lt;&#x2F;code&gt;. (Note: this can be optimized using &lt;code&gt;verify_blob_kzg_proof_batch&lt;&#x2F;code&gt;, with a proof for a
random evaluation at a point derived from the commitment and blob data for each blob)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For body retrieval responses (&lt;code&gt;BlockBodies&lt;&#x2F;code&gt;), the standard EIP-2718 blob transaction &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is used.&lt;&#x2F;p&gt;
&lt;p&gt;Nodes MUST NOT automatically broadcast blob transactions to their peers.
Instead, those transactions are only announced using &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; messages, and can then be manually requested via &lt;code&gt;GetPooledTransactions&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;on-the-path-to-sharding&quot;&gt;On the path to sharding&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces blob transactions in the same format in which they are expected to exist in the final sharding specification.
This provides a temporary but significant scaling relief for rollups by allowing them to initially scale to 0.375 MB per slot,
with a separate fee market allowing fees to be very low while usage of this system is limited.&lt;&#x2F;p&gt;
&lt;p&gt;The core goal of rollup scaling stopgaps is to provide temporary scaling relief,
without imposing extra development burdens on rollups to take advantage of this relief.
Today, rollups use calldata. In the future, rollups will have no choice but to use sharded data (also called &quot;blobs&quot;)
because sharded data will be much cheaper.
Hence, rollups cannot avoid making a large upgrade to how they process data at least once along the way.
But what we &lt;em&gt;can&lt;&#x2F;em&gt; do is ensure that rollups need to &lt;em&gt;only&lt;&#x2F;em&gt; upgrade once.
This immediately implies that there are exactly two possibilities for a stopgap: (i) reducing the gas costs of existing calldata,
and (ii) bringing forward the format that will be used for sharded data, but not yet actually sharding it.
Previous EIPs were all a solution of category (i); this EIP is a solution of category (ii).&lt;&#x2F;p&gt;
&lt;p&gt;The main tradeoff in designing this EIP is that of implementing more now versus having to implement more later:
do we implement 25% of the work on the way to full sharding, or 50%, or 75%?&lt;&#x2F;p&gt;
&lt;p&gt;The work that is already done in this EIP includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A new transaction type, of the exact same format that will need to exist in &quot;full sharding&quot;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;All&lt;&#x2F;em&gt; of the execution-layer logic required for full sharding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;All&lt;&#x2F;em&gt; of the execution &#x2F; consensus cross-verification logic required for full sharding&lt;&#x2F;li&gt;
&lt;li&gt;Layer separation between &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt; verification and data availability sampling blobs&lt;&#x2F;li&gt;
&lt;li&gt;Most of the &lt;code&gt;BeaconBlock&lt;&#x2F;code&gt; logic required for full sharding&lt;&#x2F;li&gt;
&lt;li&gt;A self-adjusting independent base fee for blobs&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The work that remains to be done to get to full sharding includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A low-degree extension of the &lt;code&gt;commitments&lt;&#x2F;code&gt; in the consensus layer to allow 2D sampling&lt;&#x2F;li&gt;
&lt;li&gt;An actual implementation of data availability sampling&lt;&#x2F;li&gt;
&lt;li&gt;PBS (proposer&#x2F;builder separation), to avoid requiring individual validators to process 32 MB of data in one slot&lt;&#x2F;li&gt;
&lt;li&gt;Proof of custody or similar in-protocol requirement for each validator to verify a particular part of the sharded data in each block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP also sets the stage for longer-term protocol cleanups. For example, its (cleaner) gas base fee update rule could be applied to the primary basefee calculation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-rollups-would-function&quot;&gt;How rollups would function&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of putting rollup block data in transaction calldata, rollups would expect rollup block submitters
to put the data into blobs. This guarantees availability (which is what rollups need) but would be much cheaper than calldata.
Rollups need data to be available once, long enough to ensure honest actors can construct the rollup state, but not forever.&lt;&#x2F;p&gt;
&lt;p&gt;Optimistic rollups only need to actually provide the underlying data when fraud proofs are being submitted.
The fraud proof can verify the transition in smaller steps, loading at most a few values of the blob at a time through calldata.
For each value it would provide a KZG proof and use the point evaluation precompile to verify the value against the versioned hash that was submitted before,
and then perform the fraud proof verification on that data as is done today.&lt;&#x2F;p&gt;
&lt;p&gt;ZK rollups would provide two commitments to their transaction or state delta data:
the blob commitment (which the protocol ensures points to available data) and the ZK rollup&#x27;s own commitment using whatever proof system the rollup uses internally.
They would use a proof of equivalence protocol, using the point evaluation precompile,
to prove that the two commitments refer to the same data.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;versioned-hashes-precompile-return-data&quot;&gt;Versioned hashes &amp;amp; precompile return data&lt;&#x2F;h3&gt;
&lt;p&gt;We use versioned hashes (rather than commitments) as references to blobs in the execution layer to ensure forward compatibility with future changes.
For example, if we need to switch to Merkle trees + STARKs for quantum-safety reasons, then we would add a new version,
allowing the point evaluation precompile to work with the new format.
Rollups would not have to make any EVM-level changes to how they work;
sequencers would simply have to switch over to using a new transaction type at the appropriate time.&lt;&#x2F;p&gt;
&lt;p&gt;However, the point evaluation happens inside a finite field, and it is only well defined if the field modulus is known. Smart contracts could contain a table mapping the commitment version to a modulus, but this would not allow smart contract to take into account future upgrades to a modulus that is not known yet. By allowing access to the modulus inside the EVM, the smart contract can be built so that it can use future commitments and proofs, without ever needing an upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;In the interest of not adding another precompile, we return the modulus and the polynomial degree directly from the point evaluation precompile. It can then be used by the caller. It is also &quot;free&quot; in that the caller can just ignore this part of the return value without incurring an extra cost -- systems that remain upgradable for the foreseeable future will likely use this route for now.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-fee-per-blob-gas-update-rule&quot;&gt;Base fee per blob gas update rule&lt;&#x2F;h3&gt;
&lt;p&gt;The base fee per blob gas update rule is intended to approximate the formula &lt;code&gt;base_fee_per_blob_gas = MIN_BASE_FEE_PER_BLOB_GAS * e**(excess_blob_gas &#x2F; BLOB_BASE_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;,
where &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; is the total &quot;extra&quot; amount of blob gas that the chain has consumed relative to the &quot;targeted&quot; number (&lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; per block).
Like EIP-1559, it&#x27;s a self-correcting formula: as the excess goes higher, the &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; increases exponentially, reducing usage and eventually forcing the excess back down.&lt;&#x2F;p&gt;
&lt;p&gt;The block-by-block behavior is roughly as follows.
If block &lt;code&gt;N&lt;&#x2F;code&gt; consumes &lt;code&gt;X&lt;&#x2F;code&gt; blob gas, then in block &lt;code&gt;N+1&lt;&#x2F;code&gt; &lt;code&gt;excess_blob_gas&lt;&#x2F;code&gt; increases by &lt;code&gt;X - TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt;,
and so the &lt;code&gt;base_fee_per_blob_gas&lt;&#x2F;code&gt; of block &lt;code&gt;N+1&lt;&#x2F;code&gt; increases by a factor of &lt;code&gt;e**((X - TARGET_BLOB_GAS_PER_BLOCK) &#x2F; BLOB_BASE_FEE_UPDATE_FRACTION)&lt;&#x2F;code&gt;.
Hence, it has a similar effect to the existing EIP-1559, but is more &quot;stable&quot; in the sense that it responds in the same way to the same total usage regardless of how it&#x27;s distributed.&lt;&#x2F;p&gt;
&lt;p&gt;The parameter &lt;code&gt;BLOB_BASE_FEE_UPDATE_FRACTION&lt;&#x2F;code&gt; controls the maximum rate of change of the base fee per blob gas. It is chosen to target a maximum change rate of &lt;code&gt;e**(TARGET_BLOB_GAS_PER_BLOCK &#x2F; BLOB_BASE_FEE_UPDATE_FRACTION) ≈ 1.125&lt;&#x2F;code&gt; per block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throughput&quot;&gt;Throughput&lt;&#x2F;h3&gt;
&lt;p&gt;The values for &lt;code&gt;TARGET_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; and &lt;code&gt;MAX_BLOB_GAS_PER_BLOCK&lt;&#x2F;code&gt; are chosen to correspond to a target of 3 blobs (0.375 MB) and maximum of 6 blobs (0.75 MB) per block. These small initial limits are intended to minimize the strain on the network created by this EIP and are expected to be increased in future upgrades as the network demonstrates reliability under larger blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blob-non-accessibility&quot;&gt;Blob non-accessibility&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP introduces a transaction type that has a distinct mempool version and execution-payload version,
with only one-way convertibility between the two. The blobs are in the network representation and not in the consensus representation;
instead, they are coupled with the beacon block. This means that there is now a part of a transaction that will not be accessible from the web3 API.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mempool-issues&quot;&gt;Mempool issues&lt;&#x2F;h3&gt;
&lt;p&gt;Blob transactions have a large data size at the mempool layer, which poses a mempool DoS risk,
though not an unprecedented one as this also applies to transactions with large amounts of calldata.&lt;&#x2F;p&gt;
&lt;p&gt;By only broadcasting announcements for blob transactions, receiving nodes will have control over which and how many transactions to receive,
allowing them to throttle throughput to an acceptable level.
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5793&#x2F;&quot;&gt;EIP-5793&lt;&#x2F;a&gt; will give further fine-grained control to nodes by extending the &lt;code&gt;NewPooledTransactionHashes&lt;&#x2F;code&gt; announcement messages to include the transaction type and size.&lt;&#x2F;p&gt;
&lt;p&gt;In addition, we recommend including a 1.1x base fee per blob gas bump requirement to the mempool transaction replacement rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Execution layer test cases for this EIP can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip4844_blobs&quot;&gt;&lt;code&gt;eip4844_blobs&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; of the &lt;code&gt;ethereum&#x2F;execution-spec-tests&lt;&#x2F;code&gt; repository. Consensus layer test cases can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;tree&#x2F;2297c09b7e457a13f7b2261a28cb45777be82f83&#x2F;tests&#x2F;core&#x2F;pyspec&#x2F;eth2spec&#x2F;test&#x2F;deneb&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP increases the bandwidth requirements per beacon block by a maximum of ~0.75 MB.
This is 40% larger than the theoretical maximum size of a block today (30M gas &#x2F; 16 gas per calldata byte = 1.875M bytes), and so it will not greatly increase worst-case bandwidth.
Post-merge, block times are static rather than an unpredictable Poisson distribution, giving a guaranteed period of time for large blocks to propagate.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;sustained&lt;&#x2F;em&gt; load of this EIP is much lower than alternatives that reduce calldata costs, even if the calldata is limited,
because there is no expectation that the blobs need to be stored for as long as an execution payload.
This makes it possible to implement a policy that these blobs must be kept for at least a certain period. The specific value chosen is &lt;code&gt;MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS&lt;&#x2F;code&gt; epochs, which is around 18 days,
a much shorter delay compared to proposed (but yet to be implemented) one-year rotation times for execution payload history.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Beacon block root in the EVM</title>
        <published>2022-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4788/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4788-beacon-root-in-evm/8281" />
        

        <id>https://wg-eips.ritovision.com/4788/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4788"
            label="EIP-4788" />
        

        
        

        
        <summary type="html">Expose beacon chain roots in the EVM</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4788/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Commit to the hash tree root of each beacon chain block in the corresponding execution payload header.&lt;&#x2F;p&gt;
&lt;p&gt;Store each of these roots in a smart contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Roots of the beacon chain blocks are cryptographic accumulators that allow proofs of arbitrary consensus state.
Exposing these roots inside the EVM allows for trust-minimized access to the consensus layer.
This functionality supports a wide variety of use cases that improve trust assumptions of staking pools,
restaking constructions, smart contract bridges, MEV mitigations and more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;constants&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1710338135&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;8191&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;The high-level idea is that each execution block contains the parent beacon block&#x27;s root. Even in the event of missed slots since the previous block root does not change,
we only need a constant amount of space to represent this &quot;oracle&quot; in each execution block. To improve the usability of this oracle, a small history of block roots
are stored in the contract.&lt;&#x2F;p&gt;
&lt;p&gt;To bound the amount of storage this construction consumes, a ring buffer is used that mirrors a block root accumulator on the consensus layer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-structure-and-validity&quot;&gt;Block structure and validity&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning at the execution timestamp &lt;code&gt;FORK_TIMESTAMP&lt;&#x2F;code&gt;, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; extend the header schema with an additional field: the &lt;code&gt;parent_beacon_block_root&lt;&#x2F;code&gt;.
This root consumes 32 bytes and is exactly the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;fa09d896484bbe240334fa21ffaa454bafe5842e&#x2F;ssz&#x2F;simple-serialize.md#merkleization&quot;&gt;hash tree root&lt;&#x2F;a&gt; of the parent beacon block for the given execution block.&lt;&#x2F;p&gt;
&lt;p&gt;The resulting RLP encoding of the header is therefore:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rlp&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ommers hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coinbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    state_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    txs_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    receipts_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    number&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extradata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    prev_randao&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0000000000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    withdrawals_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blob_gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    excess_blob_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    parent_beacon_block_root&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Validity of the parent beacon block root is guaranteed from the consensus layer, much like how withdrawals are handled.&lt;&#x2F;p&gt;
&lt;p&gt;When verifying a block, execution clients &lt;strong&gt;MUST&lt;&#x2F;strong&gt; ensure the root value in the block header matches the one provided by the consensus client.&lt;&#x2F;p&gt;
&lt;p&gt;For a genesis block with no existing parent beacon block root the 32 zero bytes are used as a root placeholder.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;beacon-roots-contract&quot;&gt;Beacon roots contract&lt;&#x2F;h4&gt;
&lt;p&gt;The beacon roots contract has two operations: &lt;code&gt;get&lt;&#x2F;code&gt; and &lt;code&gt;set&lt;&#x2F;code&gt;. The input itself is not used to determine which function to execute, for that the result of &lt;code&gt;caller&lt;&#x2F;code&gt; is used. If &lt;code&gt;caller&lt;&#x2F;code&gt; is equal to &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; then the operation to perform is &lt;code&gt;set&lt;&#x2F;code&gt;. Otherwise, &lt;code&gt;get&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;get&quot;&gt;&lt;code&gt;get&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;Callers provide the &lt;code&gt;timestamp&lt;&#x2F;code&gt; they are querying encoded as 32 bytes in big-endian format.&lt;&#x2F;li&gt;
&lt;li&gt;If the input is not exactly 32 bytes, the contract must revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the input is equal to 0, the contract must revert.&lt;&#x2F;li&gt;
&lt;li&gt;Given &lt;code&gt;timestamp&lt;&#x2F;code&gt;, the contract computes the storage index in which the timestamp is stored by computing the modulo &lt;code&gt;timestamp % HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; and reads the value.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;timestamp&lt;&#x2F;code&gt; does not match, the contract must revert.&lt;&#x2F;li&gt;
&lt;li&gt;Finally, the beacon root associated with the timestamp is returned to the user. It is stored at &lt;code&gt;timestamp % HISTORY_BUFFER_LENGTH + HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;set&quot;&gt;&lt;code&gt;set&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;ul&gt;
&lt;li&gt;Caller provides the parent beacon block root as calldata to the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Set the storage value at &lt;code&gt;header.timestamp % HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; to be &lt;code&gt;header.timestamp&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set the storage value at &lt;code&gt;header.timestamp % HISTORY_BUFFER_LENGTH + HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; to be &lt;code&gt;calldata[0:32]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;pseudocode&quot;&gt;Pseudocode&lt;&#x2F;h5&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; SYSTEM_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; to_uint256_be&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_uint256_be&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp_idx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root_idx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; to_uint256_be&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    root_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; timestamp_idx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_BUFFER_LENGTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    storage&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;root_idx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;calldata&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h5&gt;
&lt;p&gt;The exact contract bytecode is shared below.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;asm&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x4d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;iszero&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x3c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push3 &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0x001fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;add&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h4&gt;
&lt;p&gt;The beacon roots contract is deployed like any other smart contract. A special synthetic address is generated
by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60618060095f395ff33373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b9b6eb1f0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xdf52c2d3bbe38820fff7b5eaab3db1b91f8e1412b56497d88388fb5d4ea1fde0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note, the input in the transaction has a simple constructor prefixing the desired runtime code.&lt;&#x2F;p&gt;
&lt;p&gt;The sender of the transaction can be calculated as &lt;code&gt;0x0B799C86a49DEeb90402691F1041aa3AF2d3C875&lt;&#x2F;code&gt;. The address of the first contract deployed from the account is &lt;code&gt;rlp([sender, 0])&lt;&#x2F;code&gt; which equals &lt;code&gt;0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02&lt;&#x2F;code&gt;. This is how &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt; is determined. Although this style of contract creation is not tied to any specific initcode like create2 is, the synthetic address is cryptographically bound to the input data of the transaction (e.g. the initcode).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h3&gt;
&lt;p&gt;At the start of processing any execution block where &lt;code&gt;block.timestamp &amp;gt;= FORK_TIMESTAMP&lt;&#x2F;code&gt; (i.e. before processing any transactions), call &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with the 32-byte input of &lt;code&gt;header.parent_beacon_block_root&lt;&#x2F;code&gt;, a gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;, and &lt;code&gt;0&lt;&#x2F;code&gt; value. This will trigger the &lt;code&gt;set()&lt;&#x2F;code&gt; routine of the beacon roots contract. This is a system operation and therefore:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the call must execute to completion&lt;&#x2F;li&gt;
&lt;li&gt;the call does not count against the block&#x27;s gas limit&lt;&#x2F;li&gt;
&lt;li&gt;the call does not follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; burn semantics - no value should be transferred as part of the call&lt;&#x2F;li&gt;
&lt;li&gt;if no code exists at &lt;code&gt;BEACON_ROOTS_ADDRESS&lt;&#x2F;code&gt;, the call must fail silently&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Clients may decide to omit an explicit EVM call and directly set the storage values. Note: While this is a valid optimization for Ethereum mainnet, it could be problematic on non-mainnet situations in case a different contract is used.&lt;&#x2F;p&gt;
&lt;p&gt;If this EIP is active in a genesis block, the genesis header&#x27;s &lt;code&gt;parent_beacon_block_root&lt;&#x2F;code&gt; must be &lt;code&gt;0x0&lt;&#x2F;code&gt; and no system transaction may occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-not-repurpose-blockhash&quot;&gt;Why not repurpose &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode could be repurposed to provide the beacon root instead of some execution block hash.
To minimize code change, avoid breaking changes to smart contracts, and simplify deployment to mainnet, this EIP suggests leaving &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; alone and adding new
functionality with the desired semantics.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;beacon-block-root-instead-of-state-root&quot;&gt;Beacon block root instead of state root&lt;&#x2F;h3&gt;
&lt;p&gt;Block roots are preferred over state roots so there is a constant amount of work to do with each new execution block. Otherwise, skipped slots would require
a linear amount of work with each new payload. While skipped slots are quite rare on mainnet, it is best to not add additional load under what would already
be nonfavorable conditions.&lt;&#x2F;p&gt;
&lt;p&gt;Use of block root over state root does mean proofs will require a few additional nodes but this cost is negligible (and could be amortized across all consumers,
e.g. with a singleton state root contract that caches the proof per slot).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-two-ring-buffers&quot;&gt;Why two ring buffers?&lt;&#x2F;h3&gt;
&lt;p&gt;The first ring buffer only tracks &lt;code&gt;HISTORY_BUFFER_LENGTH&lt;&#x2F;code&gt; worth of roots and so for all possible timestamp values would consume a constant amount of storage.
However, this design opens the contract to an attack where a skipped slot that has the same value modulo the ring buffer length would return an old root value,
rather than the most recent one.&lt;&#x2F;p&gt;
&lt;p&gt;To nullify this attack while retaining a fixed memory footprint, this EIP keeps track of the pair of data &lt;code&gt;(parent_beacon_block_root, timestamp)&lt;&#x2F;code&gt; for each index into the
ring buffer and verifies the timestamp matches the one originally used to write the root data when being read. Given the fixed size of storage slots (only 32 bytes), the requirement
to store a pair of values necessitates two ring buffers, rather than just one.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-ring-buffers&quot;&gt;Size of ring buffers&lt;&#x2F;h3&gt;
&lt;p&gt;The ring buffer data structures are sized to hold 8191 roots from the consensus layer. Using a prime number as the ring buffer size ensures that no value is overwritten until the entire ring buffer has been saturated and thereafter, each value will be updated once per iteration. This also means that even if the slot times were to change, we would continue to use at most 8191 storage slots.&lt;&#x2F;p&gt;
&lt;p&gt;Given the current mainnet values, 8191 roots provides about a day of coverage. This gives users plenty of time to make a transaction with a verification against a specific root and get the transaction included on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deactivate SELFDESTRUCT</title>
        <published>2022-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4758/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4758-deactivate-selfdestruct/8710" />
        

        <id>https://wg-eips.ritovision.com/4758/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4758"
            label="EIP-4758" />
        

        
        

        
        <summary type="html">Deactivate SELFDESTRUCT by changing it to SENDALL, which does recover all funds to the caller but does not delete any code or storage.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4758/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP renames the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and replaces its functionality. The new functionality will be only to send all Ether in the account to the caller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode requires large changes to the state of an account, in particular removing all code and storage. This will not be possible in the future with Verkle trees: Each account will be stored in many different account keys, which will not be obviously connected to the root account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP implements this change. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to retrieve funds will still work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode is renamed to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and now only immediately moves all ETH in the account to the target; it no longer destroys code or storage or alters the nonce&lt;&#x2F;li&gt;
&lt;li&gt;All refunds related to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; are removed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Getting rid of the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode has been considered in the past, and there are currently no strong reasons to use it. Disabling it will be a requirement for statelessness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Few applications are affected by this change. The only use that breaks is where a contract is re-created at the same address using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (after a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following applications of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be broken and applications that use it in this way are not safe anymore:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Any use where &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used to burn non-ETH token balances, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt;), inside a contract. We do not know of any such use (since it can easily be done by sending to a burn address this seems an unlikely way to use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Where &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is used to redeploy a contract in the same place. There are two ways in which this can fail:
&lt;ul&gt;
&lt;li&gt;The destruction prevents the contract from being used outside of a certain context. For example, the contract allows anyone to withdraw funds, but &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used at the end of an operation to prevent others from doing this. This type of operation can easily be modified to not depend on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; operation is used in order to make a contract upgradable. This is not supported anymore and delegates should be used.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SELFDESTRUCT bomb</title>
        <published>2022-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4760/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4760-selfdestruct-bomb/8713" />
        

        <id>https://wg-eips.ritovision.com/4760/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4760"
            label="EIP-4760" />
        

        
        

        
        <summary type="html">Deactivate SELFDESTRUCT by changing it to SENDALL and stage this via a stage of exponential gas cost increases.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4760/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP renames the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and replaces its functionality. The new functionality will be only to send all Ether in the account to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;In order to give apps more warning even if their developers are completely unaware of the EIP process, this version will exponentially increase the gas costs of the opcode, so any developer has time to see this change and react by implementing a version of their contract that does not rely on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode requires large changes to the state of an account, in particular removing all code and storage. This will not be possible in the future with Verkle trees: Each account will be stored in many different account keys, which will not be obviously connected to the root account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP implements this change. Applications that only use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to retrieve funds will still work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;OLD_SELFDESTRUCT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;Current gas cost of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HARD_FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;td&gt;(Shanghai HF block height)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOUBLING_SLOTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2**16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;(Time for gas price to double, ca. 9 days)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;13&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be converted to &lt;code&gt;SENDALL&lt;&#x2F;code&gt; at &lt;code&gt;HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;HARD_FORK_BLOCK &amp;lt;= slot &amp;lt; HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; functionality remains unchanged&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; gas cost is now &lt;code&gt;OLD_SELFDESTRUCT_COST * 2 ** ((slot - HARD_FORK_BLOCK) &#x2F;&#x2F; DOUBLING_SLOTS)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;For &lt;code&gt;slot &amp;gt;= HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The cost reverts back to &lt;code&gt;OLD_SELFDESTRUCT_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode is renamed to &lt;code&gt;SENDALL&lt;&#x2F;code&gt;, and now only immediately moves all ETH in the account to the target; it no longer destroys code or storage or alters the nonce&lt;&#x2F;li&gt;
&lt;li&gt;All refunds related to &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; are removed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The idea behind this EIP is to disable &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; in a way that gives ample warning to Dapp developers. Many developers do not watch the EIP process closely and can therefore be caught by surprise when an opcode is deactivated and does not fulfill its original purpose anymore. However, at least if the smart contract has regular use, then users will notice the price of the operation going up tremendously. The period over which this is happening (&lt;code&gt;HARD_FORK_BLOCK + DOUBLING_SLOTS * DOUBLINGS_BEFORE_SENDALL&lt;&#x2F;code&gt;) is chosen to be long enough (ca. 4 months) such that it gives developers time to react to this change and prepare their application.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Few applications are affected by this change. The only use that breaks is where a contract is re-created at the same address using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (after a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;). The only application that is significantly affected (and where code can be analyzed) is able to switch to a different model, and should have ample time to do so.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The following applications of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; will be broken and applications that use it in this way are not safe anymore:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Any use where &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used to burn non-ETH token balances, such as ERC20, inside a contract. We do not know of any such use (since it can easily be done by sending to a burn address this seems an unlikely way to use &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Where &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is used to redeploy a contract in the same place. There are two ways in which this can fail:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The destruction prevents the contract from being used outside of a certain context. For example, the contract allows anyone to withdraw funds, but &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is used at the end of an operation to prevent others from doing this. This type of operation can easily be modified to not depend on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; operation is used in order to make a contract upgradable. This is not supported anymore and delegates should be used.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Statelessness gas cost changes</title>
        <published>2022-02-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4762/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4762-statelessness-gas-cost-changes/8714" />
        

        <id>https://wg-eips.ritovision.com/4762/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4762"
            label="EIP-4762" />
        

        
        

        
        <summary type="html">Changes the gas schedule to reflect the costs of creating a witness by requiring clients update their database layout to match.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4762/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces changes in the gas schedule to reflect the costs of creating a witness. It requires clients to update their database layout to match this, so as to avoid potential DoS attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The introduction of Verkle trees into Ethereum requires fundamental changes and as a preparation, this EIP is targeting the fork coming right before the verkle tree fork, in order to incentivize Dapp developers to adopt the new storage model, and ample time to adjust to it. It also incentivizes client developers to migrate their database format ahead of the verkle fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;helper-functions&quot;&gt;Helper functions&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get_storage_slot_tree_keys&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;storage_key&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HEADER_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAIN_STORAGE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storage_key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;access-events&quot;&gt;Access events&lt;&#x2F;h3&gt;
&lt;p&gt;Whenever the state is read, one or more of the access events of the form &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; take place, determining what data is being accessed. We define access events as follows:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;access-events-for-account-headers&quot;&gt;Access events for account headers&lt;&#x2F;h4&gt;
&lt;p&gt;When:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;a non-precompile which is also not a system contract is the target of a &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, or &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; opcode,&lt;&#x2F;li&gt;
&lt;li&gt;a non-precompile which is also not a system contract is the target address of a contract creation whose initcode starts execution,&lt;&#x2F;li&gt;
&lt;li&gt;any address is the target of the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode&lt;&#x2F;li&gt;
&lt;li&gt;a &lt;em&gt;deployed&lt;&#x2F;em&gt; contract calls &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;process this access event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: a non-value-bearing &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;*CALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, targeting a precompile or a system contract, will not cause the &lt;code&gt;BASIC_DATA_LEAF_KEY&lt;&#x2F;code&gt; to be added to the witness.&lt;&#x2F;p&gt;
&lt;p&gt;If a &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is value-bearing (ie. it transfers nonzero wei), whether or not the &lt;code&gt;callee&lt;&#x2F;code&gt; is a precompile or a system contract, process this additional access event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(caller, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: when checking for the existence of the &lt;code&gt;callee&lt;&#x2F;code&gt;, the existence check is done by validating that there is an extension-and-suffix tree at the corresponding stem, and does not rely on &lt;code&gt;CODEHASH_LEAF_KEY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When calling &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, process the access event:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that precompiles and system contracts are excluded, as their hashes are known to the client.&lt;&#x2F;p&gt;
&lt;p&gt;When a contract is created, process these access events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;access-events-for-storage&quot;&gt;Access events for storage&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcodes with a given address and key process an access event of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, tree_key, sub_key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;tree_key&lt;&#x2F;code&gt; and &lt;code&gt;sub_key&lt;&#x2F;code&gt; are computed as &lt;code&gt;tree_key, sub_key = get_storage_slot_tree_keys(key)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;access-events-for-code&quot;&gt;Access events for code&lt;&#x2F;h4&gt;
&lt;p&gt;In the conditions below, “chunk chunk_id is accessed” is understood to mean an access event of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, (chunk_id + 128) &#x2F;&#x2F; 256, (chunk_id + 128) % 256)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;At each step of EVM execution, if and only if &lt;code&gt;PC &amp;lt; len(code)&lt;&#x2F;code&gt;, chunk &lt;code&gt;PC &#x2F;&#x2F; CHUNK_SIZE&lt;&#x2F;code&gt; (where &lt;code&gt;PC&lt;&#x2F;code&gt; is the current program counter) of the callee is accessed. In particular, note the following corner cases:
&lt;ul&gt;
&lt;li&gt;The destination of a &lt;code&gt;JUMP&lt;&#x2F;code&gt; (or positively evaluated &lt;code&gt;JUMPI&lt;&#x2F;code&gt;) is considered to be accessed, even if the destination is not a jumpdest or is inside pushdata&lt;&#x2F;li&gt;
&lt;li&gt;The destination of a &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is not considered to be accessed if the jump conditional is &lt;code&gt;false&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The destination of a jump is not considered to be accessed if the execution gets to the jump opcode but does not have enough gas to pay for the gas cost of executing the &lt;code&gt;JUMP&lt;&#x2F;code&gt; opcode (including chunk access cost if the &lt;code&gt;JUMP&lt;&#x2F;code&gt; is the first opcode in a not-yet-accessed chunk)&lt;&#x2F;li&gt;
&lt;li&gt;The destination of a jump is not considered to be accessed if it is beyond the code (&lt;code&gt;destination &amp;gt;= len(code)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If code stops execution by walking past the end of the code, &lt;code&gt;PC = len(code)&lt;&#x2F;code&gt; is not considered to be accessed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the current step of EVM execution is a &lt;code&gt;PUSH{n}&lt;&#x2F;code&gt;, all chunks &lt;code&gt;(PC &#x2F;&#x2F; CHUNK_SIZE) &amp;lt;= chunk_index &amp;lt;= ((PC + n) &#x2F;&#x2F; CHUNK_SIZE)&lt;&#x2F;code&gt; of the callee are accessed.&lt;&#x2F;li&gt;
&lt;li&gt;If a nonzero-read-size &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; or &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; read bytes &lt;code&gt;x...y&lt;&#x2F;code&gt; inclusive, all chunks &lt;code&gt;(x &#x2F;&#x2F; CHUNK_SIZE) &amp;lt;= chunk_index &amp;lt;= (min(y, code_size - 1) &#x2F;&#x2F; CHUNK_SIZE)&lt;&#x2F;code&gt; of the accessed contract are accessed.
&lt;ul&gt;
&lt;li&gt;Example 1: for a &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; with start position 100, read size 50, &lt;code&gt;code_size = 200&lt;&#x2F;code&gt;, &lt;code&gt;x = 100&lt;&#x2F;code&gt; and &lt;code&gt;y = 149&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Example 2: for a &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; with start position 600, read size 0, no chunks are accessed&lt;&#x2F;li&gt;
&lt;li&gt;Example 3: for a &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; with start position 1500, read size 2000, &lt;code&gt;code_size = 3100&lt;&#x2F;code&gt;, &lt;code&gt;x = 1500&lt;&#x2F;code&gt; and &lt;code&gt;y = 3099&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; do NOT access any chunks.
When a contract is created, access chunks &lt;code&gt;0 ... (len(code)+30)&#x2F;&#x2F;31&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;write-events&quot;&gt;Write Events&lt;&#x2F;h3&gt;
&lt;p&gt;We define &lt;strong&gt;write events&lt;&#x2F;strong&gt; as follows. Note that when a write takes place, an access event also takes place (so the definition below should be a subset of the definition of access events). A write event is of the form &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt;, determining what data is being written to.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;write-events-for-account-headers&quot;&gt;Write events for account headers&lt;&#x2F;h4&gt;
&lt;p&gt;When a nonzero-balance-sending &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with a given sender and recipient takes place, process these write events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(caller, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(callee, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;if no account exists at &lt;code&gt;callee_address&lt;&#x2F;code&gt;, also process:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(callee, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When a contract creation is initialized, process these write events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(contract_address, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;write-events-for-storage&quot;&gt;Write events for storage&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcodes with a given &lt;code&gt;address&lt;&#x2F;code&gt; and &lt;code&gt;key&lt;&#x2F;code&gt; process a write event of the form&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(address, tree_key, sub_key)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;tree_key&lt;&#x2F;code&gt; and &lt;code&gt;sub_key&lt;&#x2F;code&gt; are computed as &lt;code&gt;tree_key, sub_key = get_storage_slot_tree_keys(key)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;write-events-for-code&quot;&gt;Write events for code&lt;&#x2F;h4&gt;
&lt;p&gt;When a contract is created, process the write events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;CODE_OFFSET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; VERKLE_NODE_WIDTH&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For &lt;code&gt;i&lt;&#x2F;code&gt; in &lt;code&gt;0 ... (len(code)+30)&#x2F;&#x2F;31&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note: since no access list existed for code up until this EIP, note that no warm costs are charged for code accesses.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction&quot;&gt;Transaction&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;access-events-1&quot;&gt;Access events&lt;&#x2F;h4&gt;
&lt;p&gt;For a transaction, make these access events:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.origin, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.origin, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.target, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.target, 0, CODEHASH_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;write-events-1&quot;&gt;Write events&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.origin, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;value&lt;&#x2F;code&gt; is non-zero:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(tx.target, 0, BASIC_DATA_LEAF_KEY)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;witness-gas-costs&quot;&gt;Witness gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Remove the following gas costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increased gas cost of &lt;code&gt;CALL&lt;&#x2F;code&gt; if it is nonzero-value-sending&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas costs except for the &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;200 per byte contract code cost&lt;&#x2F;li&gt;
&lt;li&gt;All &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; costs related to nonzero-value-sending&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Reduce gas cost:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; to 1000&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITNESS_BRANCH_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WITNESS_CHUNK_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SUBTREE_EDIT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CHUNK_EDIT_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CHUNK_FILL_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;6200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When executing a transaction, maintain four sets:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;accessed_subtrees: Set[Tuple[address, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accessed_leaves: Set[Tuple[address, int, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;edited_subtrees: Set[Tuple[address, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;edited_leaves: Set[Tuple[address, int, int]]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When an &lt;strong&gt;access&lt;&#x2F;strong&gt; event of &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; occurs, perform the following checks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Perform the following steps unless event is a &lt;em&gt;Transaction access event&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;(address, sub_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_subtrees&lt;&#x2F;code&gt;, charge &lt;code&gt;WITNESS_BRANCH_COST&lt;&#x2F;code&gt; gas and add that tuple to &lt;code&gt;accessed_subtrees&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;leaf_key&lt;&#x2F;code&gt; is not &lt;code&gt;None&lt;&#x2F;code&gt; and &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_leaves&lt;&#x2F;code&gt;, charge &lt;code&gt;WITNESS_CHUNK_COST&lt;&#x2F;code&gt; gas and add it to &lt;code&gt;accessed_leaves&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When a &lt;strong&gt;write&lt;&#x2F;strong&gt; event of &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; occurs, perform the following checks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If event is &lt;em&gt;Transaction write event&lt;&#x2F;em&gt;, skip the following steps.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;(address, sub_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;edited_subtrees&lt;&#x2F;code&gt;, charge &lt;code&gt;SUBTREE_EDIT_COST&lt;&#x2F;code&gt; gas and add that tuple to &lt;code&gt;edited_subtrees&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;leaf_key&lt;&#x2F;code&gt; is not &lt;code&gt;None&lt;&#x2F;code&gt; and &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; is not in &lt;code&gt;edited_leaves&lt;&#x2F;code&gt;, charge &lt;code&gt;CHUNK_EDIT_COST&lt;&#x2F;code&gt; gas and add it to &lt;code&gt;edited_leaves&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;Additionally, if there was no value stored at &lt;code&gt;(address, sub_key, leaf_key)&lt;&#x2F;code&gt; (ie. the state held &lt;code&gt;None&lt;&#x2F;code&gt; at that position), charge &lt;code&gt;CHUNK_FILL_COST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that tree keys can no longer be emptied: only the values &lt;code&gt;0...2**256-1&lt;&#x2F;code&gt; can be written to a tree key, and 0 is distinct from &lt;code&gt;None&lt;&#x2F;code&gt;. Once a tree key is changed from &lt;code&gt;None&lt;&#x2F;code&gt; to not-&lt;code&gt;None&lt;&#x2F;code&gt;, it can never go back to &lt;code&gt;None&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that values should only be added to the witness if there is sufficient gas to cover their associated event costs. If there is not enough gas to cover the event costs, all the remaining gas should be consumed.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE*&lt;&#x2F;code&gt; and &lt;code&gt;*CALL&lt;&#x2F;code&gt; reserve 1&#x2F;64th of the gas before the nested execution. In order to match the behavior of this charge with the pre-fork behavior of access lists:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;this minimum 1&#x2F;64th gas reservation is checked &lt;strong&gt;AFTER&lt;&#x2F;strong&gt; charging the witness costs when performing a &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;this 1&#x2F;64th of the gas is subtracted &lt;strong&gt;BEFORE&lt;&#x2F;strong&gt; charging the witness costs when performing a &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-level-operations&quot;&gt;Block-level operations&lt;&#x2F;h3&gt;
&lt;p&gt;None of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Precompile accounts, system contract accounts and slots of a system contract that are accessed during a system call,&lt;&#x2F;li&gt;
&lt;li&gt;The coinbase account&lt;&#x2F;li&gt;
&lt;li&gt;Withdrawal accounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;are warm at the start of a transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;system-contracts&quot;&gt;System contracts&lt;&#x2F;h3&gt;
&lt;p&gt;When (and only when) calling a system contract either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;via a system call&lt;&#x2F;em&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;to resolve a precompile&#x2F;opcode&lt;&#x2F;em&gt;,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;the system contract&#x27;s &lt;em&gt;code chunks&lt;&#x2F;em&gt; and &lt;em&gt;account headers&lt;&#x2F;em&gt; accesses should not appear in the witness as these should be known&#x2F;cached in the clients. However any other accesses and all writes should appear in the witness.&lt;&#x2F;p&gt;
&lt;p&gt;Also corresponding witness costs need to be charged for &lt;em&gt;precompile&#x2F;opcode resolution&lt;&#x2F;em&gt; but are not charged in the &lt;em&gt;system call&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;account-abstraction&quot;&gt;Account abstraction&lt;&#x2F;h3&gt;
&lt;p&gt;TODO : still waiting on a final decision between 7702 and 3074&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-reform&quot;&gt;Gas reform&lt;&#x2F;h3&gt;
&lt;p&gt;Gas costs for reading storage and code are reformed to more closely reflect the gas costs under the new Verkle tree design. &lt;code&gt;WITNESS_CHUNK_COST&lt;&#x2F;code&gt; is set to charge 6.25 gas per byte for chunks, and &lt;code&gt;WITNESS_BRANCH_COST&lt;&#x2F;code&gt; is set to charge ~13,2 gas per byte for branches on average (assuming 144 byte branch length) and ~2.5 gas per byte in the worst case if an attacker fills the tree with keys deliberately computed to maximize proof length.&lt;&#x2F;p&gt;
&lt;p&gt;The main differences from gas costs in Berlin are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;200 gas charged per 31 byte chunk of code. This has been estimated to increase average gas usage by ~6-12% (suggesting 10-20% gas usage increases at a 350 gas per chunk level).&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing adjacent storage slots (&lt;code&gt;key1 &#x2F;&#x2F; 256 == key2 &#x2F;&#x2F; 256&lt;&#x2F;code&gt;) decreases from 2100 to 200 for all slots after the first in the group,&lt;&#x2F;li&gt;
&lt;li&gt;Cost for accessing storage slots 0…63 decreases from 2100 to 200, including the first storage slot. This is likely to significantly improve performance of many existing contracts, which use those storage slots for single persistent variables.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Gains from the latter two properties have not yet been analyzed, but are likely to significantly offset the losses from the first property. It’s likely that once compilers adapt to these rules, efficiency will increase further.&lt;&#x2F;p&gt;
&lt;p&gt;The precise specification of when access events take place, which makes up most of the complexity of the gas repricing, is necessary to clearly specify when data needs to be saved to the period 1 tree.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;The main backwards-compatibility-breaking change is the gas costs for code chunk access making some applications less economically viable. It can be mitigated by increasing the gas limit at the same time as implementing this EIP, reducing the risk that applications will no longer work at all due to transaction gas usage rising above the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP will mean that certain operations, mostly reading and writing several elements in the same suffix tree, become cheaper. If clients retain the same database structure as they have now, this would result in a DOS vector.&lt;&#x2F;p&gt;
&lt;p&gt;So some adaptation of the database is required in order to make this work:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In all possible futures, it is important to logically separate the commitment scheme from data storage. In particular, no traversal of the commitment scheme tree should be necessary to find any given state element&lt;&#x2F;li&gt;
&lt;li&gt;In order to make accesses to the same stem cheap as required for this EIP, the best way is probably to store each stem in the same location in the database. Basically the 256 leaves of 32 bytes each would be stored in an 8kB BLOB. The overhead of reading&#x2F;writing this BLOB is small because most of the cost of disk access is seeking and not the amount transferred.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simplify EIP-161</title>
        <published>2022-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Peter Davies</name><uri>https://github.com/petertdavies</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4747/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4747-simplify-eip-161/8246" />
        

        <id>https://wg-eips.ritovision.com/4747/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4747"
            label="EIP-4747" />
        

        
        

        
        <summary type="html">Simplify EIP-161 and retroactively deprecate unused aspects of it</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4747/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Simplify the definition of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;, removing the requirement for implementors to support edge cases that are impossible on Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-161 is overly complex and has a number of edge cases that are poorly documented and tested. This EIP takes advantage of the complete removal of all remaining empty accounts in block 14049881 (tx &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;) to clarify it, and allows implementors to not implement various edge cases that never occurred and are not possible in the future.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, this EIP permits implementors who do not wish to support historical blocks to not implement state clearing at all.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.&lt;&#x2F;p&gt;
&lt;p&gt;Retroactively replace EIP-161, starting from its introduction in block 2675000, with the following rules:&lt;&#x2F;p&gt;
&lt;p&gt;a. When creating an account, set it&#x27;s nonce to &lt;code&gt;1&lt;&#x2F;code&gt; prior to executing initcode.&lt;&#x2F;p&gt;
&lt;p&gt;b. When performing EVM execution treat all empty accounts as if they do not exist. Any operation that would create an empty account instead leaves it non-existent.&lt;&#x2F;p&gt;
&lt;p&gt;c. If one of the following events happens to an empty account &lt;code&gt;X&lt;&#x2F;code&gt;, it is deleted:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;X&lt;&#x2F;code&gt; receives a zero value &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;X&lt;&#x2F;code&gt; is the recipient of a zero value transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;X&lt;&#x2F;code&gt; is the beneficiary of a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with zero value.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the transaction, &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is reverted, then the state clearing is also reverted. As a special case on Ethereum Mainnet, in block 2675119 (tx &lt;code&gt;0xcf416c536ec1a19ed1fb89e4ec7ffb3cf73aa413b3aa9b77d60e4fd81a4296ba&lt;&#x2F;code&gt;), an empty call is made to an empty account at &lt;code&gt;RIPEMD160&lt;&#x2F;code&gt; (precompile &lt;code&gt;0x3&lt;&#x2F;code&gt;), the call fails out of gas, but the empty account is removed anyway.&lt;&#x2F;p&gt;
&lt;p&gt;The deletion MAY happen immediately or be processed at the end of the transaction. A client may assume that &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;s to empty accounts never occur and that &lt;code&gt;CALL&lt;&#x2F;code&gt;s to empty accounts in &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; contexts never occur.&lt;&#x2F;p&gt;
&lt;p&gt;On Ethereum Mainnet, the only state clearing events after the start of Byzantium are the two listed below. Clients MAY implement post Byzantium state clearing by hardcoding those events.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In block 4457731 (tx &lt;code&gt;0x63791f962e13e6b01ec13d38a8ab66c87c2f5a1768276f866300d900cca808fe&lt;&#x2F;code&gt;), &lt;code&gt;0xd29DFe5aE95B5C067a91F472Dac0d9be6700A4A9&lt;&#x2F;code&gt; receives a zero value &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and is cleared.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;In block 14049881 (tx &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;), the following accounts receive zero value calls and are cleared.&lt;&#x2F;p&gt;
  &lt;details&gt;
  &lt;summary&gt;Accounts cleared&lt;&#x2F;summary&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x01a3dd7d158e3b4c9d8d2af0ddcf3df0f5e14463&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0366c731dd7c095dc08896806765a649c6c0885a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x056c68da52395f1d42c5ba15c4fb956146a4f2c1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x070ba92497cd4b88a8a9a60795ca7d7f7de0faa3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x07a1648ce2bed6721a5d25de3c228a296d03fd52&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x07b14ba68f474529cc0bd6a9bffee2bc4090d185&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x07ea32232e37d44134a3071319d228bdab249a60&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x096b7382500fa11c22c54c0422c5e38899a2e933&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x09f3200441bd60522bcf28f3666f8e8dbd19fb62&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0ad0f3c60696adece09367a9a11c968fb88560bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0af6181e1db22071f38fc162e1610e29d288de04&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0cdc7fef8f8d0ee77360060930aada1263b26ff7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0dac3d571eb5b884a2550db2791d5ac1efca306b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0ec857faba49392080b68dd5074d85f34724d04a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f5054f9c674b37d15915ca8925f231edb3afa8c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0f78d535e1faad9a982dca2a76d16da4649f7021&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x104c5b235166f26df54f52666d5e77d9e03e353e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x106b47175965b6d607008544267c91490672a54f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1223d5c03b4d52ebed43f781251098c9138c3dd7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1251d13cde439378349f039379e83c2641b6269f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x12c814cebee6bb08a5d1b9d009332bf8b536d645&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x150c63df3da35e590a6d2f7accf2e6f241ea5f1a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x15ddf20e4eb8b53b823bc45c9bad2670aad907dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1712b1c428f89bc695b1871abfff6b5097350150&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x178df2e27b781f024e90ab0abe9cff7e2f66a5fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1c2bd83dc29095173c4bcc14927811f5141c1373&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1d12f2fad3603ea871fcb13ac3e30674f9ad903f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x1f7391b6881b6f025aef25cff737ff3fcb9d7660&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x219a3d724f596a4b75656e9b1569289c71782804&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x21a7fd9228c46ec72f926978f791fc8bfcd277fa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x23acb760cebd01fe7c92361274a4077d37b59f4c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x23b249eeeeedd86bc40349f8bb8e2df34bd28f78&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x28d006b1a2309e957005ee575f422af8034f93df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x28ef72d5614b2833d645aecf8ef7add075eb21e2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x292966802ffedb6f34f2c8c59df35c9d8f612c24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2c2661ddd320017138075aba06999440a902695f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2c632be2dc2f47affd07bfce91bd4a27c02f4563&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2f86de22ced85a7dd0d680fc4266929a72775e27&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x2fa04f15123025ab487dce71668f5265649d0598&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x30f78fd12c17855453e0db166fecf684bb239b8c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x31534e95353323209cd18ad35c22c2528db6d164&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x336e0e1a14e0136c02bf8dcf0a9a3fe408548262&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x340399588bba5b843883d1ad7afd771a3651447a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x341d2b82d0924ef42d75ce053654295d34839459&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x34c2b8975b47e13818f496cf80b40566798cf968&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x370e67f45db9c18d6551000e6c0918bc8d346ebf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x37149dae898296173d309f1de6981922ec1dc495&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x377cb0d3427af7f06df47d2ab420458834bed1fc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x3d473af3e6ce45183c781b414e8a9edcb8b26f72&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x42794c1d807079e16735e47e193825cec80ee28c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x45603aa97b67965b42b38ddc8884373edbcf2d56&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x465cb9df2f6d3c8a1c1ce3f2338823f0638fefa5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x49fbe69c2897bce0340b5983a0f719213a8c6e6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4a84cbd3ef642e301aa59bedf4fa4d28e24e6204&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4d4d551bd6244b854e732572902f19f4ccaa6996&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4f62af4ec150ea121859b3368e6a61fb7bcf9002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4fd1c530f73ddfff5c609a4a8b25af6ca489d1fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x50010a4f0e429b398c66876dea7694d5f8b1a639&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x522c9f65bc77ad9eed6bcdc3ec220236451c9583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x52b30ca3c2f8656e2c022e896bef7fad9a0449ca&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x537a7030ecd9d159e8231ce31b0c2e83b4f9ed75&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5483a4c5583d5ba3db23676a3db346f47ba357e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x55ec1a78a1187428dc0c67cbb77ae9fbdd61cc2a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x56cc1c0aadc2b8beb71f1ac61f03645483abe165&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58bea8cea61fad5c453731aaeed377f3d77a04cc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x58f632327fbc4f449bda3bd51e13f590e67a8627&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x59d122afcbd68c731de85c2597004c6ddafbc7ed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5da0228024cc084b9475470a7b7ae1d478d51bb7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5e51d6621883afcbd4e999b93180a96909bdc766&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5e9a0a1bdfdd868706f4554aae21bb2c46da32c2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5f3f0d3215db85faa693d99acfb03cca66556671&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x5f6aa25f22edb2347b464312e2508cbc4c6e0162&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6006f79e4104850ab7c9b0f75918c1e2cf6311df&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x60f5da58bccb716f58b5759a06fc2167fe237c26&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x62d3a444d0af59f9de79f8abeb5c942fcfbfbef5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x630ea66c8c5dc205d45a978573fa86df5af1fe7a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6464f0f96a29934087a955c67a6b53d5ed852e49&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6653cedb0b7f51c4b0c44079eb45c514df24ecfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x66d69ac12b573299f36b108792be75a1e2ccdfdc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x690ed837d25b46dbf46727fcda7392d997c2bc97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x696eecbc97189c5b2a8245a8e32517db9960c171&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x69aaff0b7babe85e0a95adfc540e689399db7f24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6b71d2ceab5678b607aa1e69b6781f5c7abc9aaf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e03d9cce9d60f3e9f2597e13cd4c54c55330cfd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e278cfecfe96fa5e6d5411ba6eeb765dff4f118&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6e557f01c9dcb573b03909c9a5b3528aec263472&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6ec268f8bef9c685d7e04d5cdb61fbb544869a9f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6f2ba051b3ce06a90705c22e0241c2b7e32c1af0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7063732ced55cfa08aea520f3fe200c39b3df0f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7073a17a0172dfb1e46a62f054d11a775aeac32e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x71d3718cfa0f9ee8173688fe52bb499e1f36534b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x74e20aec156674945894d404f8dea602570e62f5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x783e45c2989e675ffc9d067914d7de3ff68aee58&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7a5f843f884bb15d070806e1ff59b6c6f74bbe2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7c6b1706c86ea76a0e232324f249e1508ca2dfda&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7d23a23584c83c1f6636124255cfd8e9cfc0e529&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7e8b5df0dec9168741c93d52d7045aca7ea632d3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7ec5da0f1036750688084252b802befe41551205&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x82c9fcef4dd2d374b000063d4899a38a7219cdc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x82fa2ab30a566ceeac987eb5510485be9382f130&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x83d927aca3266f94e8163eaa32700c70e9b76e6e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8476f7e193c930f21e88dae84888e0d8bfaf3ed8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x85ec166cb81f5010b4a8d365821473dac0c0aa88&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8883c55943d5caf06b6484de9c1d73da8307cd82&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8c07456cffd4254c89aaaa9d4e95c8b3e36c2a3b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8fef965e5db6f7f1a165008499e8b7901cd766b2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9018e2967c15e1faed9b5d6439522f075535a683&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x903f1d8a086c6af1afe24648b6409aade83c4340&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9127c398827d8db6b6d5f17b71f5db69d06e8b74&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x917b5be6e3acd96d40a33c13e6748e4a88576c6d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x91edfd05112f0bc9d6cd43b65361713a50e9eb7f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x93026a2c4a0bc69de31515070bf086e0c1f789e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94863bbbc12ec5be148f60a7020fd49236fc1937&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94befc001e203f141462f16bde60873bcefae401&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94c408cf5934f241d4fdd55ff3825131635c6af2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x94cfdec548de92301735dc0b82d8e1f79404ff94&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x96527f3311f44340887c926acc16f0997eb3b955&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x974117faf194885c01513e8d87b38a2291083ed5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x993424827a5fb2fa97818814ea4027e28150f187&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a6f30a5cb46840076edd780da2dbb4bc7c39f24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9a74a096b0bb82adfd28494107f2c07f4545723e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9af82ec46185641c0ea44679aac8a7e7570be202&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9e2287a60ed85f6bd80c62c1b7b4130ea1b521dd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x9fee5b81ee0cbf34c18c52061f1b257d4ccb2702&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa017226377e775af8e56450301cc035ae72267f8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa1b423e024daf925f25296ea2efcf009cc328873&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa23c0cbfe59e8650277ffa635c59f287cece9087&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa340b7625eec76b372f2c317fe08a7733f05d09c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa4cb6be13c2eace6c0f1157553e3c446f7b38b10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa54326267784fae3ffd6800af38099753bb7f470&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa580086125d040fddd3af9d563285bd0ec4d13e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xa88fc7a34ca36b952aa45d94c1e13155042b5e7d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xac8f4ce2e4eff39c738bf1941350b3b57e8eec4f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xacb17dca110db022b1aceb5399acba1e9bf577e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xae0b03c8d8bf9cf71eda758e9e8b59c70a3b4580&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xae365ff4b0c64413baf6f7dfdb5cd3fb65ad1376&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaf7e60d02b425b54730b7281a97d1640233704b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xaf9846f8098656e7c2f0e53e9ff7d38ec7b7f679&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb2784c0a95e9b6b865aca13556fb32e2f37cb775&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb385fa211cd08326ff84b0d4f37cc8c3735aa3aa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb3fb883cbbccb0551daf1507f87426fd38da087e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6515cfb82fa877fbadae5a87006a8d3deeeb7c9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb78c4f0b8c9ec0b3058724eca65292d0d65586b9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xba25f341e16ee81ab80ea246d45bdead7cc339e5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbab14024437285c2e3b3c521abff96b0ef2e919f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbaf0996297cc70fca1bee30162eabcd892f0574a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xbb01ea95321a94242c89479995b7e3f264cb46a0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc1b37a3b7f76947e24cc2470e0e948aab0181346&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc24431c1a1147456414355b1f1769de450e524da&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc467b893e29277f9b62b4ed6c9ba054bd8225bff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc4bc101a168ea2228973a65564a7d40a68528dd2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc784626571c2c25cd2cfe24192a149cad86d40d8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc7acf90a9f442855b8f291288bb5fb612536ed9b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc9956593dbfb46cfd24686a365b34051a55abce6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xca2eb2af7dd7a90777c8c6456efcc00fe56dbd6f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcb4bb078edaae9393c8da27b809aa9c0f4c920b7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcc8f68e8e2d8196e2ecd0caf2f35b1611739a21f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcd67903318a805d63fe79bf9b8401c1b79c6babf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xcd7a2fe9cb80c95b03950daf5b6d476bec9ac24d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd09476f5ee7979becca8ffe6dc22a72565fc3cea&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd1c4bd2b583f445354d1b644ea4b8353f2d23048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd32bb8bceafc89ff59ba43ce8b6cd65bb06dd7b0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd49e9fa792db9d9398c57eabf94ba1b2c709ace7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd6b862cf0d009bde0f020ab9d8f96e475069c5c6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xd747c05d9c8057db608ef7aedabf07e4db0bbe97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdb9b40d1b691ced3680e539261b6bc195388b3c0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdbcc502093cadd0feb709708c633e2427aeb9c2d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdc53001181ddc6a279deea6419443ea0ac0aec9c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xde3b38cb1050e7b5db39b4cbb2b2b63a1e32cbf6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdf1b687a99216ad4ebf9176983bf165be7b25bbe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe000662c02a02d8b40aabfcd661594312992311d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe30c59e4dc19d7c9ed6eb10d734d4d7ef28403ac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe415114089b4b4933e542a5c79af4b6e6cd7abc9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe47f0a0e93241d390fe9b99de852682522e847bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe54abbd51e324bf8cf349b6b31c01b043d1ee0e4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe57838f777b11fdc428d9e7e67f1187d6251ba1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe5e4b26325d0fbf551367f2cf3b5d01caed6abcf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe6655208bd812d833238b560e847014b0aab3b51&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe6e16a1023af4a8fe54669f3fce7c406801bb333&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xe727bba699fbe82a731dad9476b5234d0038cfa1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xec361d34a55e24e2f77de7121ae2b7bf11ed0d65&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xed3bf94976eb11d55b955d1369a478620872b57c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xee93ad447fe6a0e2bbac4952e651b21c0175acad&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xefc5d9cabc0bda8124e1b821e8c86c7e7bf1e4bc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf272f72a00f166f491d994642c8243099b72d2cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf45f642034bbce869e31b05d1da919125c7331ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf4883b21724405b19e240f3309a64d16dd89adc7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf5cb2a87ff1095f6d93e7b4bfc1bc47542380550&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf6ddd386c4f7f0b460032c8055d7f9c3503d7140&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf72093096c81b3e9e991f5b737baec9570a56927&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf7412232a7a731bca2e5554c8ee051274373c17c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfc2321dc32c2e6e96a0e41c911fb73a7b278d5c8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfc4dc782bf7e81a2ed5cc0519f80de36e7931bd9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfcde1c261eb257e14491b4e7cb1949a7623c00c5&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfd17a22fd80075f2716e93268aa01bcdd7d70b22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;  &lt;&#x2F;details&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-161 provides that empty accounts (accounts that have zero nonce, zero balance and no code, but that might have storage) can no longer be created and provides mechanism to remove old empty accounts. The last empty accounts were removed in block 14049881 (tx &lt;code&gt;0xf955834bfa097458a9cf6b719705a443d32e7f43f20b9b0294098c205b4bcc3d&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The complete removal of all empty accounts ensures that certain edgecases of EIP-161 can never occur on Ethereum Mainnet. Continuing to define and test those cases as part of the Ethereum Specification burdens future client implementors with unnecessary technical debt. This EIP declares those cases undefined and leaves clients free to assume they will not occur.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is identical to EIP-161 except for the following differences, none of which affect Ethereum Mainnet. The differences are:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;potentially-state-changing-operations&quot;&gt;&quot;Potentially state-changing operations&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-161 specifies 11 &quot;potentially state-changing operations&quot; that trigger state clearing. All but the 3 listed in this EIP are irrelevant, for the following reasons:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;impossible&quot;&gt;Impossible&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Receiving zero value mining reward&#x2F;fees (this would become possible after the merge).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;cannot-happen-to-an-empty-account&quot;&gt;Cannot happen to an empty account&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Being the source of a &lt;code&gt;CREATE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Being the source of a &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Being refunded by a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;causes-the-account-to-become-non-empty&quot;&gt;Causes the account to become non-empty&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Being the sender of a message call transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Being the sender of a contract creation transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Being created by a &lt;code&gt;CREATE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Being created by a contract creation transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;interaction-with-staticcall&quot;&gt;Interaction with &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The interaction between &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and account clearing has never been specified in an EIP. The Ethereum currently testsuite requires that &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; triggers state clearing.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP formally undefines all interactions between &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and state clearing as it has never happened on Ethereum Mainnet and cannot happen in future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;at-the-end-of-the-transaction&quot;&gt;&quot;At the end of the transaction&quot;&lt;&#x2F;h3&gt;
&lt;p&gt;This only makes a difference if an account is deleted and later recreated in the same transaction. This never happens on Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h3&gt;
&lt;p&gt;All test cases involving empty accounts in the Ethereum execution layer test suite shall be removed unless they relate to the Spurious Dragon Hardfork. If a Spurious Dragon test relates involved deprecated edgecase the test must be removed or reworked.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other-networks&quot;&gt;Other networks&lt;&#x2F;h3&gt;
&lt;p&gt;Ropsten had empty accounts seeded at genesis. They appear to have been cleared early in Ropsten&#x27;s history before the Byzantium hardfork. Ropsten has never been checked for edgecases occurring. All other Ethereum testnets have had EIP-161 from genesis.&lt;&#x2F;p&gt;
&lt;p&gt;As a security precaution all empty accounts on Ethereum Classic have been cleared, but no checks for edgecases occurring have been done. Due to EIP-161&#x27;s age the vast majority of EVM compatible networks have supported it from genesis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is only equivalent to EIP-161 on Ethereum Mainnet if the following facts are true:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No empty accounts are ever touched and then reinstated in the same transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The transactions in the Appendix are the only state clearing transactions on Ethereum Mainnet after block 4370000 (start of Byzantium).&lt;&#x2F;li&gt;
&lt;li&gt;All empty accounts have been removed on Ethereum Mainnet.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit transaction gas to a maximum of 2^63-1</title>
        <published>2022-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4803/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4803-limit-transaction-gas-to-a-maximum-of-2-63-1/8296" />
        

        <id>https://wg-eips.ritovision.com/4803/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4803"
            label="EIP-4803" />
        

        
        

        
        <summary type="html">Valid transactions must have a reasonable gas limit</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4803/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Limit transaction gas to be between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2^63-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The gas limit field in the transaction is specified to be an arbitrary long unsigned integer, but various clients put limits on this value. This EIP brings a reasonable limit into consensus.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce one new restriction retroactively from genesis: any transaction is invalid and not includeable in a block, where the gas limit exceeds &lt;code&gt;2^63-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;2-63-1-vs-2-64-1&quot;&gt;&lt;code&gt;2^63-1&lt;&#x2F;code&gt; vs &lt;code&gt;2^64-1&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;2^63-1&lt;&#x2F;code&gt; is chosen because it allows representing the gas value as a signed integer, and so the out of gas check can be done as a simple &quot;less than zero&quot; check after subtraction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consider-2-31-1&quot;&gt;Consider &lt;code&gt;2^31-1&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative is considering a lower limit, because this can be handled easily in Javascript, since it handles numbers as floating point (the actual upper bound is &lt;code&gt;2^53-1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;current-limit&quot;&gt;Current limit&lt;&#x2F;h3&gt;
&lt;p&gt;Due to the nature of RLP encoding, there is no fixed upper bound for the value, but most implementations limit it to 256-bits. Furthermore, most client implementations (such as geth) internally handle gas as a 64-bit value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While this is a breaking change, no actual effect should be visible.&lt;&#x2F;p&gt;
&lt;p&gt;Before &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; it was possible to include transactions with &lt;code&gt;gasPrice = 0&lt;&#x2F;code&gt; and thus the &lt;code&gt;gasLimit * gasPrice &amp;lt;= accountBalance&lt;&#x2F;code&gt; calculation could have allowed for arbitrarily large values of &lt;code&gt;gasLimit&lt;&#x2F;code&gt;. However, the rule that the transaction list cannot exceed the block gas limit, and the strict rules about how the block gas limit can change, prevented arbitrarily large values of &lt;code&gt;gasLimit&lt;&#x2F;code&gt; to be in the historical state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Functions</title>
        <published>2022-01-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4750/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4750-eof-functions/8195" />
        

        <id>https://wg-eips.ritovision.com/4750/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4750"
            label="EIP-4750" />
        

        
        

        
        <summary type="html">Individual sections for functions with `CALLF` and `RETF` instructions</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4750/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce the ability to have several code sections in EOF-formatted (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) bytecode, each one representing a separate subroutine&#x2F;function. Two new opcodes,&lt;code&gt;CALLF&lt;&#x2F;code&gt; and &lt;code&gt;RETF&lt;&#x2F;code&gt;, are introduced to call and return from such a function. Dynamic jump instructions are disallowed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, in the EVM everything is a dynamic jump. Languages like Solidity generate most jumps in a static manner (i.e. the destination is pushed to the stack right before, &lt;code&gt;PUSHn .. JUMP&lt;&#x2F;code&gt;). Unfortunately however this cannot be used by most EVM interpreters, because of added requirement of validation&#x2F;analysis. This also restricts them from making optimisations and potentially reducing the cost of jumps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; introduces static jump instructions, which remove the need for &lt;em&gt;most&lt;&#x2F;em&gt; dynamic jump use cases, but not everything can be solved with them.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to remove the need and disallow dynamic jumps as it offers the most important feature those are used for: calling into and returning from functions.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, it aims to improve analysis opportunities by encoding the number of inputs and outputs for each given function, and isolating the stack of each function (i.e. a function cannot read the stack of the caller&#x2F;callee).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;type-section&quot;&gt;Type Section&lt;&#x2F;h3&gt;
&lt;p&gt;The type section of EOF containers must adhere to following requirements:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The section is a list of metadata where the metadata index in the type section corresponds to a code section index. Therefore, the type section size MUST be &lt;code&gt;n * 4&lt;&#x2F;code&gt; bytes, where &lt;code&gt;n&lt;&#x2F;code&gt; is the number of code sections.&lt;&#x2F;li&gt;
&lt;li&gt;Each metadata item has 3 attributes: a uint8 &lt;code&gt;inputs&lt;&#x2F;code&gt;, a uint8 &lt;code&gt;outputs&lt;&#x2F;code&gt;, and a uint16 &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt;. &lt;em&gt;Note:&lt;&#x2F;em&gt; This implies that there is a limit of 255 stack for the input and in the output. This is further restricted to 127 stack items, because the upper bit of both the input and output bytes are reserved for future use (&lt;code&gt;outputs == 0x80&lt;&#x2F;code&gt; is already used in EOF1 to denote non-returning functions, as introduced in a separate EIP). &lt;code&gt;max_stack_increase&lt;&#x2F;code&gt; is further defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The 0th code section MUST have 0 inputs and be non-returning.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; to see the full structure of a well-formed EOF bytecode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-execution-state-in-evm&quot;&gt;New execution state in EVM&lt;&#x2F;h3&gt;
&lt;p&gt;A return stack is introduced, separate from the operand stack. It is a stack of items representing execution state to return to after function execution is finished. Each item is comprised of code section index and offset in the code section (PC value).&lt;&#x2F;p&gt;
&lt;p&gt;Note: Implementations are free to choose particular encoding for a stack item. In the specification below we assume that representation is two unsigned integers: &lt;code&gt;code_section_index&lt;&#x2F;code&gt;, &lt;code&gt;offset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The return stack is limited to a maximum of &lt;code&gt;1024&lt;&#x2F;code&gt; items.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, EVM keeps track of the index of currently executing section - &lt;code&gt;current_section_index&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-instructions&quot;&gt;New instructions&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce two new instructions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt; (&lt;code&gt;0xe3&lt;&#x2F;code&gt;) - call a function&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETF&lt;&#x2F;code&gt; (&lt;code&gt;0xe4&lt;&#x2F;code&gt;) - return from a function&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, any of these instructions results in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;First we define several helper values:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;type[i].inputs = type_section_contents[i * 4]&lt;&#x2F;code&gt; - number of inputs of ith code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;type[i].outputs = type_section_contents[i * 4 + 1]&lt;&#x2F;code&gt; - number of outputs of ith code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;type[i].max_stack_increase = type_section_contents[i * 4 + 2:i * 4 + 4]&lt;&#x2F;code&gt; - maximum operand stack height increase of ith code section&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If the code is valid EOF1, the following execution rules apply:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;callf&quot;&gt;&lt;code&gt;CALLF&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Has one immediate argument,&lt;code&gt;target_section_index&lt;&#x2F;code&gt;, encoded as a 16-bit unsigned big-endian value.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees that operand stack has enough items to use as callee&#x27;s inputs.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If operand stack size exceeds &lt;code&gt;1024 - type[target_section_index].max_stack_increase&lt;&#x2F;code&gt; (i.e. if the called function may exceed the global stack height limit), execution results in exceptional halt. This also guarantees that the stack height after the call is within the limits.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If return stack already has &lt;code&gt;1024&lt;&#x2F;code&gt; items, execution results in exceptional halt.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Charges &lt;code&gt;5&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Pops nothing and pushes nothing to operand stack.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Pushes to return stack an item:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(code_section_index = current_section_index, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;offset = PC_post_instruction)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Under &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; we mean the PC position after the entire immediate argument of &lt;code&gt;CALLF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees there is always an instruction following &lt;code&gt;CALLF&lt;&#x2F;code&gt; (since terminating instruction or unconditional jump is required to be final one in the section), therefore &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; always points to an instruction inside section bounds.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Sets &lt;code&gt;current_section_index&lt;&#x2F;code&gt; to &lt;code&gt;target_section_index&lt;&#x2F;code&gt; and &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;0&lt;&#x2F;code&gt;, and execution continues in the called section.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;retf&quot;&gt;&lt;code&gt;RETF&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;Does not have immediate arguments.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees that operand stack has exact number of items to use as outputs.&lt;&#x2F;li&gt;
&lt;li&gt;Charges &lt;code&gt;3&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;Pops nothing and pushes nothing to operand stack.&lt;&#x2F;li&gt;
&lt;li&gt;Pops an item from return stack and sets &lt;code&gt;current_section_index&lt;&#x2F;code&gt; and &lt;code&gt;PC&lt;&#x2F;code&gt; to values from this item.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation requirement for 0th code section to be non-returning (non-returning sections introduced in a separate EIP) guarantees that return stack cannot be empty before &lt;code&gt;RETF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code Validation&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to container format validation rules above, we extend code section validation rules (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Code validation rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; are applied to every code section.&lt;&#x2F;li&gt;
&lt;li&gt;Code section is invalid in case an immediate argument of any &lt;code&gt;CALLF&lt;&#x2F;code&gt; is greater than or equal to the total number of code sections.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument value (jump destination relative offset) validation:
&lt;ol&gt;
&lt;li&gt;Code section is invalid in case offset points to a position outside of section bounds.&lt;&#x2F;li&gt;
&lt;li&gt;Code section is invalid in case offset points to one of two bytes directly following &lt;code&gt;CALLF&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;No unreachable code sections are allowed, i.e. every code section can be reached from the 0th code section with a series of &lt;code&gt;CALLF&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;JUMPF&lt;&#x2F;code&gt; (&lt;code&gt;JUMPF&lt;&#x2F;code&gt; introduced in a separate EIP) instructions (0th code section is always reachable).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;disallowed-instructions&quot;&gt;Disallowed instructions&lt;&#x2F;h3&gt;
&lt;p&gt;Dynamic jump instructions &lt;code&gt;JUMP&lt;&#x2F;code&gt; (&lt;code&gt;0x56&lt;&#x2F;code&gt;) and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; (&lt;code&gt;0x57&lt;&#x2F;code&gt;) are invalid and their opcodes are undefined.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (&lt;code&gt;0x5b&lt;&#x2F;code&gt;) instruction is renamed to &lt;code&gt;NOP&lt;&#x2F;code&gt; (&quot;no operation&quot;) without the change in behaviour: it pops nothing and pushes nothing to operand stack and has no other effects except for &lt;code&gt;PC&lt;&#x2F;code&gt; increment and charging 1 gas.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;PC&lt;&#x2F;code&gt; (0x58) instruction becomes invalid and its opcode is undefined.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; This change implies that JUMPDEST analysis is no longer required for EOF code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Execution starts at the first byte of the 0th code section, and &lt;code&gt;PC&lt;&#x2F;code&gt; is set to &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Return stack is initialized empty.&lt;&#x2F;li&gt;
&lt;li&gt;Stack underflow check is not performed anymore. &lt;em&gt;Note:&lt;&#x2F;em&gt; EOF validation &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; guarantees that it cannot happen at run-time.&lt;&#x2F;li&gt;
&lt;li&gt;Stack overflow check is not performed anymore, except during &lt;code&gt;CALLF&lt;&#x2F;code&gt; as specified above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;retf-in-the-top-frame-ends-execution-vs-exceptionally-halts-vs-is-not-allowed-during-validation&quot;&gt;&lt;code&gt;RETF&lt;&#x2F;code&gt; in the top frame ends execution vs exceptionally halts vs is not allowed during validation&lt;&#x2F;h3&gt;
&lt;p&gt;Alternative logic for &lt;code&gt;RETF&lt;&#x2F;code&gt; in the top frame could be to allow it during code validation and make it either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;end execution if the return stack is emptied by the &lt;code&gt;RETF&lt;&#x2F;code&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;exceptionally halt if the return stack is empty before the &lt;code&gt;RETF&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This has been superseded with the validation rule of top frame (0th code section) being non-returning (non-returning sections introduced in a separate EIP), because validating non-returning status of functions is valuable by itself for other reasons. Therefore all considerations of runtime behavior of &lt;code&gt;RETF&lt;&#x2F;code&gt; in the top frame were obsoleted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;minimal-function-type&quot;&gt;&quot;Minimal&quot; function type&lt;&#x2F;h3&gt;
&lt;p&gt;Let&#x27;s consider a trivial function with single instruction &lt;code&gt;RETF&lt;&#x2F;code&gt;.
Such function have the &quot;minimal&quot; type of &lt;code&gt;inputs = 0, outputs = 0&lt;&#x2F;code&gt;.
However, any other type like &lt;code&gt;inputs = k, outputs = k&lt;&#x2F;code&gt; is also valid for such function.
It has been considered to enforce usage of the &quot;minimal&quot; type for all functions.
This requires additional validation rule that checks if any instruction in the function accesses the bottom stack operand.
This rule can be obeyed by compilers, but causes quite significant annoyance.
On the other hand, it provides close to zero benefits for the EVM implementations.
In the end, it has been decided that this is not enforced.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-section-limit-and-instruction-size&quot;&gt;Code section limit and instruction size&lt;&#x2F;h3&gt;
&lt;p&gt;The number of code sections is limited to 1024. This requires 2-byte immediate for &lt;code&gt;CALLF&lt;&#x2F;code&gt; and leaves room for increasing the limit in the future. The 256 limit (1-byte immediate) was discussed and concerns were raised that it might not be sufficient.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nop-instruction&quot;&gt;&lt;code&gt;NOP&lt;&#x2F;code&gt; instruction&lt;&#x2F;h3&gt;
&lt;p&gt;Instead of deprecating &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; we repurpose it as &lt;code&gt;NOP&lt;&#x2F;code&gt; instruction, because &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; effectively was a &quot;no-operation&quot; instruction and was already used as such in various contexts. It can be useful for some off-chain tooling, e.g. benchmarking EVM implementations (performance of &lt;code&gt;NOP&lt;&#x2F;code&gt; instruction is performance of EVM interpreter loop), as a padding to force code alignment, as a placeholder in dynamic code composition.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deprecating-jumpdest-analysis&quot;&gt;Deprecating &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis&lt;&#x2F;h3&gt;
&lt;p&gt;The purpose of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis was to find in code the valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; bytes that do not happen to be inside &lt;code&gt;PUSH&lt;&#x2F;code&gt; immediate data. Only dynamic jump instructions (&lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;JUMPI&lt;&#x2F;code&gt;) required destination to be &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instruction. Relative static jumps (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) do not have this requirement and are validated once at deploy-time during EOF instructions validation. Therefore, without dynamic jump instructions, &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis is not required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced only for EOF1 contracts, for which deploying undefined instructions is not allowed, therefore there are no existing contracts using these instructions. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;p&gt;The new execution state and multi-section control flow pose no risk to backwards compatibility, because it is a generalization of executing a single code section. Executing existing contracts (both legacy and EOF1) has no user-observable changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The gas cost of introduced instructions reflects the need to manipulate return stack entries and jumping to proper code section offset in memory when interpreting the bytecode.&lt;&#x2F;p&gt;
&lt;p&gt;These new instructions need to be carefully considered during implementation of the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Procedures for the EVM</title>
        <published>2021-12-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4573/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4573-named-procedures-for-evm-code-sections/7776" />
        

        <id>https://wg-eips.ritovision.com/4573/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4573"
            label="EIP-4573" />
        

        
        

        
        <summary type="html">Introduces support for EVM Procedures.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4573/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Five EVM instructions are introduced to define, call, and return from named EVM &lt;em&gt;procedures&lt;&#x2F;em&gt; and access their &lt;em&gt;call frames&lt;&#x2F;em&gt; in memory - &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt;, &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;, &lt;code&gt;CALLPROC&lt;&#x2F;code&gt;, &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt;, and &lt;code&gt;FRAMEADDRESS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, Ethereum bytecode has no syntactic structure, and &lt;em&gt;subroutines&lt;&#x2F;em&gt; have no defined interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;We propose to add &lt;em&gt;procedures&lt;&#x2F;em&gt; -- delimited blocks of code that can be entered only by calling into them via defined interfaces.&lt;&#x2F;p&gt;
&lt;p&gt;Also, the EVM currently has no automatic management of memory for &lt;em&gt;procedures&lt;&#x2F;em&gt;.  So we also propose to automatically reserve call frames on an in-memory stack.&lt;&#x2F;p&gt;
&lt;p&gt;Constraints on the use of &lt;em&gt;procedures&lt;&#x2F;em&gt; must be validated at contract initialization time to maintain the safety properties of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3779&#x2F;&quot;&gt;EIP-3779&lt;&#x2F;a&gt;: Valid programs will not halt with an exception unless they run out of gas or recursively overflow stack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prior-art&quot;&gt;Prior Art&lt;&#x2F;h3&gt;
&lt;p&gt;The terminology is not well-defined, but we will follow Intel in calling the low-level concept &lt;em&gt;subroutines&lt;&#x2F;em&gt; and the higher level concept &lt;em&gt;procedures&lt;&#x2F;em&gt;.  The distinction is that &lt;em&gt;subroutines&lt;&#x2F;em&gt; are little more than a jump that knows where it came from, whereas procedures have a defined interface and manage memory as a stack. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; introduces &lt;em&gt;subroutines&lt;&#x2F;em&gt;, and this EIP introduces &lt;em&gt;procedures&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;instructions&quot;&gt;Instructions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;enterproc-0x-dest-section-uint8-dest-offset-uint8-n-inputs-uint16-n-outputs-uint16-n-locals-uint16&quot;&gt;ENTERPROC (0x??) dest_section: uint8, dest_offset: uint8, n_inputs: uint16, n_outputs: uint16, n_locals: uint16&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame_stack.push(FP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FP -= n_locals * 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PC +- &amp;lt;length of immediates&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Marks the entry point to a procedure&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;at offset &lt;code&gt;dest_offset&lt;&#x2F;code&gt; from the beginning of the &lt;code&gt;dest_section&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;taking &lt;code&gt;n_inputs&lt;&#x2F;code&gt; arguments from the data stack,&lt;&#x2F;li&gt;
&lt;li&gt;returning &lt;code&gt;n_outputs&lt;&#x2F;code&gt; values on the &lt;code&gt;data stack&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;reserving &lt;code&gt;n_locals&lt;&#x2F;code&gt; words of data in memory on the &lt;code&gt;frame stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Procedures can only be entered via a &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; to their entry point.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;leaveproc-0x&quot;&gt;LEAVEPROC (0x??)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   FP = frame_stack.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   asm RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Pop the &lt;code&gt;frame stack&lt;&#x2F;code&gt; and return to the calling procedure using &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Marks the end of a procedure.  Each &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; requires a closing &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: Attempts to jump into a procedure (including its  &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;) from outside of the procedure or to jump or step to &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; at all must be prevented at validation time.  &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; is the only valid way to enter a procedure.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;callproc-0x-dest-section-uint16-dest-proc-uint16&quot;&gt;CALLPROC (0x??) dest_section: uint16, dest_proc: uint16&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  FP -= n_locals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  asm JUMPSUB &amp;lt;offset of section&amp;gt; + &amp;lt;offset of procedure&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Allocate a &lt;em&gt;stack frame&lt;&#x2F;em&gt; and transfer control and &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; to the Nth (N=&lt;em&gt;dest_proc&lt;&#x2F;em&gt;) &lt;em&gt;procedure&lt;&#x2F;em&gt; in the Mth(M=&lt;em&gt;dest_section&lt;&#x2F;em&gt;) &lt;em&gt;section&lt;&#x2F;em&gt; of the code.  &lt;em&gt;Section 0&lt;&#x2F;em&gt; is the current code section, any other code sections are indexed starting at &lt;em&gt;1&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: That the procedure is defined and the required &lt;code&gt;n_inputs&lt;&#x2F;code&gt; words are available on the &lt;code&gt;data stack&lt;&#x2F;code&gt; must be shown at validation time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returnproc-0x&quot;&gt;RETURNPROC (0x??)&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   FP += n_locals&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   asm RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Pop the &lt;code&gt;frame stack&lt;&#x2F;code&gt; and return control to the calling procedure using &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: That the promised &lt;code&gt;n_outputs&lt;&#x2F;code&gt; words are available on the &lt;code&gt;data stack&lt;&#x2F;code&gt; must be shown at validation time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;frameaddress-0x-offset-int16&quot;&gt;FRAMEADDRESS (0x??) offset: int16&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;asm PUSH2 FP + offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Push the address &lt;code&gt;FP + offset&lt;&#x2F;code&gt; onto the data stack.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Call frame data is addressed at an immediate &lt;code&gt;offset&lt;&#x2F;code&gt; relative to &lt;code&gt;FP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Typical usage includes storing data on a call frame&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xdada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FRAMEADDRESS 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MSTORE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and loading data from a call frame&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FRAMEADDRESS 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MLOAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;memory-costs&quot;&gt;Memory Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Presently,&lt;code&gt;MSTORE&lt;&#x2F;code&gt; is defined as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory[stack[0]...stack[0]+31] = stack[1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory_size = max(memory_size,floor((stack[0]+32)÷32)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;where &lt;code&gt;memory_size&lt;&#x2F;code&gt; is the number of active words of memory above &lt;em&gt;0&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We propose to treat memory addresses as signed, so the formula needs to be&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory[stack[0]...stack[0]+31] = stack[1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   if (stack[0])+32)÷32) &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      negative_memory_size = max(negative_memory_size,floor((stack[0]+32)÷32))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      positive_memory_size = max(positive_memory_size,floor((stack[0]+32)÷32))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   memory_size = positive_memory_size + negative_memory_size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;where &lt;code&gt;negative_memory_size&lt;&#x2F;code&gt; is the number of active words of memory below &lt;em&gt;0&lt;&#x2F;em&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;where &lt;code&gt;positive_memory_size&lt;&#x2F;code&gt; is the number of active words of memory at or above &lt;em&gt;0&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;call-frame-stack&quot;&gt;Call Frame Stack&lt;&#x2F;h3&gt;
&lt;p&gt;These instructions make use of a &lt;code&gt;frame stack&lt;&#x2F;code&gt; to allocate and free frames of local data for &lt;em&gt;procedures&lt;&#x2F;em&gt; in memory.  Frame memory begins at address 0 in memory and grows downwards, towards more negative addresses.  A frame is allocated for each procedure when it is called, and freed when it returns.&lt;&#x2F;p&gt;
&lt;p&gt;Memory can be addressed relative to the frame pointer &lt;code&gt;FP&lt;&#x2F;code&gt; or by absolute address.  &lt;code&gt;FP&lt;&#x2F;code&gt; starts at 0, and moves downward towards more negative addresses to point to the frame for each &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; and moving upward towards less negative addresses to point to the previous frame for the corresponding &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Equivalently, in the EVM&#x27;s twos-complement arithmetic, &lt;code&gt;FP&lt;&#x2F;code&gt; moves from the highest address down, as is common in many calling conventions.&lt;&#x2F;p&gt;
&lt;p&gt;For example, after an initial &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; to a procedure needing two words of data the &lt;code&gt;frame stack&lt;&#x2F;code&gt; might look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     0-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Then, after a further &lt;code&gt;CALLPROC&lt;&#x2F;code&gt; to a procedure needing three words of data the &lt;code&gt;frame stack&lt;&#x2F;code&gt; would like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     0-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   -64-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After a &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt; from that procedure the &lt;code&gt;frame stack&lt;&#x2F;code&gt; would look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     0-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and after a final &lt;code&gt;RETURNPROC&lt;&#x2F;code&gt;, like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    FP-&amp;gt; ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         ........&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There is actually not much new here.  It amounts to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt;, refined and refactored into bite-sized pieces, along lines common to other machines.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal uses the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; return stack to manage calls and returns, and steals ideas from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3336&#x2F;&quot;&gt;EIP-3336&lt;&#x2F;a&gt;, and  &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt;. &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; corresponds to &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; from EIP-615.  Like EIP-615 it uses a frame stack to track call-frame addresses with &lt;code&gt;FP&lt;&#x2F;code&gt; as &lt;em&gt;procedures&lt;&#x2F;em&gt; are entered and left, but like EIP-3336 and EIP-3337 it moves call frames from the data stack to memory.&lt;&#x2F;p&gt;
&lt;p&gt;Aliasing call frames with ordinary memory supports  addressing call-frame data with ordinary stores and loads.  This is generally useful, especially for languages like C that provide pointers to variables on the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The design model here is the &lt;em&gt;subroutines&lt;&#x2F;em&gt; and &lt;em&gt;procedures&lt;&#x2F;em&gt; of the Intel x86 architecture.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; (from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; -- like &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;RET&lt;&#x2F;code&gt; -- jump to and return from &lt;em&gt;subroutines&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENTERPROC&lt;&#x2F;code&gt;  -- like &lt;code&gt;ENTER&lt;&#x2F;code&gt; -- sets up the stack frame for a &lt;em&gt;procedure&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLPROC&lt;&#x2F;code&gt; amounts to a &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; to an &lt;code&gt;ENTERPROC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNPROC&lt;&#x2F;code&gt; amounts to an early &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt; -- like &lt;code&gt;LEAVE&lt;&#x2F;code&gt; -- takes down the stack frame for a &lt;em&gt;procedure&lt;&#x2F;em&gt;.  It then executes a &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds new EVM opcodes.  It doesn&#x27;t remove or change the semantics of any existing opcodes, so there should be no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security&quot;&gt;Security&lt;&#x2F;h2&gt;
&lt;p&gt;Safe use of these constructs must be checked completely at validation time -- per EIP-3779 -- so there should be no security issues at runtime.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; and &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt; must follow the same safety rules as for &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; in EIP-2315. In addition, the following constraints must be validated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Every&lt;code&gt;ENTERPROC&lt;&#x2F;code&gt; must be followed by a &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt; to delimit the bodies of &lt;em&gt;procedures&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There can be no nested &lt;em&gt;procedures&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There can be no jump into the body of a procedure (including its &lt;code&gt;LEAVEPROC&lt;&#x2F;code&gt;) from outside of that body.&lt;&#x2F;li&gt;
&lt;li&gt;There can be no jump or step to &lt;code&gt;BEGINPROC&lt;&#x2F;code&gt; at all -- only &lt;code&gt;CALLPROC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The specified &lt;code&gt;n_inputs&lt;&#x2F;code&gt; and &lt;code&gt;n_outputs&lt;&#x2F;code&gt; must be on the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Multi-byte opcodes prefixed by EB and EC.</title>
        <published>2021-12-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Brayton Goodall</name><uri>https://github.com/Spore-Druid-Bray</uri>
	</author>
	
	<author>
		<name>Mihir Faujdar</name><uri>https://github.com/uink45</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4520/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/multi-byte-opcodes/7681" />
        

        <id>https://wg-eips.ritovision.com/4520/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4520"
            label="EIP-4520" />
        

        
        

        
        <summary type="html">Reserve `0xEB` and `0xEC` for usage as extended opcode space.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4520/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reserve &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; for usage as extended opcode space.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It would be convenient to introduce new opcodes that are likely to be infrequently used, whilst also being able to have greater than 256 opcodes in total. As a single byte opcode is half the size of a double byte opcode, the greatest efficiency in code sizes will be one where frequently used opcodes are single bytes. Two prefix bytes are used to accommodate up to 510 double byte opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For example, a new arithmetic opcode may be allocated to &lt;code&gt;0xEC 01&lt;&#x2F;code&gt;(&lt;code&gt;ADD&lt;&#x2F;code&gt;), and a novel opcode may be introduced at &lt;code&gt;0xEB F4&lt;&#x2F;code&gt;(&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Triple byte opcodes may be doubly-prefixed by &lt;code&gt;0xEB EB&lt;&#x2F;code&gt;, &lt;code&gt;0xEC EC&lt;&#x2F;code&gt;, &lt;code&gt;0xEB EC&lt;&#x2F;code&gt; and &lt;code&gt;0xEC EB&lt;&#x2F;code&gt;. It is possible to allocate experimental opcodes to this triple-byte space initially, and if they prove safe and useful, they could later be allocated a location in double-byte or single-byte space.&lt;&#x2F;p&gt;
&lt;p&gt;Only &lt;code&gt;0xEB EB&lt;&#x2F;code&gt;, &lt;code&gt;0xEC EC&lt;&#x2F;code&gt;, &lt;code&gt;0xEC EC&lt;&#x2F;code&gt;, and &lt;code&gt;0xEB EC&lt;&#x2F;code&gt; may be interpreted as further extensions of the opcode space. &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; do not themselves affect the stack or memory, however opcodes specified by further bytes may. If a multi-byte opcode is yet to be defined, it is to be treated as &lt;code&gt;INVALID&lt;&#x2F;code&gt; rather than as a &lt;code&gt;NOP&lt;&#x2F;code&gt;, as per usual for undefined opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It was considered that two prefix bytes rather than one would be adequate for reservation as extension addresses. Both &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; were chosen to be part of the E-series of opcodes. For example, the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte is reserved for contracts conforming to the Ethereum Object Format. By having unassigned opcodes for extending the opcode space, there will be a lower risk of breaking the functionalities of deployed contracts compared to choosing assigned opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Previous usage of &lt;code&gt;0xEB&lt;&#x2F;code&gt; and &lt;code&gt;0xEC&lt;&#x2F;code&gt; may result in unexpected behaviour and broken code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction calldata gas cost reduction with total calldata limit</title>
        <published>2021-11-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4488/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4488-transaction-calldata-gas-cost-reduction-with-total-calldata-limit/7555" />
        

        <id>https://wg-eips.ritovision.com/4488/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4488"
            label="EIP-4488" />
        

        
        

        
        <summary type="html">Greatly decreases the gas cost of transaction calldata and simultaneously caps total transaction calldata in a block</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4488/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Decrease transaction calldata gas cost, and add a limit of how much total transaction calldata can be in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Rollups are in the short and medium term, and possibly the long term, the only trustless scaling solution for Ethereum. Transaction fees on L1 have been very high for months and there is greater urgency in doing anything required to help facilitate an ecosystem-wide move to rollups. Rollups are significantly reducing fees for many Ethereum users: Optimism and Arbitrum frequently provide fees that are ~3-8x lower than the Ethereum base layer itself, and ZK rollups, which have better data compression and can avoid including signatures, have fees ~40-100x lower than the base layer.&lt;&#x2F;p&gt;
&lt;p&gt;However, even these fees are too expensive for many users. The long-term solution to the long-term inadequacy of rollups by themselves has always been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs#sharding&quot;&gt;data sharding&lt;&#x2F;a&gt;, which would add ~1-2 MB&#x2F;sec of dedicated data space for rollups to the chain. However, data sharding will still take a considerable amount of time to finish implementing and deploying. Hence, a short-term solution to further cut costs for rollups, and to incentivize an ecosystem-wide transition to a rollup-centric Ethereum, is desired.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP presents a quick-to-implement short-term solution that also mitigates security risks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;NEW_CALLDATA_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BASE_MAX_CALLDATA_PER_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1,048,576&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;CALLDATA_PER_TX_STIPEND&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;300&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Reduce the gas cost of transaction calldata to &lt;code&gt;NEW_CALLDATA_GAS_COST&lt;&#x2F;code&gt; per byte, regardless of whether the byte is zero or nonzero.&lt;&#x2F;p&gt;
&lt;p&gt;Add a rule that a block is only valid if &lt;code&gt;sum(len(tx.calldata) for tx in block.txs) &amp;lt;= BASE_MAX_CALLDATA_PER_BLOCK + len(block.txs) * CALLDATA_PER_TX_STIPEND&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A natural alternative proposal is to decrease &lt;code&gt;NEW_CALLDATA_GAS_COST&lt;&#x2F;code&gt; without adding a limit. However, this presents a security concern: today, the average block size &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;blocksize&quot;&gt;is 60-90 kB&lt;&#x2F;a&gt;, but the &lt;em&gt;maximum&lt;&#x2F;em&gt; block size is &lt;code&gt;30M &#x2F; 16 = 1,875,000&lt;&#x2F;code&gt; bytes (plus about a kilobyte of block and tx overhead). Simply decreasing the calldata gas cost from 16 to 3 would increase the maximum block size to 10M bytes. This would push the Ethereum p2p networking layer to unprecedented levels of strain and risk breaking the network; some previous live tests of ~500 kB blocks a few years ago had already taken down a few bootstrap nodes.&lt;&#x2F;p&gt;
&lt;p&gt;The decrease-cost-and-cap proposal achieves most of the benefits of the decrease, as rollups are unlikely to &lt;em&gt;dominate&lt;&#x2F;em&gt; Ethereum block space in the short term future and so 1.5 MB will be sufficient, while preventing most of the security risk.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, the Ethereum protocol community has been suspicious of multi-dimensional resource limit rules (in this case, gas and calldata) because such rules greatly increase the complexity of the block packing problem that proposers (today miners, post-merge validators) need to solve. Today, proposers can generate blocks with near-optimal fee revenue by simply choosing transactions in highest-to-lowest order of priority fee. In a multi-dimensional world, proposers would have to deal with multi-dimensional constraints. Multi-dimensional knapsack problems are much more complicated than the single-dimensional equivalent, and well-optimized proprietary implementations built by pools may well outperform default open source implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Today, there are two key reasons why this is less of a problem than before:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; means that, at least most of the time, the problem that block proposers are solving is &lt;em&gt;not&lt;&#x2F;em&gt; a knapsack problem. Rather, block proposers are simply including all the transactions they can find with sufficient base fee and priority fee. Hence, naive algorithms will also frequently generate close-to-optimal results.&lt;&#x2F;li&gt;
&lt;li&gt;The existence of sophisticated proprietary strategies for miner extractable value (MEV) extraction means that decentralized optimal block production is already in the medium and long term a lost cause. Research is instead going into solutions that separate away the specialization-friendly task of block body generation from the role of a validator (&quot;proposer&#x2F;builder separation&quot;). Instead of being a fundamental change, two-dimensional knapsack problems today would be merely &quot;yet another&quot; MEV opportunity.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Hence, it&#x27;s worth rethinking the historical opposition to multi-dimensional resource limits and considering them as a pragmatic way to simultaneously achieve moderate scalability gains while retaining security.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the stipend mechanism makes the two-dimensional optimization problem even less of an issue in practice. 90% of all transactions (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4488&#x2F;.&#x2F;assets&#x2F;gas_and_calldata_sample.csv&quot;&gt;sample&lt;&#x2F;a&gt; taken from blocks &lt;code&gt;13500000, 13501000 ... 13529000&lt;&#x2F;code&gt;) have &amp;lt;300 bytes of calldata. Hence, if a naive transaction selection algorithm overfills the calldata of a block that the proposer is creating, the proposer will still be able to keep adding transactions from 90% of their mempool.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a backwards incompatible gas repricing that requires a scheduled network upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Users will be able to continue operating with no changes.&lt;&#x2F;p&gt;
&lt;p&gt;Miners will be able to continue operating with no changes except for a rule to stop adding new transactions into a block when the total calldata size reaches the maximum. However, there are pragmatic heuristics that they could add to achieve closer-to-optimal returns in such cases: for example, if a block fills up to the size limit, they could repeatedly remove the last data-heavy transaction and replace it with as many data-light transactions as possible, until doing so is no longer profitable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;em&gt;burst&lt;&#x2F;em&gt; data capacity of the chain does not increase as a result of this proposal (in fact, it slightly decreases). However, the &lt;em&gt;average&lt;&#x2F;em&gt; data capacity will increase. This means that the storage requirements of history-storing will go up. A worst-case scenario would be a theoretical long-run maximum of ~1,262,861 bytes per 12 sec slot, or ~3.0 TB per year.&lt;&#x2F;p&gt;
&lt;p&gt;We recommend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4444&#x2F;&quot;&gt;EIP-4444&lt;&#x2F;a&gt; or some similar history expiry proposal be implemented either at the same time or soon after this EIP to mitigate this risk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Supplant DIFFICULTY opcode with PREVRANDAO</title>
        <published>2021-10-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4399/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4399-supplant-difficulty-opcode-with-random/7368" />
        

        <id>https://wg-eips.ritovision.com/4399/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:4399"
            label="EIP-4399" />
        

        
        

        
        <summary type="html">Expose beacon chain randomness in the EVM by supplanting DIFFICULTY opcode semantics</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4399/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP supplants the semantics of the return value of existing &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcode and renames the opcode to &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The return value of the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; instruction after this change is the output of the randomness beacon provided by the beacon chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Applications may benefit from using the randomness accumulated by the beacon chain. Thus, randomness outputs produced by the beacon chain should be accessible in the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;At the point of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; of the Proof-of-Stake (PoS) upgrade described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt;, the &lt;code&gt;difficulty&lt;&#x2F;code&gt; block field &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be &lt;code&gt;0&lt;&#x2F;code&gt; thereafter because there is no longer any Proof-of-Work (PoW) seal on the block. This means that the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; instruction no longer has it&#x27;s previous semantic meaning, nor a clear &quot;correct&quot; value to return.&lt;&#x2F;p&gt;
&lt;p&gt;Given prior analysis on the usage of &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt;, the value returned by the instruction mixed with other values is a common pattern used by smart contracts to obtain randomness. The instruction with the same number as the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode returning outputs of the beacon chain RANDAO implementation makes the upgrade to PoS backwards compatible for existing smart contracts obtaining randomness from the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, changes proposed by this EIP allow for smart contracts to determine whether the upgrade to the PoS has already happened. This can be done by analyzing the return value of the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; instruction. A value greater than &lt;code&gt;2**64&lt;&#x2F;code&gt; indicates that the transaction is being executed in the PoS block. Decompilers and other similar tooling may also use this trick to discern the new semantics of the instruction if data of the block including the transaction in question is available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The definition of this block can be found in the Definitions section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#definitions&quot;&gt;EIP-3675&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, client software &lt;strong&gt;MUST&lt;&#x2F;strong&gt; set the value of the &lt;code&gt;mixHash&lt;&#x2F;code&gt;, i.e. the field with the number &lt;code&gt;13&lt;&#x2F;code&gt; (0-indexed) in a block header, to the latest RANDAO mix of the post beacon state of the previous block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm&quot;&gt;EVM&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; instruction &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the value of the &lt;code&gt;mixHash&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: The gas cost of the &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcode remains unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;renaming&quot;&gt;Renaming&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mixHash&lt;&#x2F;code&gt; field &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; further be renamed to &lt;code&gt;prevRandao&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcode &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; further be renamed to &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;including-randao-output-in-the-block-header&quot;&gt;Including RANDAO output in the block header&lt;&#x2F;h3&gt;
&lt;p&gt;Including a RANDAO output in the block header provides a straightforward method of accessing it from inside of the EVM as block header data is already available in the EVM context.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, this ensures that the execution layer can be fully executed with the block alone rather than requiring extra inputs from the PoS consensus layer.&lt;&#x2F;p&gt;
&lt;p&gt;Mixing the randomness into a block header may contribute to uniqueness of the block hash in the case when values of other fields of the block header match the corresponding values of the header of another block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-mixhash-field-instead-of-difficulty&quot;&gt;Using &lt;code&gt;mixHash&lt;&#x2F;code&gt; field instead of &lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mixHash&lt;&#x2F;code&gt; header field is used instead of &lt;code&gt;difficulty&lt;&#x2F;code&gt; to avoid a class of hidden forkchoice bugs after the PoS upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Client software implementing pre-EIP-3675 logic heavily depends on the &lt;code&gt;difficulty&lt;&#x2F;code&gt; value as total difficulty computation is the basis of the PoW fork choice rule. Setting the &lt;code&gt;difficulty&lt;&#x2F;code&gt; field to &lt;code&gt;0&lt;&#x2F;code&gt; at the PoS upgrade aims to reduce the surface of bugs related to the total difficulty value growing after the upgrade.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, any latent total difficulty computation after the PoS upgrade would become overflow prone if the randomness output supplanted the value of the &lt;code&gt;difficulty&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reusing-existing-field-instead-of-appending-a-new-one&quot;&gt;Reusing existing field instead of appending a new one&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;mixHash&lt;&#x2F;code&gt; field is deprecated at the PoS upgrade and set to zero bytes array thereafter. Reusing an existing field as a place for the randomness output saves 32 bytes per block and effectively removes the deprecation of one of the fields induced by the upgrade.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reusing-the-difficulty-opcode-instead-of-introducing-a-new-one&quot;&gt;Reusing the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode instead of introducing a new one&lt;&#x2F;h3&gt;
&lt;p&gt;See the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;#motivation&quot;&gt;Motivation&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;renaming-the-field-and-the-opcode&quot;&gt;Renaming the field and the opcode&lt;&#x2F;h3&gt;
&lt;p&gt;The renaming should be done to make the field and the opcode names semantically sound.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-transition-block-rather-than-a-block-or-slot-number&quot;&gt;Using &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; rather than a block or slot number&lt;&#x2F;h3&gt;
&lt;p&gt;By utilizing &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; to trigger the change in logic defined in this EIP rather than a block or slot number, this EIP is tightly coupled to the PoS upgrade defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;By tightly coupling to the PoS upgrade, we ensure that there is no discontinuity for the usecase of this opcode for randomness -- the primary &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;#motivation&quot;&gt;motivation&lt;&#x2F;a&gt; for re-using &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; rather than creating a new opcode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;using-2-64-threshold-to-determine-pos-blocks&quot;&gt;Using &lt;code&gt;2**64&lt;&#x2F;code&gt; threshold to determine PoS blocks&lt;&#x2F;h3&gt;
&lt;p&gt;The probability of RANDAO value to fall into the range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2**64&lt;&#x2F;code&gt; and, thus, to be mixed with PoW difficulty values, is drastically low. Though, proposed threshold might seem to have insufficient distance from difficulty values on Ethereum Mainnet (they are currently around &lt;code&gt;2**54&lt;&#x2F;code&gt;), it requires a thousand times increase of the hashrate to make this threshold insecure. Such an increase is considered impossible to occur before the upcoming consensus upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatible changes to the execution and validation of EVM state transitions. As written, this EIP utilizes &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; and is thus tightly coupled with the PoS upgrade introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;&quot;&gt;EIP-3675&lt;&#x2F;a&gt;. If this EIP is to be adopted, it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be scheduled at the same time as EIP-3675.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, the changes proposed might be backward incompatible for the following categories of applications:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Applications that use the value returned by the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode as the PoW &lt;code&gt;difficulty&lt;&#x2F;code&gt; parameter&lt;&#x2F;li&gt;
&lt;li&gt;Applications with logic that depends on the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode returning a relatively small number with respect to the full 256-bit size of the field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first category is already affected by switching the consensus mechanism to PoS and no additional breaking changes are introduced by this specification.&lt;&#x2F;p&gt;
&lt;p&gt;The second category is comprised of applications that use the return value of the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; opcode in operations that might cause either overflow or underflow errors. While it is theoretically possible to author an application where a change in the range of possible values this opcode may return could lead to a security vulnerability, the chances of that are negligible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;In one of ancestors of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; deploy a contract that stores return value of  &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; to the state&lt;&#x2F;li&gt;
&lt;li&gt;Check that value returned by &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; in transaction executed within the parent of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; equals &lt;code&gt;difficulty&lt;&#x2F;code&gt; field value&lt;&#x2F;li&gt;
&lt;li&gt;Check that value returned by &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt; in transaction executed within &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; equals &lt;code&gt;prevRandao&lt;&#x2F;code&gt; field value&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt; opcode in PoS Ethereum (based on the beacon chain RANDAO implementation) is a source of randomness with different properties to the randomness supplied by &lt;code&gt;BLOCKHASH (0x40)&lt;&#x2F;code&gt; or &lt;code&gt;DIFFICULTY (0x44)&lt;&#x2F;code&gt; opcodes in the PoW network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;biasability&quot;&gt;Biasability&lt;&#x2F;h3&gt;
&lt;p&gt;The beacon chain RANDAO implementation gives every block proposer 1 bit of influence power per slot. Proposer may deliberately refuse to propose a block on the opportunity cost of proposer and transaction fees to prevent beacon chain randomness (a RANDAO mix) from being updated in a particular slot.&lt;&#x2F;p&gt;
&lt;p&gt;An effect of proposer&#x27;s influence power is limited in time and lasts until the first honest RANDAO reveal is made afterwards. This limitation does also exist in the case when proposers of &lt;code&gt;n&lt;&#x2F;code&gt; consecutive slots are colluding to get &lt;code&gt;n&lt;&#x2F;code&gt; bits of influence power. Simply speaking, one honest block proposal is enough to unbias the RANDAO even if it was biased during several slots in a row.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, semantics of the &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt; instruction gives proposers another way to gain 1 bit of influence power on applications. Biased proposer may censor a rolling the dice transaction to force it to be included into the next block, thus, force it to use a RANDAO mix that the proposer knows in advance. The opportunity cost in this case would be negligible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;predictability&quot;&gt;Predictability&lt;&#x2F;h3&gt;
&lt;p&gt;Obviously, historical randomness provided by any decentralized oracle is 100% predictable. On the contrary, the randomness that is revealed in the future is predictable up to a limited extent.&lt;&#x2F;p&gt;
&lt;p&gt;A list of inputs influencing future randomness on the beacon chain consists of but is not limited to the following items:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Accumulated randomness.&lt;&#x2F;strong&gt; A RANDAO mix produced by the beacon chain in the last slot of epoch &lt;code&gt;N&lt;&#x2F;code&gt; is the main input to the function defining block proposers in each slot of epoch &lt;code&gt;N + MIN_SEED_LOOKAHEAD + 1&lt;&#x2F;code&gt;, i.e. it is the main factor defining future RANDAO revealers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Number of active validators.&lt;&#x2F;strong&gt; A number of active validators throughout an epoch is another input to the block proposer function.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Effective balance.&lt;&#x2F;strong&gt; All else being equal, the lower the effective balance of a validator the lower the chance this validator has to be designated as a proposer in a slot.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Accidentally missed proposals.&lt;&#x2F;strong&gt; Network conditions and other factors that are resulting in accidentally missed proposals is a source of highly qualitative entropy that impacts RANDAO mixes. Usual rate of missed proposals on the Mainnet is about &lt;code&gt;1%&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These inputs may be predictable and malleable on a short range of slots but the longer the attempted lookahead the more entropy is accumulated by the beacon chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tips-for-application-developers&quot;&gt;Tips for application developers&lt;&#x2F;h3&gt;
&lt;p&gt;The following tips attempt to reduce predictability and biasability of randomness outputs returned by &lt;code&gt;PREVRANDAO (0x44)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Make your applications rely on the future randomness with a reasonably high lookahead. For example, an application stops accepting bids at the end of epoch &lt;code&gt;K&lt;&#x2F;code&gt; and uses a RANDAO mix produced in slot &lt;code&gt;K + N + ε&lt;&#x2F;code&gt; to roll the dice, where &lt;code&gt;N&lt;&#x2F;code&gt; is a lookahead in epochs and &lt;code&gt;ε&lt;&#x2F;code&gt; is a few slots into epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;At least four epochs of lookahead results in the following outcome:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;ul&gt;
&lt;li&gt;A proposer set of epoch &lt;code&gt;N + 1&lt;&#x2F;code&gt; isn&#x27;t known at the end of epoch &lt;code&gt;K&lt;&#x2F;code&gt; breaking a direct link between bidders and dice rollers&lt;&#x2F;li&gt;
&lt;li&gt;A number of active validators is updated at the end of each epoch affecting a set of proposers of next epochs, thus, impacting a RANDAO mix used by the application to roll the dice&lt;&#x2F;li&gt;
&lt;li&gt;Due to Mainnet statistics, there is about a &lt;code&gt;100%&lt;&#x2F;code&gt; chance for the network to accidentally miss a proposal during this period of time which reduces predictability of a RANDAO mix used to roll the dice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;ol start=&quot;3&quot;&gt;
&lt;li&gt;Setting &lt;code&gt;ε&lt;&#x2F;code&gt; to a small number, e.g. 2 or 4 slots, gives a third party a little time to gain influence power on the future randomness that is being used to roll the dice. This amount of time is defined by &lt;code&gt;MIN_SEED_LOOKAHEAD&lt;&#x2F;code&gt; parameter and is about 6 minutes on the Mainnet.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;A reasonably high distance between bidding and rolling the dice attempts to leave low chance for bidders controlling a subset of validators to directly exploit their influence power. Ultimately, this chance depends on the type of the game and on a number of controlled validators. For instance, a chance of a single validator to affect a one-time game is negligible, and becomes bigger for multiple validators in a repeated game scenario.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Time-Aware Base Fee Calculation</title>
        <published>2021-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4396/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4396-time-aware-base-fee-calculation/7363" />
        

        <id>https://wg-eips.ritovision.com/4396/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4396"
            label="EIP-4396" />
        

        
        

        
        <summary type="html">Accounts for block time in the base fee calculation to target a stable throughput by time instead of by block.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4396/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes accounting for time between blocks in the base fee calculation to target a stable throughput by time, instead of by block. Aiming to minimize changes to the calculation, it only introduces a variable block gas target proportional to the block time. The EIP can, in principle, be applied to either a Proof-of-Work or a Proof-of-Stake chain, however the security implications for the Proof-of-Work case remain unexplored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current base fee calculation chooses the gas usage of a block as the signal to determine whether demand for block space is too low (indicating that the base fee should be lowered) or too high (indicating that the base fee should be increased). While simple, this choice of signal has drawbacks: it does not take the block time into account. Assuming a relatively constant demand, a proposer constructing a block after 20 seconds will have transactions available with twice the gas of a proposer constructing a block after 10 seconds. Using the same gas target for both is accordingly sub-optimal. In practice, there are several undesirable consequences of this flawed signal:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;base-fee-volatility-under-proof-of-work&quot;&gt;Base Fee Volatility Under Proof-of-Work&lt;&#x2F;h3&gt;
&lt;p&gt;Under Proof-of-Work (PoW), block times are stochastic, and for that reason there exists large block time variability. This variability contributes to the base fee volatility, where the base fee can be expected to oscillate around the equilibrium value even under perfectly stable demand.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;missed-slots&quot;&gt;Missed Slots&lt;&#x2F;h3&gt;
&lt;p&gt;Under Proof-of-Stake (PoS), block times are ideally uniform (always 12s), but missed slots lead to individual blocks with increased block time (24s, 36s, ...). Such missed slots will result in the next block being overfull, and with the current update rule, signal a fake demand spike and thus cause a small unwarranted base fee spike.&lt;&#x2F;p&gt;
&lt;p&gt;More importantly, these missed slots directly reduce the overall throughput of the execution chain by the gas target of one block. While the next block can be expected to include the &quot;delayed&quot; transactions of the missed slot, the resulting base fee spike then results in some number of under-full blocks. In the end the block space of the missed slot is lost for the chain.&lt;&#x2F;p&gt;
&lt;p&gt;This is particularly problematic because a Denial-of-Service (DoS) attack on block proposers can cause them to miss slots, and compromises the overall chain performance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throughput-degradation-during-consensus-issues&quot;&gt;Throughput Degradation During Consensus Issues&lt;&#x2F;h3&gt;
&lt;p&gt;A more severe version of individual missed slots can be caused by consensus issues that prevent a significant portion of block proposers from continuing to create blocks. This can be due to block proposers forking off (and creating blocks on their own fork), being unable to keep up with the current chain head for another reason, or simply being unable to create valid blocks.&lt;&#x2F;p&gt;
&lt;p&gt;In all these situations, average block times go up significantly, causing chain throughput to fall by the same fraction. While this effect is already present under PoW, the self-healing mechanism of difficulty adjustments is relatively quick to kick in and restore normal block times. On the other hand, under PoS the automatic self-healing mechanism can be extremely slow: potentially several months to return to normal with up to a third of slots missed, or several weeks if more than a third of slots are missed.&lt;&#x2F;p&gt;
&lt;p&gt;For all these reasons, it would be desirable to target a stable throughput per time instead of per block, by taking block time into account during the base fee calculation.&lt;&#x2F;p&gt;
&lt;p&gt;To maximize the chance of this EIP being included in the merge fork, the adjustments are kept to a minimum, with more involved changes discussed in the rationale section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Using the pseudocode language of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt;, the updated base fee calculation becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BLOCK_TIME_TARGET&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 95&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; World&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ABC&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_block_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; parent_block_time&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_TIME_TARGET&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_GAS_TARGET_PERCENT&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_adjusted_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_base_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;mechanism&quot;&gt;Mechanism&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed new base fee calculation only adjusts the block gas target by scaling it with the block time, capped at a maximum percent of the overall block gas limit:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;current-base-fee-calculation&quot;&gt;Current Base Fee Calculation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;old_formula.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;proposed-base-fee-calculation&quot;&gt;Proposed Base Fee Calculation&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;new_formula.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This new calculation thus targets a stable throughput per time instead of per block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;limitations&quot;&gt;Limitations&lt;&#x2F;h3&gt;
&lt;p&gt;Under PoS, block time increases always come in multiples of full blocks (e.g. a single missed slot = 24s instead of 12s block time). Accounting for this already requires doubling the block gas target, even for a single missed slot. However, with the block elasticity currently set to 2, this target would be equal to the block gas limit. Having the new target equal to the block gas limit is less than ideal, and thus is reduced slightly, according to the &lt;code&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;code&gt; parameter. The reason for the existence of this parameter is twofold:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ensure that the signal remains meaningful: A target equal to or greater than the gas limit could never be reached, so the base fee would always be reduced after a missed slot.&lt;&#x2F;li&gt;
&lt;li&gt;Ensure that the base fee can still react to genuine demand increases: During times of many offline block proposers (and thus many missed slots), genuine demand increases still need a way to eventually result in a base fee increase, to avoid a fallback to a first-price priority fee auction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;However, this means that even a single missed slot cannot be fully compensated. Even worse, any second or further sequential missed slot cannot be compensated for at all, as the gas target is already at its max. This effect becomes more pronounced as the share of offline validators increases:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;degradation.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As can be observed, while this EIP does indeed increase the robustness of the network throughput in cases of offline validators, it does so imperfectly. Furthermore, there is a tradeoff effected by the &lt;code&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;code&gt; parameter, with a higher value resulting in a higher network robustness, but a more impaired base fee adjustment mechanism during times of frequent missed slots.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-extensions&quot;&gt;Possible Extensions&lt;&#x2F;h3&gt;
&lt;p&gt;These limitations directly result from the design goal of a minimal change, to maximize chances of being included in the merge. There are natural ways of extending the EIP design to more effectively handle offline validators, at the expense of somewhat more extensive changes:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;persistent-multi-slot-buffer&quot;&gt;Persistent Multi-Slot Buffer&lt;&#x2F;h4&gt;
&lt;p&gt;To be able to compensate multiple consecutive missed slots, a gas buffer could be introduced, that would allow the gas beyond the block elasticity to be carried forward to future blocks. To avoid long-run buffer accumulation that would delay a return to normal operations once block proposers are back online, a cap on the buffer would be added. Even for a relatively small buffer cap, the throughput robustness is significantly improved:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;degradation_buffers.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;With an elasticity still at 2, there is no way of avoiding the eventual breakdown for more than 50% offline block proposers.&lt;&#x2F;p&gt;
&lt;p&gt;The main implementation complexity for this approach comes from the introduction of the buffer as a new persistent field. To retain the ability for calculating base fees only based on headers, it would have to be added to the block header.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;increased-block-elasticity&quot;&gt;Increased Block Elasticity&lt;&#x2F;h4&gt;
&lt;p&gt;In addition to the introduction of a buffer, increasing the block elasticity is another tool for increasing throughput robustness. The following diagram shows the effect of different elasticity levels, both in the presence and absence of a persistent buffer:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4396&#x2F;.&#x2F;assets&#x2F;degradation_elasticity.png&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Again, a clear positive effect can be observed.&lt;&#x2F;p&gt;
&lt;p&gt;The main additional complexity here would come from the increased peak load (networking, compute &amp;amp; disk access) of multiple sequential overfull blocks. Note though that PoS with its minimum block time of 12s significantly reduces worst case peak stress as compared to PoW.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP has minimal impact on backwards compatibility, only requiring updates to existing base fee calculation tooling.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;tbd&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;tbd&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;timestamp-manipulation&quot;&gt;Timestamp Manipulation&lt;&#x2F;h3&gt;
&lt;p&gt;Under PoW, miners are in control over the timestamp field of their blocks. While there are some enforced limits to valid timestamps, implications regarding potential timestamp manipulation are nontrivial and remain unexplored for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Under PoS, each slot has a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;consensus-specs&#x2F;blob&#x2F;v1.1.3&#x2F;specs&#x2F;merge&#x2F;beacon-chain.md#process_execution_payload&quot;&gt;fixed assigned timestamp&lt;&#x2F;a&gt;, rendering any timestamp manipulation by block proposers impossible.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;suppressing-base-fee-increases&quot;&gt;Suppressing Base Fee Increases&lt;&#x2F;h3&gt;
&lt;p&gt;As discussed in the rationale, a high value for &lt;code&gt;MAX_GAS_TARGET_PERCENT&lt;&#x2F;code&gt; during times of many offline block proposers results in a small remaining signal space for genuine demand increases that should result in base fee increases. This in turn decreases the cost for block proposers for suppresing these base fee increases, instead forcing the fallback to a first-price priority fee auction.&lt;&#x2F;p&gt;
&lt;p&gt;While the arguments of incentive incompatibility for base fee suppression of the base EIP-1559 case still apply here, with a decreasing cost of this individually irrational behavior the risk for overriding psychological factors becomes more significant.&lt;&#x2F;p&gt;
&lt;p&gt;Even in such a case the system degradation would however be graceful, as it would only temporarily suspend the base fee burn. As soon as the missing block proposers would come back online, the system would return to its ordinary EIP-1559 equilibrium.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Difficulty Bomb Delay to June 2022</title>
        <published>2021-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tim Beiko</name><uri>https://github.com/timbeiko</uri>
	</author>
	
	<author>
		<name>James Hancock</name><uri>https://github.com/MadeOfTin</uri>
	</author>
	
	<author>
		<name>Thomas Jay Rush</name><uri>https://github.com/tjayrush</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4345/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4345-difficulty-bomb-delay-to-may-2022/7209" />
        

        <id>https://wg-eips.ritovision.com/4345/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:4345"
            label="EIP-4345" />
        

        
        

        
        <summary type="html">Delays the difficulty bomb to be noticeable in June 2022.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4345/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 10,700,000 blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Targeting for The Merge to occur before June 2022. If it is not ready by then, the bomb can be delayed further.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fake_block_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10_700_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The following script predicts a ~0.1 second delay to block time by June 2022 and a ~0.5 second delay by July 2022. This gives reason to address because the effect will be seen, but not so much urgency we don&#x27;t have space to work around if needed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;current_blknum&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; months&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Predicts the effect on block time (as a ratio) in a specified amount of months in the future.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Vars used for predictions:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_blknum = 13423376 # Oct 15, 2021&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_difficulty = 9545154427582720&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    block adjustment = 10700000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    months = 7.5 # June 2022&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    months = 8.5 # July 2022&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;86400&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13.3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; months&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; **&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; diff_adjust_coeff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13423376&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9545154427582720&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7.5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;13423376&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9545154427582720&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8.5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications.&lt;&#x2F;p&gt;
&lt;p&gt;In this specific instance, it is possible that the network hashrate drops considerably before The Merge, which could accelerate the timeline by which the bomb is felt in block times. The offset value chosen aimed to take this into account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas refunds on reverts</title>
        <published>2021-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anton Bukov</name><uri>https://github.com/k06a</uri>
	</author>
	
	<author>
		<name>Mikhail Melnik</name><uri>https://github.com/ZumZoom</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3978/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3978-gas-refunds-on-reverts/7071/" />
        

        <id>https://wg-eips.ritovision.com/3978/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3978"
            label="EIP-3978" />
        

        
        

        
        <summary type="html">Reprice reverted SSTORE&#x2F;CREATE&#x2F;SELFDESTRUCT&#x2F;LOGX operations gas via gas refund mechanism</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3978/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;For reverted state modification operations, keep access cost, but refund modification cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Reverting a transaction, or any of its sub-calls, drops any state modifications that happened inside.
But now, users are being charged for the dropped modifications as if they persisted.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3298&#x2F;&quot;&gt;EIP-3298&lt;&#x2F;a&gt;, the gas refund mechanism works for storage restores only inside the same transaction. But on revert, the gas refund is not increased; it is completely erased.
It can even be cheaper to transfer tokens back at the end of a transaction instead of reverting, to keep the existing gas refund.
This should be changed.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reverted SSTORE deserves to be repriced to SLOAD gas (100 gas)&lt;&#x2F;li&gt;
&lt;li&gt;Reverted LOG0, LOG1, LOG2, LOG3 and LOG4 deserve to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted CALL with value (&lt;code&gt;positive_value_cost&lt;&#x2F;code&gt; = 9,000 gas) deserves to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted CALL with value and account creation (&lt;code&gt;value_to_empty_account_cost&lt;&#x2F;code&gt; = 25,000 gas) deserves to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted CREATE and CREATE2 (32,000 gas) deserve to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;li&gt;Reverted SELFDESTRUCT (5,000 or 25,000 gas) deserves to be repriced to 100 gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Moreover, it seems fair to charge CREATE and CREATE2 operations 32,000 fix price conditionally only if returned bytecode is not empty.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For each callframe, track &lt;code&gt;revert_gas_refund&lt;&#x2F;code&gt;, initially 0.&lt;&#x2F;p&gt;
&lt;p&gt;The set of operations that modify &lt;code&gt;revert_gas_refund&lt;&#x2F;code&gt; are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SSTORE&lt;&#x2F;li&gt;
&lt;li&gt;LOG0, LOG1, LOG2, LOG3, LOG4&lt;&#x2F;li&gt;
&lt;li&gt;CALL&lt;&#x2F;li&gt;
&lt;li&gt;CREATE, CREATE2&lt;&#x2F;li&gt;
&lt;li&gt;SELFDESTRUCT&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;They increase &lt;code&gt;revert_gas_refund&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;revert_gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; operation&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; WARM_STORAGE_READ_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And in case of revert let&#x27;s use this value instead of just erasing &lt;code&gt;gas_refund&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;reverted&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; existing behavior&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas_refund&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; New behavior added to existing according to the EIP-3978&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; call&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;revert_gas_refund&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Gas should reflect the cost of use.
The revert cost reflects the cost of access during execution, but not the cost of modification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward incompatibilities.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Strict enforcement of chainId</title>
        <published>2021-09-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gregory Markou</name><uri>https://github.com/GregTheGreek</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3788/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-to-eip-3788-strict-enforcement-of-chainid/7001" />
        

        <id>https://wg-eips.ritovision.com/3788/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3788"
            label="EIP-3788" />
        

        
        

        
        <summary type="html">Reject transactions that do not explicitly have the same chainId as the node&#x27;s configuration.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3788/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reject transactions that do not explicitly have the same chainId as the node&#x27;s configuration.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; a transaction with a &lt;code&gt;chainId = 0&lt;&#x2F;code&gt; is considered to be a valid
transaction. This was a feature to offer developers the ability to submit replayable transactions
across different chains. With the rise of evm compatible chains, many of which use forks, or packages
from popular Ethereum clients, we are putting user funds at risk. This is because most wallet
interfaces do not expose the chainId to the user, meaning they typically do not have insight
into what chainId they are signing. Should a malicious actor (or accidental) choose to, they
can easily have users submit transactions with a &lt;code&gt;chainId = 0&lt;&#x2F;code&gt; on a non-mainnet network, allowing
the malicious actor to replay the transaction on ethereum mainnet (or other networks for that matter)
as a grief or sophisticated attack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As of the fork block &lt;code&gt;N&lt;&#x2F;code&gt;, consider transactions with a &lt;code&gt;chaindId = 0&lt;&#x2F;code&gt; to be invalid. Such that
transactions are verified based on the nodes configuration. Eg:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (node.cfg.chainId != tx.chainId) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Reject transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The configuration set by the node is the main source of truth, and thus should be explicitly used
when deciding how to filter out a transaction. This check should exist in two places, as a filter
on the JSON-RPC (eg: &lt;code&gt;eth_sendTransaction&lt;&#x2F;code&gt;), and strictly enforced on the EVM during transaction
validation.&lt;&#x2F;p&gt;
&lt;p&gt;This ensures that users will not have transactions pending that will be guaranteed to fail, and
prevents the transaction from being included in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This breaks all applications or tooling that submit transactions with a &lt;code&gt;chainId == 0&lt;&#x2F;code&gt; after block number &lt;code&gt;N&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It should be noted this will not prevent a malicious actor from deploying a network with &lt;code&gt;chainId = 1&lt;&#x2F;code&gt;, or copying any other networks chainId.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Safer Control Flow for the EVM</title>
        <published>2021-08-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3779/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3779-safe-control-flow-for-the-evm/6975" />
        

        <id>https://wg-eips.ritovision.com/3779/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3779"
            label="EIP-3779" />
        

        
        

        
        <summary type="html">Ensure an essential level of safety for EVM code.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3779/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We define a safe EVM contract as one that cannot encounter an exceptional halting state.  In general, we cannot prove safety for Turing-complete programs. But we can prove a useful subset.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP specifies validity rules to ensure that:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Valid contracts will not halt with an exception unless they either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;throw &lt;code&gt;out of gas&lt;&#x2F;code&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;recursively overflow stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This EIP does not introduce any new opcodes.  Rather, it restricts the use of existing and proposed control-flow instructions.  The restrictions must be validated at contract initialization time – not at runtime – by the provided algorithm or its equivalent. This algorithm must take time and space near-linear in the size of the contract, so as not to be a denial of service vulnerability.&lt;&#x2F;p&gt;
&lt;p&gt;This specification is entirely semantic.  It imposes no further syntax on bytecode, as none is required to ensure the specified level of safety.  Ethereum Virtual Machine bytecode is just that -- a sequence of bytes that when executed causes a sequence of changes to the machine state.  The safety we seek here is simply to not, as it were, jam up the gears.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;safety&quot;&gt;Safety&lt;&#x2F;h3&gt;
&lt;p&gt;For our purposes we define a safe EVM contract as one that cannot encounter an exceptional halting state.  From the standpoint of security it would be best if unsafe contracts were never placed on the blockchain.  Unsafe code can attempt to overflow stack, underflow stack, execute invalid instructions, and jump to invalid locations.&lt;&#x2F;p&gt;
&lt;p&gt;Unsafe contracts are exploits waiting to happen.&lt;&#x2F;p&gt;
&lt;p&gt;Validating contract safety requires traversing the contract code.  So in order to prevent denial of service attacks all jumps, including the existing &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, and also the other proposed jumps -- &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; -- must be validated at initialization time, and in time and space linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;static-jumps-and-subroutines&quot;&gt;Static Jumps and Subroutines&lt;&#x2F;h4&gt;
&lt;p&gt;The relative jumps of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; and the simple subroutines of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2315&#x2F;&quot;&gt;EIP-2315&lt;&#x2F;a&gt; provide a complete set of static control flow instructions:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; &lt;em&gt;offset&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jumps to &lt;em&gt;IP+offset&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; &lt;em&gt;offset&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jumps if the top of stack is non-zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; offset&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Pushes &lt;em&gt;IP+1&lt;&#x2F;em&gt; on the return stack and jumps to &lt;em&gt;IP+offset&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Jumps to the address popped off the return stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that each jump creates at most two paths of control through the code, such that the complexity of traversing the entire control-flow graph is linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dynamic-jumps&quot;&gt;&lt;em&gt;Dynamic Jumps&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Dynamic jumps, where the destination of a &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is not known until runtime, are an obstacle to proving validity in linear time -- any jump can be to any destination in the code, potentially requiring time quadratic in the size of code. For this reason we have two real choices.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deprecate dynamic jumps. This is easily done:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Define &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; as &lt;code&gt;INVALID&lt;&#x2F;code&gt; for the purposes of EOF Code Validation&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;Constrain dynamic jumps. This requires static analysis.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Consider the simplest and most common case.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;JUMP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is effectively a static jump.&lt;&#x2F;p&gt;
&lt;p&gt;Another important use of &lt;code&gt;JUMP&lt;&#x2F;code&gt; is to implement the return jump from a subroutine. So consider this example of calling and returning from a minimal subroutine:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TEST_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push RTN_SQUARE &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    0x02&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RTN_SQUARE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The return address -&lt;code&gt;RTN_SQUARE&lt;&#x2F;code&gt; - and the destination address - &lt;code&gt;SQUARE&lt;&#x2F;code&gt; - are pushed on the stack as constants and remain unchanged as they move on the stack, such that only those constants are passed to each &lt;code&gt;JUMP&lt;&#x2F;code&gt;. They are effectively static.  We can track the motion of constants on the &lt;code&gt;data stack&lt;&#x2F;code&gt; at validation time, so &lt;em&gt;we do not need unconstrained dynamic jumps to implement subroutines.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;The above is the simplest analysis that suffices.  A more powerful analysis that takes in more use cases is possible -- slower, but still linear-time.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h4&gt;
&lt;p&gt;We can validate the safety of contracts with a static analysis that takes time and space linear in the size of the &lt;em&gt;code&lt;&#x2F;em&gt;, as shown below.  And since we can, we should.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h3&gt;
&lt;p&gt;Validating safe control flow at initialization time has potential performance advantages.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Static jumps do not need to be checked at runtime.&lt;&#x2F;li&gt;
&lt;li&gt;Stack underflow does not need to be checked for at runtime.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;In theory, theory and practice are the same. In practice, they&#x27;re not. -- Albert Einstein&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We define a &lt;em&gt;safe&lt;&#x2F;em&gt; EVM contract as one that cannot encounter an exceptional halting state.  We validate &lt;em&gt;safety&lt;&#x2F;em&gt; at initialization time to the extent practical.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;exceptional-halting-states&quot;&gt;&lt;em&gt;Exceptional Halting States&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;em&gt;execution&lt;&#x2F;em&gt; of each instruction is defined in the Yellow Paper as a change to the EVM state that preserves the invariants of EVM state.  At runtime, if the execution of an instruction would violate an invariant the EVM is in an exceptional halting state.  The Yellow Paper defined five such states.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;More than 1024 stack items&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient stack items&lt;&#x2F;li&gt;
&lt;li&gt;Invalid jump destination&lt;&#x2F;li&gt;
&lt;li&gt;Invalid instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;A program is safe iff no execution can lead to an exceptional halting state.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;We would like to consider EVM programs valid iff they are safe.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;In practice&lt;&#x2F;em&gt;, we must be able to validate &lt;em&gt;code&lt;&#x2F;em&gt; in linear time to avoid denial of service attacks. And we must support dynamically-priced instructions, loops, and recursion, which can use arbitrary amounts of gas and stack.&lt;&#x2F;p&gt;
&lt;p&gt;Thus our validation cannot consider concrete computations -- it only performs a limited symbolic execution of the &lt;em&gt;code&lt;&#x2F;em&gt;.  This means we will reject programs if we detect any invalid execution paths, even if those paths are not reachable at runtime.  And we will count as valid programs that may not always produce correct results.&lt;&#x2F;p&gt;
&lt;p&gt;We can detect only &lt;em&gt;non-recursive&lt;&#x2F;em&gt; stack overflows at &lt;em&gt;validation time&lt;&#x2F;em&gt;, so we must check for the first two states at &lt;em&gt;runtime&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;out of gas&lt;&#x2F;code&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;stack overflow.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The remaining three states we can check at &lt;em&gt;validation time&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;stack underflow,&lt;&#x2F;li&gt;
&lt;li&gt;invalid jump, and&lt;&#x2F;li&gt;
&lt;li&gt;invalid instruction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That is to say:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Valid contracts will not halt with an exception unless they either&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;throw &lt;code&gt;out of gas&lt;&#x2F;code&gt; or&lt;&#x2F;li&gt;
&lt;li&gt;recursively overflow stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;constraints-on-valid-code&quot;&gt;&lt;em&gt;Constraints on Valid Code&lt;&#x2F;em&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Every instruction is valid.&lt;&#x2F;li&gt;
&lt;li&gt;Every jump is valid:
&lt;ul&gt;
&lt;li&gt;Every&lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is &lt;em&gt;static&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;No &lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, or &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; addresses immediate data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The stacks are always valid:
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;number&lt;&#x2F;em&gt; of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; is always positive, and at most 1024.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;number&lt;&#x2F;em&gt; of items on the &lt;code&gt;return stack&lt;&#x2F;code&gt; is always positive, and at most 1024.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The data stack is consistently aligned:
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;number&lt;&#x2F;em&gt; of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; between the current &lt;code&gt;stack pointer&lt;&#x2F;code&gt; and the &lt;code&gt;stack pointer&lt;&#x2F;code&gt; on entry to the most recent basic block is the same for each &lt;em&gt;execution&lt;&#x2F;em&gt; of a &lt;em&gt;byte_code&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We define a &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instruction to be &lt;em&gt;static&lt;&#x2F;em&gt; if its &lt;code&gt;jumpsrc&lt;&#x2F;code&gt; argument was first placed on the stack via a &lt;code&gt;PUSH…&lt;&#x2F;code&gt; and that value has not changed since, though it may have been copied via a &lt;code&gt;DUP…&lt;&#x2F;code&gt; or &lt;code&gt;SWAP…&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;instructions take their destination as an immediate argument, so they are &lt;em&gt;static&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Taken together, these rules allow for code to be validated by traversing the control-flow graph, in time and space linear in the size of the code, following each edge only once.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The definition of &#x27;static&#x27; for &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; is the bare minimum needed to implement subroutines.  Deeper analyses could be proposed that would validate a larger and probably more useful set of jumps, at the cost of more expensive (but still linear) validation.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Demanding &lt;em&gt;static&lt;&#x2F;em&gt; destinations for all jumps means that all jump destinations can be validated at initialization time, not runtime.&lt;&#x2F;p&gt;
&lt;p&gt;Bounding the stack pointers catches all &lt;code&gt;data stack&lt;&#x2F;code&gt; and non-recursive&lt;code&gt;return stack&lt;&#x2F;code&gt; overflows.&lt;&#x2F;p&gt;
&lt;p&gt;Requiring a consistently aligned&lt;code&gt;data stack&lt;&#x2F;code&gt; prevents stack underflow. It can also catch such errors as misaligned stacks due to irreducible control flows and calls to subroutines with the wrong number of arguments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes affect the semantics of EVM code – the use of &lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, and the stack are restricted, such that some &lt;em&gt;code&lt;&#x2F;em&gt; that would otherwise run correctly will nonetheless be invalid EVM &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is a pseudo-Go implementation of an algorithm for predicating code validity.  An equivalent algorithm must be run at initialization time.&lt;&#x2F;p&gt;
&lt;p&gt;This algorithm performs a symbolic execution of the program that recursively traverses the &lt;em&gt;code&lt;&#x2F;em&gt;, emulating its control flow and stack use and checking for violations of the rules above.&lt;&#x2F;p&gt;
&lt;p&gt;It runs in time equal to &lt;code&gt;O(vertices + edges)&lt;&#x2F;code&gt; in the program&#x27;s control-flow graph, where edges represent control flow and the vertices represent &lt;em&gt;basic blocks&lt;&#x2F;em&gt; -- thus the algorithm takes time proportional to the size of the &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: All valid code has a control-flow graph that can be traversed in time and space linear in the length of the code.  That means that some other static analyses and code transformations that might otherwise require quadratic time can also be written to run in near-linear time, including one-pass and streaming compilers.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-function&quot;&gt;Validation Function&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This function is a work in progress, and the version below is known to be incorrect.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For simplicity&#x27;s sake we assume that &lt;em&gt;jumpdest analysis&lt;&#x2F;em&gt; has been done and that we have some helper functions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;isValidInstruction(pc)&lt;&#x2F;code&gt; returns true if &lt;code&gt;pc&lt;&#x2F;code&gt; points at a valid instruction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;isValidJumpdest(dest)&lt;&#x2F;code&gt; returns true if &lt;code&gt;dest&lt;&#x2F;code&gt; is a valid jumpdest&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediateData(pc)&lt;&#x2F;code&gt; returns the immediate data for the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;advancePC(pc)&lt;&#x2F;code&gt; returns next &lt;code&gt;pc&lt;&#x2F;code&gt;,  skipping any immediate data.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removed_items(pc)&lt;&#x2F;code&gt; returns the number of items removed from the &lt;code&gt;dataStack&lt;&#x2F;code&gt; by the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;added_items(pc)&lt;&#x2F;code&gt; returns the number of items added to the &lt;code&gt;dataStack&lt;&#x2F;code&gt; by the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var bytecode      [codeLen]byte&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var subMin        [codeLen]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var subMax        [codeLen]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var subDelta      [codeLen]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var visited       [codeLen]bool&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;var dataStack     [1024]int&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; validate a path through the control flow of the bytecode at pc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; and return the maximum number of stack items used down that path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; or else the PC and an error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; by starting at pc:=0 the entire program is recursively evaluated&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;func validate(pc := 0, sp := 0, rp := 0) int, error {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   minStack := 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   maxStack := 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   deltaStack := 0 &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   for pc &amp;lt; codeLen {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      if !isValidInstruction(pc) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return 0,0,0,invalid_instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; if we have jumped here before return to break cycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      if visited[pc] {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          &#x2F;&#x2F; stack is not aligned if deltas not the same&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          if ??? {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      visited[pc] = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      switch bytecode[pc] {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; successful termination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case STOP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RETURN:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case SELFDESTRUCT:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case REVERT:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case INVALID:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return 0,0,0,invalid_instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RJUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; check for valid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; reset pc to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc += immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RJUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate true side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = pc + immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(pc + jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minRight, maxLeft, deltaRight, err =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validate(jumpdest, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;     err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate false side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minRight, maxRight, deltaRight, err =&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            validate(pc, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; both paths valid, so return max&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minStack = min(minStack, min(minLeft, minRight))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack += max(maxLeft, maxRight)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         deltaStack += max(deltaLeft, deltaRight)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, deltaStack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RJUMPSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; check for valid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(pc + jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc += jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate subroutine call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minSub, maxSub, deltaSub, err = validate(jumpdest, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         subMin[pc] = minSub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         subMax[pc] = maxSub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         subDelta[pc] = deltaSub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minStack = min(minStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case RETURNSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp, nil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; The following are to be included only if we take&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;    Option 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F; and do not deprecate JUMP and JUMPI&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case JUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; pop jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = dataStack[--sp]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !valid_jumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case JUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; pop jump destination and conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpdest = dataStack[--sp]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         jumpif = dataStack[--sp]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if sp &amp;lt; 0 {}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !valid_jumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate true side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if !isValidJumpdest(jumpdest) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,invalid_destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxLeft, err = validate(jumpdest, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; recurse to validate false side of conditional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advance_pc(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxRight, err = validate(pc, sp, rp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if err {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,err&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; both sides valid, return max&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack += max(maxLeft, maxRight)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case PUSH1 &amp;lt;= bytecode[pc] &amp;amp;&amp;amp; bytecode[pc] &amp;lt;= PUSH32 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;gt; 1023) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[sp] = immediateData(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case DUP1 &amp;lt;= bytecode[pc] &amp;amp;&amp;amp; bytecode[pc] &amp;lt;= DUP32 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dup = sp - (bytecode[pc] - DUP1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if dup &amp;lt; 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp++&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;gt; 1023) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[sp] = dataStack[dup]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      case SWAP1 &amp;lt;= bytecode[pc] &amp;amp;&amp;amp; bytecode[pc] &amp;lt;= SWAP32 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         swap = sp - (bytecode[pc] - SWAP1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if swap &amp;lt; 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         temp := dataStack[swap]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[swap] = dataStack[0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         dataStack[0] = temp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      &#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      default:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         &#x2F;&#x2F; apply other instructions to stack pointer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp -= removed_items(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;lt; 0) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         minStack = min(minStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         sp += added_items(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         if (sp &amp;gt; 1023) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return 0,0,0,stack_overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         maxStack = max(maxStack, sp)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         pc = advancePC(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   &#x2F;&#x2F; successful termination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   return minStack, maxStack, sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is intended to ensure an essential level of safety for EVM code deployed on the blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas Limit Cap</title>
        <published>2021-08-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>lightclient</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3756/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3756-gas-limit-cap/6921" />
        

        <id>https://wg-eips.ritovision.com/3756/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3756"
            label="EIP-3756" />
        

        
        

        
        <summary type="html">Set an in-protocol cap for the gas limit</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3756/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Set an in-protocol cap for the gas limit of 30,000,000.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A high gas limit increases pressure on the network. In the benign case, it
increases the size of the state and history faster than we can sustain. In the
malicious case, it amplifies the devastation of certain denial-of-service
attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As of the fork block &lt;code&gt;N&lt;&#x2F;code&gt;, consider blocks with a &lt;code&gt;gas_limit&lt;&#x2F;code&gt; greater than
&lt;code&gt;30,000,000&lt;&#x2F;code&gt; invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-cap-the-gas-limit&quot;&gt;Why Cap the Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;The gas limit is currently under the control of block proposers. They have the
ability to increase the gas limit to whatever value they desire. This allows
them to bypass the EIP and All Core Devs processes in protocol decisions that
may negatively affect the security and&#x2F;or decentralization of the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-fixed-gas-limit&quot;&gt;No Fixed Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;A valuable property of proposers choosing the gas limit is they can scale it
down quickly if the network becomes unstable or is undergoing certain types of
attacks. For this reason, we maintain their ability to lower the gas limit
&lt;em&gt;below&lt;&#x2F;em&gt; 30,000,000.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;No security considerations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Upgrade consensus to Proof-of-Stake</title>
        <published>2021-07-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Mikhail Kalinin</name><uri>https://github.com/mkalinin</uri>
	</author>
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3675/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3675-upgrade-consensus-to-proof-of-stake/6706" />
        

        <id>https://wg-eips.ritovision.com/3675/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3675"
            label="EIP-3675" />
        

        
        

        
        <summary type="html">Specification of the consensus mechanism upgrade on Ethereum Mainnet that introduces Proof-of-Stake</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3675/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP deprecates Proof-of-Work (PoW) and supersedes it with the new Proof-of-Stake consensus mechanism (PoS) driven by the beacon chain. Information on the bootstrapping of the new consensus mechanism is documented in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2982&#x2F;&quot;&gt;EIP-2982&lt;&#x2F;a&gt;. Full specification of the beacon chain can be found in the &lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;p&gt;This document specifies the set of changes to the block structure, block processing, fork choice rule and network interface introduced by the consensus upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The beacon chain network has been up and running since December 2020. Neither safety nor liveness failures were detected during this period of time. This long period of running without failure demonstrates the sustainability of the beacon chain system and its readiness to become a security provider for the Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;To understand the motivation of introducing the Proof-of-Stake consensus see the Motivation section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2982&#x2F;#motivation&quot;&gt;EIP-2982&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PoW block&lt;&#x2F;strong&gt;: Block that is built and verified by the existing proof-of-work mechanism. In other words, a block of the Ethereum network before the consensus upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;PoS block&lt;&#x2F;strong&gt;: Block that is built and verified by the new proof-of-stake mechanism.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Terminal PoW block&lt;&#x2F;strong&gt;: A PoW block that satisfies the following conditions --
&lt;code&gt;pow_block.total_difficulty &amp;gt;= TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; &lt;em&gt;and&lt;&#x2F;em&gt; &lt;code&gt;pow_block.parent_block.total_difficulty &amp;lt; TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt;.
There can be more than one terminal PoW block in the network, e.g. multiple children of the same pre-terminal block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The amount of total difficulty reached by the network that triggers the consensus upgrade. Ethereum Mainnet configuration &lt;strong&gt;MUST&lt;&#x2F;strong&gt; have this parameter set to the value &lt;code&gt;58750000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The earliest PoS block of the canonical chain, i.e. the PoS block with the lowest block height.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; An event occurring when the state of the proof-of-stake fork choice is updated.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; A block number set to the &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; parameter for the upcoming consensus upgrade.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Designates the hash of the terminal PoW block if set, i.e. if not stubbed with &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Designates the number of the terminal PoW block if &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; is set.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;pos-events&quot;&gt;PoS events&lt;&#x2F;h4&gt;
&lt;p&gt;Events having the &lt;code&gt;POS_&lt;&#x2F;code&gt; prefix in the name (PoS events) are emitted by the new proof-of-stake consensus mechanism. They signify the corresponding assertion that has been made regarding a block specified by the event. The underlying logic of PoS events can be found in the beacon chain specification. On the occurrence of each PoS event the corresponding action that is specified by this EIP &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be taken.&lt;&#x2F;p&gt;
&lt;p&gt;The details provided below must be taken into account when reading those parts of the specification that refer to the PoS events:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reference to a block that is contained by PoS events is provided in a form of a block hash unless another is explicitly specified.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event contains references to the head of the canonical chain and to the most recent finalized block. Before the first finalized block occurs in the system the finalized block hash provided by this event is stubbed with &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The first finalized block that is designated by &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event and has the hash that differs from the stub.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;client-software-configuration&quot;&gt;Client software configuration&lt;&#x2F;h3&gt;
&lt;p&gt;The following set of parameters is a part of client software configuration and &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be included into its binary distribution:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: If &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; is stubbed with &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; then &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; and &lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt; parameters &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; take an effect.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pow-block-processing&quot;&gt;PoW block processing&lt;&#x2F;h3&gt;
&lt;p&gt;PoW blocks that are descendants of any terminal PoW block &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be imported. This implies that a terminal PoW block will be the last PoW block in the canonical chain.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;block-structure&quot;&gt;Block structure&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, a number of previously dynamic block fields are deprecated by enforcing these values to instead be constants. Each block field listed in the table below &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be replaced with the corresponding constant value.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;th&gt;Constant value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;ommersHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;= Keccak256(RLP([]))&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;mixHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;ommers&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;RLP([]) = 0xc0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, the validation of the block&#x27;s &lt;strong&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; field changes: The length of the block&#x27;s &lt;strong&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be less than or equal to &lt;strong&gt;&lt;code&gt;MAX_EXTRA_DATA_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; bytes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Logic and validity conditions of block fields that are &lt;em&gt;not&lt;&#x2F;em&gt; specified here &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged. Additionally, the overall block format &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Subsequent EIPs may override the constant values specified above to provide additional functionality. For an example, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4399&#x2F;&quot;&gt;EIP-4399&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-validity&quot;&gt;Block validity&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, the block validity conditions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be altered by the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove verification of the block&#x27;s &lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; value with respect to the difficulty formula.&lt;&#x2F;li&gt;
&lt;li&gt;Remove verification of the block&#x27;s &lt;strong&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; and &lt;strong&gt;&lt;code&gt;mixHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; values with respect to the Ethash function.&lt;&#x2F;li&gt;
&lt;li&gt;Remove all validation rules that are evaluated over the list of ommers and each member of this list.&lt;&#x2F;li&gt;
&lt;li&gt;Add verification of the fields noted in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#block-structure&quot;&gt;block structure&lt;&#x2F;a&gt; section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: If one of the new rules fails then the block &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be invalidated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Validity rules that are not specified in the list above &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transition-block-validity&quot;&gt;Transition block validity&lt;&#x2F;h4&gt;
&lt;p&gt;In addition to satisfying the above conditions, &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be a child of a terminal PoW block. That is, a parent of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; satisfy terminal PoW block conditions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-and-ommer-rewards&quot;&gt;Block and ommer rewards&lt;&#x2F;h3&gt;
&lt;p&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, block and ommer rewards are deprecated. Specifically, the following actions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be taken:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove increasing the balance of the block&#x27;s &lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; account by the block reward.&lt;&#x2F;li&gt;
&lt;li&gt;Remove increasing the balance of the block&#x27;s &lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; account by the ommer inclusion reward per each ommer.&lt;&#x2F;li&gt;
&lt;li&gt;Remove increasing the balance of the ommer&#x27;s &lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; account by the ommer block reward per each ommer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Transaction fee mechanics affecting the block&#x27;s &lt;code&gt;beneficiary&lt;&#x2F;code&gt; account &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fork-choice-rule&quot;&gt;Fork choice rule&lt;&#x2F;h3&gt;
&lt;p&gt;If set, &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; parameter affects the PoW heaviest chain rule in the following way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Canonical blockchain &lt;strong&gt;MUST&lt;&#x2F;strong&gt; contain a block with the hash defined by &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; parameter at the height defined by &lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt; parameter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: This rule is akin to block hash whitelisting functionality already present in client software implementations.&lt;&#x2F;p&gt;
&lt;p&gt;As of the first &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event, the fork choice rule &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be altered in the following way:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the existing PoW heaviest chain rule.&lt;&#x2F;li&gt;
&lt;li&gt;Adhere to the new PoS LMD-GHOST rule.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The new PoS LMD-GHOST fork choice rule is specified as follows. On each occurrence of a &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event including the first one, the following actions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be taken:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Consider the chain starting at genesis and ending with the head block nominated by the event as the canonical blockchain.&lt;&#x2F;li&gt;
&lt;li&gt;Set the head of the canonical blockchain to the corresponding block nominated by the event.&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;, set the most recent finalized block to the corresponding block nominated by the event.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Changes to the block tree store that are related to the above actions &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be applied atomically.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: This rule &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be strictly enforced. &quot;Optimistic&quot; updates to the head &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be made. That is -- if a new block is processed on top of the current head block, this new block becomes the new head if and only if an accompanying &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event occurs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;network&quot;&gt;Network&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;fork-identifier&quot;&gt;Fork identifier&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2124&#x2F;&quot;&gt;EIP-2124&lt;&#x2F;a&gt; fork identifier, nodes implementing this EIP &lt;strong&gt;MUST&lt;&#x2F;strong&gt; set the &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; parameter to the &lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;devp2p&quot;&gt;devp2p&lt;&#x2F;h4&gt;
&lt;p&gt;The networking stack &lt;strong&gt;SHOULD NOT&lt;&#x2F;strong&gt; send the following messages if they advertise the descendant of any terminal PoW block:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Beginning with receiving the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;, the networking stack &lt;strong&gt;MUST&lt;&#x2F;strong&gt; discard the following ingress messages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Beginning with receiving the finalized block next to the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;, the networking stack &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remove the handlers corresponding to the following messages:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Peers that keep sending these messages after the handlers have been removed &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; be disconnected.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; The logic of message handlers that are not affected by this section &lt;strong&gt;MUST&lt;&#x2F;strong&gt; remain unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The changes specified in this EIP target a minimal requisite set of consensus and client software modifications to safely replace the existing proof-of-work consensus algorithm with the new proof-of-stake consensus represented by the already in-production beacon chain.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP was designed to minimize the complexity of hot-swapping the live consensus of the Ethereum network. Both the safety of the operation and time to production were taken into consideration. Additionally, a minimal changeset helps ensure that &lt;em&gt;most&lt;&#x2F;em&gt; smart contracts and services will continue to function as intended during and after the transition with little to no required intervention.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;total-difficulty-triggering-the-upgrade&quot;&gt;Total difficulty triggering the upgrade&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#terminal-total-difficulty-vs-block-number&quot;&gt;Security considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameterizing-terminal-block-hash&quot;&gt;Parameterizing terminal block hash&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#terminal-pow-block-overriding&quot;&gt;Security considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;halting-the-import-of-pow-blocks&quot;&gt;Halting the import of PoW blocks&lt;&#x2F;h3&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#halt-the-importing-of-pow-blocks&quot;&gt;Security considerations&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replacing-block-fields-with-constants&quot;&gt;Replacing block fields with constants&lt;&#x2F;h3&gt;
&lt;p&gt;Deprecated block fields are replaced with constant values to ensure the block format remains backwards compatible. Preserving the block format aids existing smart contracts and services in providing uninterrupted service during and after this transition.&lt;&#x2F;p&gt;
&lt;p&gt;Particularly, this is important for those smart contracts that verify Merkle proofs of transaction&#x2F;receipt inclusion and state by validating the hash of externally provided block header against the corresponding value returned by the &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; operation.&lt;&#x2F;p&gt;
&lt;p&gt;This change introduces an additional validity rule that enforces the replacement of deprecated block fields.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replacing-difficulty-with-0&quot;&gt;Replacing &lt;code&gt;difficulty&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;After deprecating the proof-of-work the notion of difficulty no longer exists and replacing the block header &lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; field with &lt;code&gt;0&lt;&#x2F;code&gt; constant is semantically sound.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changing-block-validity-rules&quot;&gt;Changing block validity rules&lt;&#x2F;h3&gt;
&lt;p&gt;The rule set enforcing the PoW seal validity is replaced with the corresponding PoS rules along with the consensus upgrade as the rationale behind this change.&lt;&#x2F;p&gt;
&lt;p&gt;An additional rule validating a set of deprecated block fields is required by the block format changes introduced by this specification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-block-rewards&quot;&gt;Removing block rewards&lt;&#x2F;h3&gt;
&lt;p&gt;Existing rewards for producing and sealing blocks are deprecated along with the PoW mechanism. The new PoS consensus becomes both responsible for sealing blocks and for issuing block rewards once this specification enters into effect.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supplanting-fork-choice-rule&quot;&gt;Supplanting fork choice rule&lt;&#x2F;h3&gt;
&lt;p&gt;The fork choice rule of the PoW mechanism becomes completely irrelevant after the upgrade and is replaced with the corresponding rule of the new PoS consensus mechanism.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remove-of-pos-consensus-validated&quot;&gt;Remove of &lt;code&gt;POS_CONSENSUS_VALIDATED&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In prior draft versions of this EIP, an additional POS event -- &lt;code&gt;POS_CONSENSUS_VALIDATED&lt;&#x2F;code&gt; -- was required as a validation condition for blocks. This event gave the signal to either fully incorporate or prune the block from the block tree.&lt;&#x2F;p&gt;
&lt;p&gt;This event was removed for two reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;This event was an unnecessary optimization to allow for pruning of &quot;bad&quot; blocks from the block tree. This optimization was unnecessary because the PoS consensus would never send &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; for any such bad blocks or their descendants, and eventually any such blocks would be able to be pruned after a PoS finality event of an alternative branch in the block tree.&lt;&#x2F;li&gt;
&lt;li&gt;This event was dangerous in some scenarios because a block could be referenced by two &lt;em&gt;different&lt;&#x2F;em&gt; and conflicting PoS branches. Thus for the same block in some scenarios, both a &lt;code&gt;POS_CONSENSUS_VALIDATED == TRUE&lt;&#x2F;code&gt; and &lt;code&gt;POS_CONSENSUS_VALIDATED == FALSE&lt;&#x2F;code&gt; event could sent, entirely negating the ability to safely perform the optimization in (1).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;eip-2124-fork-identifier&quot;&gt;EIP-2124 fork identifier&lt;&#x2F;h3&gt;
&lt;p&gt;The value of &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; in EIP-2124 refers to the block number of the next fork a given node knows about and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The number of &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; cannot be known ahead of time given the dynamic nature of the transition trigger condition. As the block will not be known a priori, nodes can&#x27;t use its number for &lt;code&gt;FORK_NEXT&lt;&#x2F;code&gt; and in light of this fact an explicitly set &lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt; is used instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;removing-block-gossip&quot;&gt;Removing block gossip&lt;&#x2F;h3&gt;
&lt;p&gt;After the upgrade of the consensus mechanism only the beacon chain network will have enough information to validate a block. Thus, block gossip provided by the &lt;code&gt;eth&lt;&#x2F;code&gt; network protocol will become unsafe and is deprecated in favour of the block gossip existing in the beacon chain network.&lt;&#x2F;p&gt;
&lt;p&gt;It is recommended for the client software to not propagate descendants of any terminal PoW block to reduce the load on processing the P2P component and stop operating in the environment with unknown security properties.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;restricting-the-length-of-extradata&quot;&gt;Restricting the length of &lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;extraData&lt;&#x2F;code&gt; field is defined as a maximum of &lt;code&gt;32&lt;&#x2F;code&gt; bytes in the yellow paper. Thus mainnet and most PoW testnets cap the value at &lt;code&gt;32&lt;&#x2F;code&gt; bytes.  &lt;code&gt;extraData&lt;&#x2F;code&gt; fields of greater length are used by clique testnets and other networks to carry special signature&#x2F;consensus schemes. This EIP restricts the length of &lt;code&gt;extraData&lt;&#x2F;code&gt; to &lt;code&gt;32&lt;&#x2F;code&gt; bytes because any network that is transitioning from another consensus mechanism to a beacon chain PoS consensus mechanism no longer needs extended or unbounded &lt;code&gt;extraData&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backward incompatibilities in block validity, block rewards and fork choice rule.&lt;&#x2F;p&gt;
&lt;p&gt;The design of the consensus upgrade specified by this document does not introduce backward incompatibilities for existing applications and services built on top of Ethereum except for those that are described in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3675&#x2F;#evm&quot;&gt;EVM&lt;&#x2F;a&gt; section below or heavily depends on the PoW consensus in any other way.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm&quot;&gt;EVM&lt;&#x2F;h3&gt;
&lt;p&gt;Although this EIP does not introduce any explicit changes to the EVM there are a couple of places where it may affect the logic of existing smart contracts.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;difficulty&quot;&gt;DIFFICULTY&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; operation will always return &lt;code&gt;0&lt;&#x2F;code&gt; after this EIP takes effect and deprecates the &lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; field by replacing it with &lt;code&gt;0&lt;&#x2F;code&gt; constant.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;&#x2F;em&gt; Altering the &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt; semantics to return randomness accumulated by the beacon chain is under consideration but will be introduced in a separate EIP.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;blockhash&quot;&gt;BLOCKHASH&lt;&#x2F;h4&gt;
&lt;p&gt;Pseudo-random numbers obtained as the output of &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; operation become more insecure after this EIP takes effect and the PoW mechanism (which decreases the malleability of block hashes) gets supplanted by PoS.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Block validity
&lt;ul&gt;
&lt;li&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, block is invalidated if any of the following is true:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ommersHash != Keccak256(RLP([]))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;difficulty != 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce != 0x0000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;len(extraData) &amp;gt; MAX_EXTRA_DATA_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, block rewards aren&#x27;t added to &lt;code&gt;beneficiary&lt;&#x2F;code&gt; account&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Client software adheres to PoS LMD-GHOST rule
&lt;ul&gt;
&lt;li&gt;Head and finalized blocks are set according to the recent &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event&lt;&#x2F;li&gt;
&lt;li&gt;No fork choice state is updated unless &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt; event is received&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Transition process
&lt;ul&gt;
&lt;li&gt;Client software doesn&#x27;t process any PoW block beyond a terminal PoW block&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with &lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt;, client software applies new block validity rules&lt;&#x2F;li&gt;
&lt;li&gt;Beginning with the first &lt;code&gt;POS_FORKCHOICE_UPDATED&lt;&#x2F;code&gt;, client software switches its fork choice rule to PoS LMD-GHOST&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_BLOCK&lt;&#x2F;code&gt; must be a child of a terminal PoW block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NewBlockHashes (0x01)&lt;&#x2F;code&gt; and &lt;code&gt;NewBlock (0x07)&lt;&#x2F;code&gt; network messages are discarded after receiving the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;beacon-chain&quot;&gt;Beacon chain&lt;&#x2F;h3&gt;
&lt;p&gt;See Security Considerations section of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2982&#x2F;#security-considerations&quot;&gt;EIP-2982&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transition-process&quot;&gt;Transition process&lt;&#x2F;h3&gt;
&lt;p&gt;The transition process used to take this specification into effect is a more sophisticated version of a hardfork -- the regular procedure of applying backwards incompatible changes in the Ethereum network. This process has multiple successive steps instead of the normal block-height point condition of simpler hardforks.&lt;&#x2F;p&gt;
&lt;p&gt;The complexity of this upgrade process stems from this fork targeting the underlying consensus mechanism rather than the execution layer within the consensus mechanism. Although the design seeks simplicity where possible, safety and liveness considerations during this transition have been prioritized.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;terminal-total-difficulty-vs-block-number&quot;&gt;Terminal total difficulty vs block number&lt;&#x2F;h4&gt;
&lt;p&gt;Using a pre-defined block number for the hardfork is unsafe in this context due to the PoS fork choice taking priority during the transition.&lt;&#x2F;p&gt;
&lt;p&gt;An attacker may use a minority of hash power to build a malicious chain fork that would satisfy the block height requirement. Then the first PoS block may be maliciously proposed on top of the PoW block from this adversarial fork, becoming the head and subverting the security of the transition.&lt;&#x2F;p&gt;
&lt;p&gt;To protect the network from this attack scenario, difficulty accumulated by the chain (total difficulty) is used to trigger the upgrade.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ability-to-jump-between-terminal-pow-blocks&quot;&gt;Ability to jump between terminal PoW blocks&lt;&#x2F;h4&gt;
&lt;p&gt;There could be the case when a terminal PoW block is not observed by the majority of network participants due to (temporal) network partitioning. In such a case, this minority would switch their fork choice to the new rule provided by the PoS rooted on the minority terminal PoW block that they observed.&lt;&#x2F;p&gt;
&lt;p&gt;The transition process allows the network to re-org between forks with different terminal PoW blocks as long as (a) these blocks satisfy the terminal PoW block conditions and (b) the &lt;code&gt;FIRST_FINALIZED_BLOCK&lt;&#x2F;code&gt; has not yet been received. This provides resilience against adverse network conditions during the transition process and prevents irreparable forks&#x2F;partitions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;halt-the-importing-of-pow-blocks&quot;&gt;Halt the importing of PoW blocks&lt;&#x2F;h4&gt;
&lt;p&gt;Suppose the part of the client software that is connected to the beacon chain network goes offline before the Ethereum network reaches the &lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; and stays offline while the network meets this threshold. Such an event makes the client software unable to switch to PoS and allows it to keep following the PoW chain if this chain is being built beyond the terminal PoW block. Depending on how long the beacon chain part was offline, it could result in different adverse effects such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The client has no post-state for the terminal PoW block (the state has been pruned) which prevents it from doing the re-org to the PoS chain and leaving syncing from scratch as the only option to recover.&lt;&#x2F;li&gt;
&lt;li&gt;An application, a user or a service uses the data from the wrong fork (PoW chain that is kept being built) which can cause security issues on their side.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Not importing PoW blocks that are beyond the terminal PoW block prevents these adverse effects on safety&#x2F;re-orgs in the event of software or configuration failures &lt;em&gt;in favor&lt;&#x2F;em&gt; of a liveness failure.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;terminal-pow-block-overriding&quot;&gt;Terminal PoW block overriding&lt;&#x2F;h4&gt;
&lt;p&gt;There is a mechanism allowing for accelerating the consensus upgrade in emergency cases.
This EIP considers the following emergency case scenarios for the acceleration to come into effect:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A drop of the network hashing rate which delays the upgrade significantly.&lt;&#x2F;li&gt;
&lt;li&gt;Attacks on the PoW network before the upgrade.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The first case can be safely accelerated by updating the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; -- reset to a value that is closer in time than the original one.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt; -- adjust accordingly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The second, more dire attack scenario requires a more invasive override:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt; -- set to the hash of a certain block to become the terminal PoW block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_BLOCK_NUMBER&lt;&#x2F;code&gt; -- set to the number of a block designated by &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TERMINAL_TOTAL_DIFFICULTY&lt;&#x2F;code&gt; -- set to the total difficulty value of a block designated by &lt;code&gt;TERMINAL_BLOCK_HASH&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_NEXT_VALUE&lt;&#x2F;code&gt; -- adjust accordingly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: Acceleration in the second case is considered for the most extreme of scenarios because it will result in a non-trivial liveness failure on Ethereum Mainnet.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ancient-blocks-are-no-longer-a-requisite-for-a-network-security&quot;&gt;Ancient blocks are no longer a requisite for a network security&lt;&#x2F;h3&gt;
&lt;p&gt;Keeping historical blocks starting from genesis is essential in the PoW network. A header of every block that belongs to a particular chain is required to justify the validity of this chain with respect to the PoW seal.&lt;&#x2F;p&gt;
&lt;p&gt;Validating the entire history of the chain is not required by the new PoS mechanism. Instead, the sync process in the PoS network relies on weak subjectivity checkpoints, which are historical snapshots shared by peers on the network. This means historical blocks beyond weak subjectivity checkpoint are no longer a requisite for determining the canonical blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Specification of weak subjectivity checkpoints can be found in the &lt;code&gt;ethereum&#x2F;consensus-specs&lt;&#x2F;code&gt; repository.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit and meter initcode</title>
        <published>2021-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3860/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3860-limit-and-meter-initcode/7018" />
        

        <id>https://wg-eips.ritovision.com/3860/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3860"
            label="EIP-3860" />
        

        
        

        
        <summary type="html">Limit the maximum size of initcode to 49152 and apply extra gas cost of 2 for every 32-byte chunk of initcode</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3860/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We extend &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; by introducing a maximum size limit for &lt;code&gt;initcode&lt;&#x2F;code&gt; (&lt;code&gt;MAX_INITCODE_SIZE = 2 * MAX_CODE_SIZE = 49152&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, we introduce a charge of &lt;code&gt;2&lt;&#x2F;code&gt; gas for every 32-byte chunk of &lt;code&gt;initcode&lt;&#x2F;code&gt; to represent the cost of jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, the size limit results in the nice-to-have property that EVM code size, code offset (&lt;code&gt;PC&lt;&#x2F;code&gt;), and jump offset fits a 16-bit value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;During contract creation the client has to perform jumpdest-analysis on the &lt;code&gt;initcode&lt;&#x2F;code&gt; prior to execution. The work performed scales linearly with the size of the &lt;code&gt;initcode&lt;&#x2F;code&gt;. This work currently is not metered, nor is there a protocol enforced upper bound for the size.&lt;&#x2F;p&gt;
&lt;p&gt;There are three costs charged today:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Cost for calldata aka &lt;code&gt;initcode&lt;&#x2F;code&gt;: 4 gas for a byte with the value of zero, and 16 gas otherwise.&lt;&#x2F;li&gt;
&lt;li&gt;Cost for the resulting deployed code: 200 gas per byte.&lt;&#x2F;li&gt;
&lt;li&gt;Cost of address calculation (hashing of code) in case of &lt;code&gt;CREATE2&lt;&#x2F;code&gt; only: 6 gas per word.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Only the first cost applies to &lt;code&gt;initcode&lt;&#x2F;code&gt;, but only in the case of contract creation transactions. For the case of &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; there is no such cost, and it is possible to programmatically generate variations of &lt;code&gt;initcode&lt;&#x2F;code&gt; in a relatively cheap manner. In the past it was possible to craft malicious &lt;code&gt;initcode&lt;&#x2F;code&gt; due to a vulnerability fixed in 2017 by geth 1.6.5.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, the lack of a limit has caused lengthy discussions for some EVM proposals, influencing the design, or even causing a delay or cancellation of a feature.&lt;&#x2F;p&gt;
&lt;p&gt;We are motivated by three reasons:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensuring &lt;code&gt;initcode&lt;&#x2F;code&gt; is fairly charged (most importantly cost is proportional to &lt;code&gt;initcode&lt;&#x2F;code&gt;&#x27;s length) to minimize the risks for the future.&lt;&#x2F;li&gt;
&lt;li&gt;To have a cost system which is extendable in the future.&lt;&#x2F;li&gt;
&lt;li&gt;To simplify EVM engines by the explicit limits (code size, code offsets (&lt;code&gt;PC&lt;&#x2F;code&gt;), and jump offsets fit 16-bits).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Where &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; is defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; as &lt;code&gt;24576&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We define &lt;code&gt;initcode_cost(initcode)&lt;&#x2F;code&gt; to equal &lt;code&gt;INITCODE_WORD_COST * ceil(len(initcode) &#x2F; 32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rules&quot;&gt;Rules&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;If length of transaction data (&lt;code&gt;initcode&lt;&#x2F;code&gt;) in a create transaction exceeds &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;, transaction is invalid. (&lt;em&gt;Note that this is similar to transactions considered invalid for not meeting the intrinsic gas cost requirement.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;For a create transaction, extend the transaction data cost formula to include &lt;code&gt;initcode_cost(initcode)&lt;&#x2F;code&gt;. (&lt;em&gt;Note that this is included in transaction intrinsic cost, i.e. transaction with not enough gas to cover initcode cost is invalid.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;If length of &lt;code&gt;initcode&lt;&#x2F;code&gt; to &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions exceeds &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;, instruction execution exceptionally aborts (as if it runs out of gas).&lt;&#x2F;li&gt;
&lt;li&gt;For the &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions charge an extra gas cost equaling to &lt;code&gt;initcode_cost(initcode)&lt;&#x2F;code&gt;. This cost is deducted before the calculation of the resulting contract address and the execution of &lt;code&gt;initcode&lt;&#x2F;code&gt;. (&lt;em&gt;Note that this means before or at the same time as the hashing cost is applied in &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost-constant&quot;&gt;Gas cost constant&lt;&#x2F;h3&gt;
&lt;p&gt;The value of &lt;code&gt;INITCODE_WORD_COST&lt;&#x2F;code&gt; is selected based on performance benchmarks of differing worst-cases per implementation. The baseline for the benchmarks is the performance of &lt;code&gt;KECCAK256&lt;&#x2F;code&gt; hashing in geth 1.10.9, which matches the 70 Mgas&#x2F;s gas limit target on a 4.0 GHz x86_64 CPU.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;EVM&lt;&#x2F;th&gt;&lt;th&gt;version&lt;&#x2F;th&gt;&lt;th&gt;MB&#x2F;s&lt;&#x2F;th&gt;&lt;th&gt;B&#x2F;CPUcycle&lt;&#x2F;th&gt;&lt;th&gt;CPUcycle&#x2F;B&lt;&#x2F;th&gt;&lt;th&gt;cost of 1 B&lt;&#x2F;th&gt;&lt;th&gt;cost of 32 B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;geth&#x2F;KECCAK256&lt;&#x2F;td&gt;&lt;td&gt;1.10.9&lt;&#x2F;td&gt;&lt;td&gt;357&lt;&#x2F;td&gt;&lt;td&gt;1.8&lt;&#x2F;td&gt;&lt;td&gt;0.6&lt;&#x2F;td&gt;&lt;td&gt;0.2&lt;&#x2F;td&gt;&lt;td&gt;6.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;geth&lt;&#x2F;td&gt;&lt;td&gt;1.10.9&lt;&#x2F;td&gt;&lt;td&gt;1091&lt;&#x2F;td&gt;&lt;td&gt;5.5&lt;&#x2F;td&gt;&lt;td&gt;0.2&lt;&#x2F;td&gt;&lt;td&gt;0.1&lt;&#x2F;td&gt;&lt;td&gt;2.0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;evmone&#x2F;Baseline&lt;&#x2F;td&gt;&lt;td&gt;0.8.2&lt;&#x2F;td&gt;&lt;td&gt;727&lt;&#x2F;td&gt;&lt;td&gt;3.7&lt;&#x2F;td&gt;&lt;td&gt;0.3&lt;&#x2F;td&gt;&lt;td&gt;0.1&lt;&#x2F;td&gt;&lt;td&gt;2.9&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;evmone&#x2F;Advanced&lt;&#x2F;td&gt;&lt;td&gt;0.8.2&lt;&#x2F;td&gt;&lt;td&gt;155&lt;&#x2F;td&gt;&lt;td&gt;0.8&lt;&#x2F;td&gt;&lt;td&gt;1.3&lt;&#x2F;td&gt;&lt;td&gt;0.4&lt;&#x2F;td&gt;&lt;td&gt;13.8&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;gas-cost-per-word-32-byte-chunk&quot;&gt;Gas cost per word (32-byte chunk)&lt;&#x2F;h3&gt;
&lt;p&gt;We have chosen the cost of 2 gas per word based on Geth&#x27;s implementation and comparing with &lt;code&gt;KECCAK256&lt;&#x2F;code&gt; performance. This means the per byte cost is &lt;code&gt;0.0625&lt;&#x2F;code&gt;. While fractional gas costs are not permitted in the EVM, we can approximate it by charging per-word.&lt;&#x2F;p&gt;
&lt;p&gt;Moreover, calculating gas per word is compatible with the calculation of &lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x27;s &lt;em&gt;hashcost&lt;&#x2F;em&gt; of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1014&#x2F;&quot;&gt;EIP-1014&lt;&#x2F;a&gt;. Therefore, the same implementation may be used for &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; with different cost constants: before activation &lt;code&gt;0&lt;&#x2F;code&gt; for &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;6&lt;&#x2F;code&gt; for &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, after activation &lt;code&gt;2&lt;&#x2F;code&gt; for &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;6 + 2&lt;&#x2F;code&gt; for &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reason-for-size-limit-of-initcode&quot;&gt;Reason for size limit of initcode&lt;&#x2F;h3&gt;
&lt;p&gt;Estimating and creating worst case scenarios is easier with an upper bound in place, given one parameter for the search is greatly reduced. This allows for selecting a much more optimistic gas per byte.&lt;&#x2F;p&gt;
&lt;p&gt;Should there be no upper bound, the cost would need to be higher accounting for unknown unknowns. Given most &lt;em&gt;initcode&lt;&#x2F;em&gt; (&lt;em&gt;TODO: state maximum initcode size resulting in deployment seen on mainnet here&lt;&#x2F;em&gt;) does not exceed the proposed limit, penalising contracts by overly conservative costs seems unnecessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;effect-of-size-limit-of-initcode&quot;&gt;Effect of size limit of initcode&lt;&#x2F;h3&gt;
&lt;p&gt;In most, if not all cases when a new contract is being created, the resulting runtime code is copied from the initcode itself. For the basic case the &lt;code&gt;2 * MAX_CODE_SIZE&lt;&#x2F;code&gt; limit allows &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; for runtime code and another &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; for contract constructor code. However, the limit may have practical implications for cases where multiple contracts are deployed in a single create transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;initcode-cost-for-create-transaction&quot;&gt;Initcode cost for create transaction&lt;&#x2F;h3&gt;
&lt;p&gt;The initcode cost for create transaction data (0.0625 gas per byte) is negligible compared to the transaction data cost (4 or 16 gas per byte). Despite that, we decided to include it in the specification for consistency, and more importantly for forward compatibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-report-initcode-limit-violation&quot;&gt;How to report initcode limit violation?&lt;&#x2F;h3&gt;
&lt;p&gt;We specified that initcode size limit violation for &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; results in exceptional abort of the execution. This places it in the group of early out-of-gas checks, including: stack underflow, memory expansion, static call violation, initcode hashing cost, and initcode cost introduced by this EIP. They precede the later &quot;light&quot; checks: call depth and balance. The choice gives consistency to the order of checks and lowers implementation complexity (out-of-gas checks can be performed in any order).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a &quot;network upgrade&quot;, since it modifies consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;Already deployed contracts should not be affected, but certain transactions (with &lt;code&gt;initcode&lt;&#x2F;code&gt; beyond the proposed limit) would still be includable in a block, but result in an exceptional abort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests should include the following cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Creation transaction with gas limit enough to cover initcode cost&lt;&#x2F;li&gt;
&lt;li&gt;Creation transaction with gas limit enough to cover intrinsic cost except initcode cost&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;creation transaction with &lt;code&gt;len(initcode)&lt;&#x2F;code&gt; at &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;creation transaction with &lt;code&gt;len(initcode)&lt;&#x2F;code&gt; at &lt;code&gt;MAX_INITCODE_SIZE+1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For client implementations, this EIP makes attacks based on jumpdest-analysis less problematic, so should increase the robustness of clients.&lt;&#x2F;p&gt;
&lt;p&gt;For layer 2, this EIP introduces failure-modes where there previously were none. There &lt;em&gt;could&lt;&#x2F;em&gt; exist factory-contracts which deploy multi-level contract hierarchies, such that the code for multiple contracts are included in the initcode of the first contract. The author(s) of this EIP are not aware of any such contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, on London, with &lt;code&gt;30M&lt;&#x2F;code&gt; gas limit, it would be possible to trigger jumpdest-analysis of a total &lt;code&gt;~1.3GB&lt;&#x2F;code&gt; of initcode. With this EIP, the cost for such an attack would increase by roughly &lt;code&gt;80M&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Static relative jumps</title>
        <published>2021-07-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/4200/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-4200-static-relative-jumps/7108" />
        

        <id>https://wg-eips.ritovision.com/4200/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:4200"
            label="EIP-4200" />
        

        
        

        
        <summary type="html">RJUMP, RJUMPI and RJUMPV instructions with a signed immediate encoding the jump destination</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/4200/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Three new EVM jump instructions are introduced (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) which encode destinations as signed immediate values. These can be useful in the majority of (but not all) use cases and offer a cost reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A recurring discussion topic is that EVM only has a mechanism for dynamic jumps. They provide a very flexible architecture with only 2 (!) instructions. This flexibility comes at a cost however: it makes analysis of code more complicated and it also (partially) resulted in the need to have the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; marker.&lt;&#x2F;p&gt;
&lt;p&gt;In a great many cases control flow is actually static and there is no need for any dynamic behaviour, though not every use case can be solved by static jumps.&lt;&#x2F;p&gt;
&lt;p&gt;There are various ways to reduce the need for dynamic jumps, some examples:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;With native support for functions &#x2F; subroutines&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;return to caller&quot; instruction&lt;&#x2F;li&gt;
&lt;li&gt;A &quot;switch-case&quot; table with dynamic indexing&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This change does not attempt to solve these, but instead introduces a minimal feature set to allow compilers to decide which is the most adequate option for a given use case. It is expected that compilers will use &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; almost exclusively, with the exception of returning to the caller continuing to use &lt;code&gt;JUMP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This functionality does not preclude the EVM from introducing other forms of control flow later on. &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; can efficiently co-exists with a higher-level declaration of functions, where static relative jumps should be used for intra-function control flow.&lt;&#x2F;p&gt;
&lt;p&gt;The main benefit of these instruction is reduced gas cost (both at deploy and execution time) and better analysis properties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce three new instructions on the same block number &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is activated on:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; (0xe0) - relative jump&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt; (0xe1) - conditional relative jump&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; (0xe2) - relative jump via jump table&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, all of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;If the code is valid EOF1:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;RJUMP relative_offset&lt;&#x2F;code&gt; sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI relative_offset&lt;&#x2F;code&gt; pops a value (&lt;code&gt;condition&lt;&#x2F;code&gt;) from the stack, and sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((condition == 0) ? 0 : relative_offset)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV max_index relative_offset+&lt;&#x2F;code&gt; pops a value (&lt;code&gt;case&lt;&#x2F;code&gt;) from the stack, and sets the &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC_post_instruction + ((case &amp;gt; max_index) ? 0 : relative_offset[case])&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The immediate argument &lt;code&gt;relative_offset&lt;&#x2F;code&gt; is encoded as a 16-bit &lt;strong&gt;signed&lt;&#x2F;strong&gt; (two&#x27;s-complement) big-endian value. Under &lt;code&gt;PC_post_instruction&lt;&#x2F;code&gt; we mean the &lt;code&gt;PC&lt;&#x2F;code&gt; position after the entire immediate value.&lt;&#x2F;p&gt;
&lt;p&gt;The immediate encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; is more special: the unsigned 8-bit &lt;code&gt;max_index&lt;&#x2F;code&gt; value determines the maximum index in the jump table. The number of &lt;code&gt;relative_offset&lt;&#x2F;code&gt; values following is &lt;code&gt;max_index+1&lt;&#x2F;code&gt;. This allows table sizes up to 256. The encoding of &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; must have at least one &lt;code&gt;relative_offset&lt;&#x2F;code&gt; and thus it will take at minimum 4 bytes. Furthermore, the &lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt; condition falling through means that in many use cases, one would place the &lt;em&gt;default&lt;&#x2F;em&gt; path following the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction. An interesting feature is that &lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt; is an inverted-&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, which can be used in many cases instead of &lt;code&gt;ISZERO RJUMPI relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We also extend the validation algorithm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; to verify that each &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; has a &lt;code&gt;relative_offset&lt;&#x2F;code&gt; pointing to an instruction. This means it cannot point to an immediate data of &lt;code&gt;PUSHn&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt;. It cannot point outside of code bounds. It is allowed to point to a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;, but is not required to.&lt;&#x2F;p&gt;
&lt;p&gt;Because the destinations are validated upfront, the cost of these instructions are less than their dynamic counterparts: &lt;code&gt;RJUMP&lt;&#x2F;code&gt; should cost 2, and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; should cost 4.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;relative-addressing&quot;&gt;Relative addressing&lt;&#x2F;h3&gt;
&lt;p&gt;We chose relative addressing in order to support code which is relocatable. This also means a code snippet can be injected. A technique seen used prior to this EIP to achieve the same goal was to inject code like &lt;code&gt;PUSHn PC ADD JUMPI&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We do not see any significant downside to relative addressing and it allows us to also deprecate the &lt;code&gt;PC&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;immediate-size&quot;&gt;Immediate size&lt;&#x2F;h3&gt;
&lt;p&gt;The signed 16-bit immediate means that the largest jump distance possible is 32767. In the case the bytecode at &lt;code&gt;PC=0&lt;&#x2F;code&gt; starts with an &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, it will be possible to jump as far as &lt;code&gt;PC=32770&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Given &lt;code&gt;MAX_CODE_SIZE = 24576&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt;) and &lt;code&gt;MAX_INITCODE_SIZE = 49152&lt;&#x2F;code&gt; (in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;), we think the 16-bit immediate is large enough.&lt;&#x2F;p&gt;
&lt;p&gt;A version with an 8-bit immediate would only allow moving &lt;code&gt;PC&lt;&#x2F;code&gt; backward by 125 or forward by 127 bytes. While that seems to be a good enough distance for many for-loops, it is likely not good enough for cross-function jumps, and since the 16-bit immediate is the same size as what a dynamic jump would take in such cases (3 bytes: &lt;code&gt;JUMP PUSH1 n&lt;&#x2F;code&gt;), we think having less instructions is better.&lt;&#x2F;p&gt;
&lt;p&gt;Should there be a need to have immediate encodings of other size (such as 8-bits, 24-bits or 32-bits), it would be possible to introduce new opcodes, similarly to how multiple &lt;code&gt;PUSH&lt;&#x2F;code&gt; instructions exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;pushn-jump-sequences&quot;&gt;&lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; sequences&lt;&#x2F;h3&gt;
&lt;p&gt;If we chose absolute addressing, then &lt;code&gt;RJUMP&lt;&#x2F;code&gt; could be viewed similar to the sequence &lt;code&gt;PUSHn JUMP&lt;&#x2F;code&gt; (and &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; similar to &lt;code&gt;PUSHn JUMPI&lt;&#x2F;code&gt;). In that case one could argue that instead of introducing a new instruction, such sequences should get a discount, because EVMs could optimise them.&lt;&#x2F;p&gt;
&lt;p&gt;We think this is a bad direction to go:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It further complicates the already complex rules of gas calculation.&lt;&#x2F;li&gt;
&lt;li&gt;And it either requires a consensus defined internal representation for EVM code, or forces EVM implementations to do optimisations on their own.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Both of these are risky. Furthermore we think that EVM implementations should be free to chose what optimisations they apply, and the savings do not need to be passed down at all cost.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it requires a potentially significant change to the current implementations which depend on a streaming one-by-one execution without a lookahead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;relation-to-dynamic-jumps&quot;&gt;Relation to dynamic jumps&lt;&#x2F;h3&gt;
&lt;p&gt;The goal was not to completely replace the current control flow system of the EVM, but to augment it. There are many cases where dynamic jumps are useful, such as returning to the caller.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible to introduce a new mechanism for having a pre-defined table of valid jump destinations, and dynamically supplying the index within this table to accomplish some form of dynamic jumps. This is very useful for efficiently encoding a form of &quot;switch-cases&quot; statements. It could also be used for &quot;return to caller&quot; cases, however it is likely inefficient or awkward.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;lack-of-jumpdest&quot;&gt;Lack of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; serves two purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;To efficiently partition code -- this can be useful for pre-calculating total gas usage for a given &lt;em&gt;block&lt;&#x2F;em&gt; (i.e. instructions between &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s), and for JIT&#x2F;AOT translation.&lt;&#x2F;li&gt;
&lt;li&gt;To explicitly show valid locations (otherwise any non-data location would be valid).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This functionality is not needed for static jumps, as the analysers can easily tell destinations from the static jump immediates during jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;p&gt;There are two benefits here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Not wasting a byte for a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; also means a saving of 200 gas during deployment, for each jump destination.&lt;&#x2F;li&gt;
&lt;li&gt;Saving an extra 1 gas per jump during execution, given &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; itself cost 1 gas and is &quot;executed&quot; during jumping.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rjumpv-fallback-case&quot;&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; fallback case&lt;&#x2F;h3&gt;
&lt;p&gt;If no match is found (i.e. the &lt;em&gt;default&lt;&#x2F;em&gt; case) in the &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction execution will continue without branching. This allows for gaps in the arguments to be filled with &lt;code&gt;0&lt;&#x2F;code&gt;s, and a choice of implementation by the programmer. Alternate options would include exceptional aborts in case of no match.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The new instructions are not introduced for legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;valid-cases&quot;&gt;Valid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with instruction other than &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; as target
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with various valid table sizes from 1 to 256&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;invalid-cases&quot;&gt;Invalid cases&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with truncated immediate&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; as a final instruction in code section&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; target outside of code section bounds&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; target push data&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; target another &lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; immediate argument&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; in legacy code aborts execution&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMP&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;relative_offset&lt;&#x2F;code&gt; is positive&#x2F;negative&#x2F;&lt;code&gt;0&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;condition&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV 0 relative_offset&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt; with table containing positive, negative, &lt;code&gt;0&lt;&#x2F;code&gt; offsets
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; equals &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; does not equal &lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; outside of table bounds (&lt;code&gt;case &amp;gt; max_index&lt;&#x2F;code&gt;, fallback case)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;case&lt;&#x2F;code&gt; &amp;gt; 255&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Adding new instructions with immediate arguments should be carefully considered when implementing the EOF container validation algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Static relative jump execution does not require runtime check of the jump destination. It greatly reduces execution cost. Therefore the gas cost of the new instructions can also be significantly reduced.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMPV&lt;&#x2F;code&gt; instruction relative offset table can have up to 256 one-byte entries, so reading an offset cannot be a potential attack surface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Warm COINBASE</title>
        <published>2021-07-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3651/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3651-warm-coinbase/6640" />
        

        <id>https://wg-eips.ritovision.com/3651/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3651"
            label="EIP-3651" />
        

        
        

        
        <summary type="html">Starts the `COINBASE` address warm</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3651/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;COINBASE&lt;&#x2F;code&gt; address shall be warm at the start of transaction execution, in accordance with the actual cost of reading that account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Direct &lt;code&gt;COINBASE&lt;&#x2F;code&gt; payments are becoming increasingly popular because they allow conditional payments, which provide benefits such as implicit cancellation of transactions that would revert.
But accessing &lt;code&gt;COINBASE&lt;&#x2F;code&gt; is overpriced; the address is initially cold under the access list framework introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;.
This gas cost mismatch can incentivize alternative payments besides ETH, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt;, but ETH should be the primary means of paying for transactions on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At the start of transaction execution, &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; shall be initialized to also include the address returned by &lt;code&gt;COINBASE&lt;&#x2F;code&gt; (&lt;code&gt;0x41&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The addresses currently initialized warm are the addresses that should already be loaded at the start of transaction validation.
The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; address is always loaded to check its balance against the gas limit and the gas price.
The &lt;code&gt;tx.to&lt;&#x2F;code&gt; address is always loaded to begin execution.
The &lt;code&gt;COINBASE&lt;&#x2F;code&gt; address should also be always be loaded because it receives the block reward and the transaction fees.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues presented by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security considerations introduced by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - Code Validation</title>
        <published>2021-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3670/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3670-eof-code-validation/6693" />
        

        <id>https://wg-eips.ritovision.com/3670/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3670"
            label="EIP-3670" />
        

        
        

        
        <summary type="html">Validate EOF bytecode for correctness at the time of deployment.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3670/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce code validation at contract creation time for EOF formatted (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;)
contracts. Reject contracts which contain truncated &lt;code&gt;PUSH&lt;&#x2F;code&gt;-data or undefined instructions.
Legacy bytecode (code which is not EOF formatted) is unaffected by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently existing contracts require no validation of correctness and EVM implementations can decide
how they handle truncated bytecode or undefined instructions. This change aims to bring code
validity into consensus, so that it becomes easier to reason about bytecode.
Moreover, EVM implementations may require fewer paths to decide which instruction is valid in
the current execution context.&lt;&#x2F;p&gt;
&lt;p&gt;If there&#x27;s a desire to introduce new instructions without bumping the EOF version, having undefined instructions already deployed could potentially break such contracts, as some instructions might change their behavior. Rejecting to deploy undefined instructions allows
introducing new instructions with or without bumping the EOF version.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-forward-compatibility&quot;&gt;EOF1 forward compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;The EOF1 format provides following forward compatibility properties:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;New instructions can be defined for previously unassigned opcodes. These instructions may have immediate values.&lt;&#x2F;li&gt;
&lt;li&gt;Mandatory EOF sections may be made optional.&lt;&#x2F;li&gt;
&lt;li&gt;New optional EOF sections may be introduced. They can be placed in any order in relation to previously defined sections.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This feature is introduced on the same block EIP-3540 is enabled, therefore every EOF1-compatible bytecode MUST be validated according to these rules.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Previously deprecated instructions &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (0xf2) and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (0xff), as well as instructions deprecated in EIP-3540, are invalid and their opcodes are undefined. (&lt;strong&gt;NOTE&lt;&#x2F;strong&gt; there are more instructions deprecated and rejected in EOF, as specced out by separate EIPs)&lt;&#x2F;li&gt;
&lt;li&gt;At contract creation time &lt;em&gt;code validation&lt;&#x2F;em&gt; is performed on each code section of the EOF container. The code is invalid if any of the checks below fails. For each instruction:
&lt;ol&gt;
&lt;li&gt;Check if the opcode is defined. The &lt;code&gt;INVALID&lt;&#x2F;code&gt; (0xfe) is considered defined.&lt;&#x2F;li&gt;
&lt;li&gt;Check if all instructions&#x27; immediate bytes are present in the code (code does not end in the middle of instruction).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;immediate-data&quot;&gt;Immediate data&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing implicit zero immediate data for &lt;code&gt;PUSH&lt;&#x2F;code&gt; instructions introduces inefficiencies to EVM implementations without any practical use-case (the value of a &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction at the code end cannot be observed by EVM). This EIP requires all immediate bytes to be explicitly present in the code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rejection-of-deprecated-instructions&quot;&gt;Rejection of deprecated instructions&lt;&#x2F;h3&gt;
&lt;p&gt;The deprecated instructions &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (0xf2) and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (0xff) are removed from the &lt;code&gt;valid_opcodes&lt;&#x2F;code&gt; list to prevent their use in the future.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blockhash-instruction&quot;&gt;BLOCKHASH instruction&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; instruction is well replaced by the system contract introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2935&#x2F;&quot;&gt;EIP-2935&lt;&#x2F;a&gt;.
However, despite a replacement being introduced this opcode has not been deprecated.
This opcode will remain valid in EOF not to differentiate from legacy bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The validation does not cover legacy bytecode (code which is not EOF formatted).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contract-creation&quot;&gt;Contract creation&lt;&#x2F;h3&gt;
&lt;p&gt;Each case should be tested by submitting an EOF container to EOF contract creation (as specced out in a separate EIP). Each case should be tested with code placed in code sections at different indices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;valid-codes&quot;&gt;Valid codes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EOF code containing &lt;code&gt;INVALID&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;EOF code with data section containing bytes that are undefined instructions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;invalid-codes&quot;&gt;Invalid codes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;EOF code containing an undefined instruction&lt;&#x2F;li&gt;
&lt;li&gt;EOF code ending with incomplete &lt;code&gt;PUSH&lt;&#x2F;code&gt; instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The ranges below are as specified by Execution Specs for Shanghai.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: range(s, e) excludes e, hence the +1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;shanghai_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;30&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;48&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;50&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;70&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;90&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    *&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;a4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: 0xfe is considered assigned.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fa&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fe&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Drop the opcodes deprecated and rejected in here and in EIP-3540&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;rejected_in_eof&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;38&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;39&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;f4&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fa&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; shanghai_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; rejected_in_eof&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;immediate_sizes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;immediate_sizes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; PUSH1..PUSH32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Raises ValidationException on invalid code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_instructions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note that EOF1 already asserts this with the code section requirements&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure the opcode is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; valid_opcodes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            raise&lt;&#x2F;span&gt;&lt;span&gt; ValidationException&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip immediate data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; immediate_sizes&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;opcode&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure last instruction&amp;#39;s immediate doesn&amp;#39;t go over code end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        raise&lt;&#x2F;span&gt;&lt;span&gt; ValidationException&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;truncated immediate&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;#security-considerations&quot;&gt;Security Considerations of EIP-3540&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - JUMPDEST Table</title>
        <published>2021-06-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3690/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3690-eof-jumpdest-table/6806" />
        

        <id>https://wg-eips.ritovision.com/3690/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3690"
            label="EIP-3690" />
        

        
        

        
        <summary type="html">A special EOF section for storing the list of JUMPDESTs, which simplifies execution time analysis.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3690/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a section in the EOF format (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;) for storing the list of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s, validate the correctness of this list at the time of contract creation, and remove the need for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis at execution time. In EOF contracts, the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instruction is not needed anymore and becomes invalid. Legacy contracts are entirely unaffected by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently existing contracts require no validation of correctness, but every time they are executed, a list must be built containing all the valid jump-destinations. This is an overhead which can be avoided, albeit the effect of the overhead depends on the client implementation.&lt;&#x2F;p&gt;
&lt;p&gt;With the structure provided by EIP-3540 it is easy to store and transmit a table of valid jump-destinations instead of using designated &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (0x5b) opcodes in the code.&lt;&#x2F;p&gt;
&lt;p&gt;The goal of this change is that we trade less complexity (and processing time) at execution time for more complexity at contract creation time. Through benchmarks we have identified that the mandatory execution preparation time is the same as before for extreme cases (i.e. deliberate edge cases), while it is ~10x faster for the average case.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, this change puts an implicit bound on &quot;initcode analysis&quot; which is now limited to jumpdests section loading of max size of 0xffff. The legacy code remains vulnerable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This feature is introduced on the very same block &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; is enabled, therefore every EOF1-compatible bytecode MUST have a JUMPDEST-table if it uses jumps.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Remark:&lt;&#x2F;em&gt; We rely on the notation of &lt;em&gt;initcode&lt;&#x2F;em&gt;, &lt;em&gt;code&lt;&#x2F;em&gt; and &lt;em&gt;creation&lt;&#x2F;em&gt; as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt;, and extend validation rules of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-container-changes&quot;&gt;EOF container changes&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;A new EOF section called &lt;code&gt;jumpdests&lt;&#x2F;code&gt; (&lt;code&gt;section_kind = 3&lt;&#x2F;code&gt;) is introduced. It contains a sequence of &lt;em&gt;n&lt;&#x2F;em&gt; unsigned integers &lt;em&gt;jumploc&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;em&gt;jumploc&lt;sub&gt;i&lt;&#x2F;sub&gt;&lt;&#x2F;em&gt; values are encoded with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;LEB128#Unsigned_LEB128&quot;&gt;unsigned LEB128&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;encoding&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;jumploc&lt;sub&gt;0&lt;&#x2F;sub&gt;&lt;&#x2F;td&gt;&lt;td&gt;unsigned LEB128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;jumploc&lt;sub&gt;1&lt;&#x2F;sub&gt;&lt;&#x2F;td&gt;&lt;td&gt;unsigned LEB128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;...&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;jumploc&lt;sub&gt;n&lt;&#x2F;sub&gt;&lt;&#x2F;td&gt;&lt;td&gt;unsigned LEB128&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The jump destinations represent the set of valid code positions as arguments to jump instructions. They are delta-encoded therefore partial sum must be performed to retrieve the absolute offsets.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; jumpdest&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;n&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; jumpdests_table&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;jumpdests_table&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;validation-rules&quot;&gt;Validation rules&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;This section extends contract creation validation rules (as defined in EIP-3540).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;The &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section MUST be present if and only if the &lt;code&gt;code&lt;&#x2F;code&gt; section contains &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; opcodes.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section is present it MUST directly precede the &lt;code&gt;code&lt;&#x2F;code&gt; section. In this case a valid EOF bytecode will have the form of &lt;code&gt;format, magic, version, [jumpdests_section_header], code_section_header, [data_section_header], 0, [jumpdests_section_contents], code_section_contents, [data_section_contents]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The LEB128 encoding of a &lt;code&gt;jumploc&lt;&#x2F;code&gt; must be valid: the encoding must be complete and not read out of &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section. As an additional constraint, the shortest possible encoding must be used.&lt;&#x2F;li&gt;
&lt;li&gt;With an exception of the first entry, the value of &lt;code&gt;jumploc&lt;&#x2F;code&gt; MUST NOT be 0.&lt;&#x2F;li&gt;
&lt;li&gt;Every &lt;code&gt;jumploc&lt;&#x2F;code&gt; MUST point to a valid opcode. They MUST NOT point into PUSH-data or outside of the code section.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; (0x5b) instruction becomes undefined (Note: According to rules of EIP-3670, deploying the code will fail if it contains &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;ol start=&quot;10&quot;&gt;
&lt;li&gt;When executing &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions, the jump destination MUST be in the &lt;code&gt;jumpdests&lt;&#x2F;code&gt; table. Otherwise, the execution aborts with &lt;em&gt;bad jump destination&lt;&#x2F;em&gt;. In case of &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, the check is done only when the jump is to be taken (no change to the previous behaviour).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;jumpdests-section-is-bounded&quot;&gt;Jumpdests section is bounded&lt;&#x2F;h3&gt;
&lt;p&gt;The length of the &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section is bounded by the EOF maximum section size value 0xffff. Moreover, for deployed code this is additionally limited by the max bytecode size 0x6000. Then any valid &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section may not be larger than 0x3000.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;delta-encoding&quot;&gt;Delta encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Delta-encoding is very efficient for this job. From a quick analysis of a small set of contracts &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; opcodes are relatively close to each other. In the delta-encoding the values almost never exceed 128. Combined with any form of variable-length quantity (VLQ) where values &amp;lt; 128 occupy one byte, encoding of single jumpdest takes ~1 byte. We also remove &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; opcodes from the code section therefore the total bytecode length remains the same if extreme examples are ignored.&lt;&#x2F;p&gt;
&lt;p&gt;By extreme examples we mean contracts having a distance between two subsequent JUMPDESTs larger than 128. Then the LEB128 encoding of such distance requires more than one byte and the total bytecode size will increase by the additional number of bytes used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;leb128-for-offsets&quot;&gt;LEB128 for offsets&lt;&#x2F;h3&gt;
&lt;p&gt;The LEB128 encoding is the most popular VLQ used in DWARF and WebAssembly.&lt;&#x2F;p&gt;
&lt;p&gt;LEB128 allows encoding a fixed value with arbitrary number of bytes by having zero payloads for most significant bits of the value. To ensure there exists only single encoding of a given value, we additionally require the shortest possible LEB128 encoding to be used. This constraint is also required by WebAssembly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-prefix-for-offsets&quot;&gt;Size-prefix for offsets&lt;&#x2F;h3&gt;
&lt;p&gt;This is another option for encoding inspired by UTF-8. The benefit is that the number of following bytes is encoded in the first byte (the top two bits), so the expected length is known upfront.&lt;&#x2F;p&gt;
&lt;p&gt;A simple decoder is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span&gt; size_prefix&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not support case 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;False&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;empty-table&quot;&gt;Empty table&lt;&#x2F;h3&gt;
&lt;p&gt;In case code does not use jumps, an empty JUMPDEST table is represented by omitting &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section as opposed to a section that is always present, but allowed to be empty. This is consistent with the requirement of EIP-3540 for section size to be non-zero. Additionally, omitting the section saves 3 bytes of code storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-jumpdests-before-code&quot;&gt;Why jumpdests before code?&lt;&#x2F;h3&gt;
&lt;p&gt;The contents of &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section are always needed to start EVM execution. For chunked and&#x2F;or merkleized bytecode it is more efficient to have &lt;code&gt;jumpdests&lt;&#x2F;code&gt; just after the EOF header so they can share the same first chunk(s).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-chunking-merkleization&quot;&gt;Code chunking &#x2F; merkleization&lt;&#x2F;h3&gt;
&lt;p&gt;In code chunking the contract code is split into (fixed size) chunks. Due to the requirement of jumpdest-analysis, it must be known where the first instruction starts in a given chunk, in case the split happened within a PUSH-data. This is commonly accomplished with reserving the first byte of the chunk as the &quot;first instruction offset&quot; (FIO) field.&lt;&#x2F;p&gt;
&lt;p&gt;With this EIP, code chunking does not need to have such a field. However, the jumpdest table must be provided instead (for all the chunks up until the last jump location used during execution).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarks-performance-analysis&quot;&gt;Benchmarks &#x2F; performance analysis&lt;&#x2F;h3&gt;
&lt;p&gt;We compared the performance of &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section loading to JUMPDEST analysis in evmone&#x2F;Baseline interpreter. In both cases a bitset of valid jumpdest positions is built.&lt;&#x2F;p&gt;
&lt;p&gt;We used the worst case for &lt;code&gt;jumpdests&lt;&#x2F;code&gt; section as the benchmark baseline. This is the case where every position in the code section is valid jumpdest. I.e. the bytecode has as many jumpdests as possible making the jumpdests section as large as possible. The encoded representation is &lt;code&gt;0x00, 0x01, 0x01, 0x01, ...&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This also happen to be the worst case for the JUMPDEST analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Further, we picked 5 popular contracts from the Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;case&lt;&#x2F;th&gt;&lt;th&gt;size&lt;&#x2F;th&gt;&lt;th&gt;num JUMPDESTs&lt;&#x2F;th&gt;&lt;th&gt;JUMPDEST analysis (cycles&#x2F;byte)&lt;&#x2F;th&gt;&lt;th&gt;jumpdests load (cycles&#x2F;byte)&lt;&#x2F;th&gt;&lt;th&gt;performance change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;worst&lt;&#x2F;td&gt;&lt;td&gt;65535&lt;&#x2F;td&gt;&lt;td&gt;65535&lt;&#x2F;td&gt;&lt;td&gt;9.11&lt;&#x2F;td&gt;&lt;td&gt;9.36&lt;&#x2F;td&gt;&lt;td&gt;2.75%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RoninBridge&lt;&#x2F;td&gt;&lt;td&gt;1760&lt;&#x2F;td&gt;&lt;td&gt;71&lt;&#x2F;td&gt;&lt;td&gt;3.57&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-89.41%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UniswapV2ERC20&lt;&#x2F;td&gt;&lt;td&gt;2319&lt;&#x2F;td&gt;&lt;td&gt;61&lt;&#x2F;td&gt;&lt;td&gt;2.10&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-88.28%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DepositContract&lt;&#x2F;td&gt;&lt;td&gt;6358&lt;&#x2F;td&gt;&lt;td&gt;123&lt;&#x2F;td&gt;&lt;td&gt;1.86&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-90.24%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;TetherToken&lt;&#x2F;td&gt;&lt;td&gt;11075&lt;&#x2F;td&gt;&lt;td&gt;236&lt;&#x2F;td&gt;&lt;td&gt;1.91&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-89.58%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;UniswapV2Router02&lt;&#x2F;td&gt;&lt;td&gt;21943&lt;&#x2F;td&gt;&lt;td&gt;468&lt;&#x2F;td&gt;&lt;td&gt;2.26&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-91.17%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For the worst case the performance difference between JUMPDEST analysis and jumpdests section loading is very small. The performance very slow compared to memory copy (0.15 cycles&#x2F;byte).&lt;&#x2F;p&gt;
&lt;p&gt;However, the maximum length for the worst cases is different. For JUMPDEST analysis this is 24576 (0x6000) for deployed contracts and only limited by EVM memory cost in case of &lt;em&gt;initcode&lt;&#x2F;em&gt; (can be over 1MB). For jumpdests sections, the limit is 12288 for deployed contracts (the deployed bytecode length limit must be split equally between jumpdests and code sections). For &lt;em&gt;initcode&lt;&#x2F;em&gt; case, the limit is 65535 because this is the maximum section size allowed by EOF.&lt;&#x2F;p&gt;
&lt;p&gt;For &quot;popular&quot; contracts the gained efficiency is ~10x because the jumpdests section is relatively small compared to the code section and therefore there is much less bytes to loop over than in JUMPDEST analysis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;We extend the &lt;code&gt;validate_code()&lt;&#x2F;code&gt; function of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The same table as in EIP-3670&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid_opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove JUMPDEST from the list of valid opcodes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;valid_opcodes&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This helper decodes a single unsigned LEB128 encoded value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will abort on truncated (short) input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; leb128u_decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check for truncated input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;      #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Only allow up to 4-byte long leb128 encodings&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;consumed_bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      ret&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; shift&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Do not allow additional leading zero bits.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;input_byte&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; ||&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;          break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      shift&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;ret&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This helper parses the jumpdest table into a list of relative offsets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will abort on truncated (short) input&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parse_table&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  jumpdests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; leb128u_decode&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      jumpdests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; consumed_bytes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; jumpdests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This helper translates the delta offsets into absolute ones&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This will abort on invalid 0-value entries&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_jumpdests&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;delta&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    partial_sum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    first&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; delta&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; first&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            first&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;d&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        partial_sum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        jumpdests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;partial_sum&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; jumpdests&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Fails with assertion on invalid code&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expects list of absolute jumpdest offsets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_code&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;code&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; jumpdests&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; list&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure the opcode is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; valid_opcodes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Remove touched offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        try&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            jumpdests&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;remove&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        except&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; ValueError&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Skip pushdata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7f&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;60&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure last PUSH doesn&amp;#39;t go over code end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;pos&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The table is invalid if there are untouched locations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;jumpdests&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;valid-bytecodes&quot;&gt;Valid bytecodes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;No jumpdests&lt;&#x2F;li&gt;
&lt;li&gt;Every byte is a jumpdest&lt;&#x2F;li&gt;
&lt;li&gt;Distant jumpdests (0x7f and 0x3f01 bytes apart)&lt;&#x2F;li&gt;
&lt;li&gt;Max number of jumpdests
&lt;ul&gt;
&lt;li&gt;1-byte offset encoding: initcode of max size (64K) with jumpdest at each byte - table contains 65536 1-byte offsets, first one is 0x00, all others equal 0x01&lt;&#x2F;li&gt;
&lt;li&gt;2-byte offset encoding: inicode of max size with jumpdests 0x80 (128) bytes apart - table contains 512 offsets, first one is 0x7f (127), all others equal 0x8001&lt;&#x2F;li&gt;
&lt;li&gt;3-byte offset encoding: inicode of max size with jumpdests 0x4000 (16384) bytes apart - table contains 4 offsets: 0xFF7F (16383), 0x808001, 0x808001, 0x808001&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;invalid-bytecodes&quot;&gt;Invalid bytecodes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Empty jumpdest section&lt;&#x2F;li&gt;
&lt;li&gt;Multiple jumpdest sections&lt;&#x2F;li&gt;
&lt;li&gt;jumpdest section after the code section&lt;&#x2F;li&gt;
&lt;li&gt;jumpdest section after the data section&lt;&#x2F;li&gt;
&lt;li&gt;Final jumploc in the table is truncated (not a valid LEB128)&lt;&#x2F;li&gt;
&lt;li&gt;LEB128 encoding with extra 0s (non-minimal encoding)&lt;&#x2F;li&gt;
&lt;li&gt;Jumpdest location pointing to PUSH data&lt;&#x2F;li&gt;
&lt;li&gt;Jumpdest location out of code section bounds
&lt;ul&gt;
&lt;li&gt;pointing into data section&lt;&#x2F;li&gt;
&lt;li&gt;pointing into jumpdest section&lt;&#x2F;li&gt;
&lt;li&gt;pointing outside container bounds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Duplicate jumpdest locations (0 deltas in table other than 1st offset)&lt;&#x2F;li&gt;
&lt;li&gt;Code containing &lt;code&gt;JUMP&lt;&#x2F;code&gt; but no jumpdest table&lt;&#x2F;li&gt;
&lt;li&gt;Code containing &lt;code&gt;JUMPI&lt;&#x2F;code&gt; but no jumpdest table&lt;&#x2F;li&gt;
&lt;li&gt;Code containing jumpdest table but not &lt;code&gt;JUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;JUMPI&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Code containing &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change poses no risk to backwards compatibility, as it is introduced at the same time EIP-3540 is. The requirement of a JUMPDEST table does not cover legacy bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any security or DoS risks posed by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reject transactions from senders with deployed code</title>
        <published>2021-06-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	<author>
		<name>Dmitry Khovratovich</name><uri>https://github.com/khovratovich</uri>
	</author>
	
	<author>
		<name>Marius van der Wijden</name><uri>https://github.com/MariusVanDerWijden</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3607/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3608" />
        

        <id>https://wg-eips.ritovision.com/3607/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3607"
            label="EIP-3607" />
        

        
        

        
        <summary type="html">Do not allow transactions for which `tx.sender` has any code deployed.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3607/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum addresses are currently only 160 bits long. This means it is possible to create a collision between a contract account and an Externally Owned Account (EOA) using an estimated &lt;code&gt;2**80&lt;&#x2F;code&gt; computing operations, which is feasible now given a large budget (ca. 10 billion USD). The fix in this EIP prevents the worst possible attack, where a safe looking contract (e.g. a token wrapper or an AMM-type contract) is deployed to attract user funds, which can then be spent using the EOA key for the same address. The fix is to never allow to use an address that already has code deployed as an EOA address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;generating-address-collisions&quot;&gt;Generating address collisions&lt;&#x2F;h3&gt;
&lt;p&gt;By creating keys for &lt;code&gt;2**80&lt;&#x2F;code&gt; EOAs and simulating the deployment of &lt;code&gt;2**80&lt;&#x2F;code&gt; contracts from these EOAs (one each), one expects to find about one collision where an EOA has the same address as one contract.&lt;&#x2F;p&gt;
&lt;p&gt;This very simple form of the attack requires the storage of &lt;code&gt;2**80&lt;&#x2F;code&gt; addresses, which is a practical barrier: It would require &lt;code&gt;2.4*10**25&lt;&#x2F;code&gt; bytes of memory (24 Yottabyte). However, there are cycle finding algorithms that can perform the collision search without requiring large amounts of storage. An estimate for the complexity has been made &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;Vzhp5YJyTT-LhWm_s0JQpA&quot;&gt;here&lt;&#x2F;a&gt;. We estimate that a collision between a contract and an EOA could be found in about one year with an investment of ca. US$10 billion in hardware and electricity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;background&quot;&gt;Background&lt;&#x2F;h3&gt;
&lt;p&gt;There is currently a discussion to move to 256-bit addresses on Ethereum, which would increase collision resistance to a complexity of &lt;code&gt;2**128&lt;&#x2F;code&gt; which is currently thought infeasible for the foreseeable future. However, with 160 bit addresses, the collision problem can be effectively solved now, as demonstrated above.&lt;&#x2F;p&gt;
&lt;p&gt;Most attacks that can occur via address collisions are quite impractical: They involve users sending funds to an address before a contract is deployed. This is a very rare application in practice and users can easily circumvent the attack by never sending funds to a contract until it has been safely deployed with enough confirmations.&lt;&#x2F;p&gt;
&lt;p&gt;However, the yellow paper does not explicitly specify how a client should handle the case where a transaction is sent from an account that already has contract code deployed; presumably because this was considered infeasible at the time. The assumption is that most client would allow this transaction in their current state.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is to specify this behaviour to always forbid such transactions. This fixes most realistic or serious attacks due to address collisions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Any transaction where &lt;code&gt;tx.sender&lt;&#x2F;code&gt; has a &lt;code&gt;CODEHASH != EMPTYCODEHASH&lt;&#x2F;code&gt; MUST be rejected as invalid, where &lt;code&gt;EMPTYCODEHASH = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;.
The invalid transaction MUST be rejected by the client and not be included in a block.
A block containing such a transaction MUST be considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We note that it was always expected that a contract account&#x27;s behaviour is constrained by the code in that contract -- which means that the account&#x27;s funds should not suddenly be spendable by some private key. It was just implicitly assumed in the past that a 160 bit address length is enough to provide collision resistance, and thus that this case could never occur. In that sense, this EIP should be seen as a clarification of protocol behaviour in a previously undefined case rather than an explicit upgrade of consensus rules.&lt;&#x2F;p&gt;
&lt;p&gt;This does not exclude all possible attack vectors, only the most serious one. Further possible attack vectors via address collisions between contracts and EOAs are:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;An attacker can convince a user to send funds to an account before it is deployed. Some applications require this behaviour (e.g. state channels).&lt;&#x2F;li&gt;
&lt;li&gt;A chain reorg can happen after a contract is deployed. If the reorg removes the contract deployment transaction the funds can still be accessed using the private key.&lt;&#x2F;li&gt;
&lt;li&gt;A contract can self destruct, with the stated intention that ERC20s (or other tokens) in the contract would be burned. However, they can now be accessed by a key for that address.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;All these scenarios are much harder to exploit for an attacker, and likely have much lower yield making the attacks unlikely to be economically viable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It is unlikely that an attack like this has already occurred on the Ethereum mainnet, or we would very likely have heard of it. It is inconceivable that someone would use this as a &quot;feature&quot; to make a contract an EOA at the same time, when they could simply do this by adding some methods to the contract instead of spending billions on building hardware to find hash collisions.&lt;&#x2F;p&gt;
&lt;p&gt;Private networks may have deployed contracts which also work as EOAs at genesis and should check that this upgrade does not impact their workflows.&lt;&#x2F;p&gt;
&lt;p&gt;Clients might choose to disable this rule for RPC calls like &lt;code&gt;eth_call&lt;&#x2F;code&gt; and &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt; as some Multi-Sig contracts use these calls to create transactions as if they originated from the multisig contract itself.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Given a genesis allocation of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Address: 0x71562b71999873DB5b286dF957af199Ec94617F7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Balance: 1000000000000000000 &#x2F;&#x2F; 1 ether&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce:   0,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Code:    0xB0B0FACE&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Every transaction sent by the private key corresponding to &lt;code&gt;0x715656...&lt;&#x2F;code&gt; (
&lt;code&gt;b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291&lt;&#x2F;code&gt;) should be rejected.
These transaction must be rejected and not included in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following check must be added to the state transition checks after checking that the nonce of the sender is correct.
The sender is the address recovered from the signature of the transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Make sure the sender is an EOA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Set ch to the CodeHash of the sender account&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if ch is not equal to EmptyCodeHash then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	return ErrSenderNoEOA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A diff to implement EIP-3607 in go-ethereum can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;.&#x2F;assets&#x2F;geth.diff&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is a strict security upgrade: It simply makes some transactions that were formerly valid now invalid. There is no legitimate use for such transactions, so there should be no security downsides.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP can be implemented as a soft fork because the new validity rules are a strict superset of the previous validity rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Access List</title>
        <published>2021-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11in</uri>
	</author>
	
	<author>
		<name>Piper Merriam</name><uri>https://github.com/pipermerriam</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3584/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/block-access-list-v0-1/9505" />
        

        <id>https://wg-eips.ritovision.com/3584/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3584"
            label="EIP-3584" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3584/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A proposal to build a block&#x27;s &lt;code&gt;access_list&lt;&#x2F;code&gt; and include its fingerprint &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; in the block header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; centers around normalizing the (low) gas costs of data&#x2F;storage accesses made by a transaction as well as providing for (and encouraging) a new transaction type format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;that makes upfront &lt;code&gt;access_list&lt;&#x2F;code&gt; declarations, where &lt;code&gt;access_list&lt;&#x2F;code&gt; is some &lt;code&gt;[[{20 bytes}, [{32 bytes}...]]...]&lt;&#x2F;code&gt; map of &lt;code&gt;AccessedAddress=&amp;gt; AccessedStorageKeys&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The first &lt;em&gt;accesses&lt;&#x2F;em&gt; of these upfront &lt;em&gt;declarations&lt;&#x2F;em&gt; are charged at discounted price (roughly ~&lt;code&gt;10%&lt;&#x2F;code&gt;) and first accesses outside this list are charged higher price. Reason is upfront access declaration provides for a way to &lt;em&gt;preload&#x2F;optimize&#x2F;batch&lt;&#x2F;em&gt; loading these locations while executing the transaction.
This inadvertently leads to generation of transaction &lt;code&gt;access_list&lt;&#x2F;code&gt; that has all (first) accesses (declared or not) made by a transaction.
This proposal is to collate these &lt;em&gt;transaction&lt;&#x2F;em&gt; &lt;code&gt;access_list&lt;&#x2F;code&gt;s for all the transactions in a &lt;strong&gt;block&lt;&#x2F;strong&gt; &lt;code&gt;access_list&lt;&#x2F;code&gt; document and include its &lt;em&gt;fingerprint&lt;&#x2F;em&gt; in the block header.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Motivation for collating the &lt;em&gt;transaction&lt;&#x2F;em&gt; &lt;code&gt;access_list&lt;&#x2F;code&gt;s for all the transactions in a &lt;strong&gt;block&lt;&#x2F;strong&gt;’s &lt;code&gt;access_list&lt;&#x2F;code&gt; is to have an &lt;em&gt;access index&lt;&#x2F;em&gt; of the block with following benefits:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Block execution&#x2F;validation optimizations&#x2F;parallelization&#x2F;cache warm-up by enabling construction of &lt;em&gt;a partial order&lt;&#x2F;em&gt; for access and hence execution (hint: &lt;em&gt;chains&lt;&#x2F;em&gt; in this &lt;em&gt;poset&lt;&#x2F;em&gt; can be parallelized).&lt;&#x2F;li&gt;
&lt;li&gt;Enabling partial inspection and fetching&#x2F;serving of a block data&#x2F;state by &lt;em&gt;light sync&lt;&#x2F;em&gt; or &lt;em&gt;fast sync&lt;&#x2F;em&gt; protocols concerned with a subset of addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Possible future extension of this list to serve as index for bundling, serving and fetching witness data for &lt;em&gt;stateless&lt;&#x2F;em&gt; protocols.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A block &lt;code&gt;access_list&lt;&#x2F;code&gt; represents:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Set [ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    AccessedAddress, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List [AccessedStorageKeys] , &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Set  [ AccessedInBlockTransactionNumber, List [ AccessedStorageKeys ]]  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A &lt;strong&gt;canonical&lt;&#x2F;strong&gt; construction of such an &lt;code&gt;access_list&lt;&#x2F;code&gt; is specified as below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;canonical-block-access-list&quot;&gt;Canonical Block Access List&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;access_list&lt;&#x2F;code&gt; is defined to be comprised of many &lt;code&gt;access_list_entry&lt;&#x2F;code&gt; elements:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list   :=  [access_list_entry, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An &lt;code&gt;access_list_entry&lt;&#x2F;code&gt; is a 3-tuple of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address&lt;&#x2F;li&gt;
&lt;li&gt;sorted list of storage keys of the address accessed across the entire block&lt;&#x2F;li&gt;
&lt;li&gt;sorted list of 2-tuples of:
&lt;ul&gt;
&lt;li&gt;transaction index in which the address or any of its storage keys were accessed&lt;&#x2F;li&gt;
&lt;li&gt;sorted list of storage keys which were accessed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list                 := [access_list_entry, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list_entry           := [address, storage_keys, accesses_by_txn_index]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;address                     := bytes20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;accesses_by_txn_index       := [txn_index_and_keys, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;txn_index_and_keys          := [txn_index, storage_keys]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;txn_index                   := uint64  # or uint256 or whatever&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_keys                := [storage_key, ...]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;storage_key                 := bytes32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional sorting rules for the above are that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;access_list&lt;&#x2F;code&gt; is sorted by the &lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;storage_keys&lt;&#x2F;code&gt; is sorted&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accesses_by_txn_index&lt;&#x2F;code&gt; is sorted by &lt;code&gt;txn_index&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Additional validation rules for the above are that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Each unique &lt;code&gt;address&lt;&#x2F;code&gt; may only appear at most once in &lt;code&gt;access_list&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Each &lt;code&gt;storage_key&lt;&#x2F;code&gt; may only appear at most once in &lt;code&gt;storage_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Each &lt;code&gt;txn_index&lt;&#x2F;code&gt; may only appear at most once in &lt;code&gt;txn_index_and_keys&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All sorting is in increasing order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accesslistroot&quot;&gt;AccessListRoot&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; is a URN &lt;em&gt;like&lt;&#x2F;em&gt; encoding &lt;code&gt;Hash&#x2F;Commitment&lt;&#x2F;code&gt; of the canonical &lt;code&gt;access_list&lt;&#x2F;code&gt; as well as the construction type ( &lt;code&gt;sha256&lt;&#x2F;code&gt; ) and serialization type ( &lt;code&gt;json&lt;&#x2F;code&gt; ), i.e.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;AccessListRoot := &amp;quot;urn:sha256:json:0x${ SHA256( access_list.toJSONString(&amp;#39;utf8&amp;#39;) ).toHexString() }&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;0x${ SHA256 (...)...}&lt;&#x2F;code&gt; is the &lt;code&gt;SHA256&lt;&#x2F;code&gt; hashed &lt;code&gt;32&lt;&#x2F;code&gt; bytes hex string as indicated by leading &lt;code&gt;0x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-block-validation&quot;&gt;Additional Block Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validating a new block requires an additional validation check that the block’s &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; matches the one generated by executing the block using the construction as defined by the &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; URN.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sorting-of-canonical-access-list&quot;&gt;Sorting of canonical &lt;code&gt;access_list&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;It is specified to be sorted in lexicographic ordering or integer sorting wherever applicable and specified. Sorting with respect to access time was considered but didn&#x27;t seem to provide any additional benefit at the cost of adding implementation complexity and bookkeeping.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;accesslistroot-1&quot;&gt;&lt;code&gt;AccessListRoot&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; is generated to prevent any &lt;em&gt;griefing&lt;&#x2F;em&gt; attacks and hence will need to be included (and validated) in the &lt;em&gt;block header&lt;&#x2F;em&gt;.
Even though &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; is currently specified to be a simple &lt;code&gt;sha256&lt;&#x2F;code&gt; hash of the canonical &lt;code&gt;access_list&lt;&#x2F;code&gt;, it would be beneficial to consider other constructions&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;a tree structure (&lt;code&gt;merkle&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;verkle&lt;&#x2F;code&gt;). It will be a bit more expensive but will enable partial downloading, inspection and validation of the &lt;code&gt;access_list&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;a normal &lt;code&gt;kate&lt;&#x2F;code&gt; commitment can also be generated to enable this partial capability and is recommended as validating partial fetch of access list chunks would be very simple.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Also serialization of the &lt;code&gt;access_list&lt;&#x2F;code&gt; is currently specified as a normal &lt;code&gt;JSON String&lt;&#x2F;code&gt; dump and these parameters could vary from construction to construction, but for the sake of simplicity, it can always be &lt;code&gt;sha256&lt;&#x2F;code&gt; hashed to get a consistent &lt;code&gt;32&lt;&#x2F;code&gt; bytes hex string root.&lt;&#x2F;p&gt;
&lt;p&gt;So this AccessListRoot could evolve to &lt;code&gt;urn:merkle:ssz:...&lt;&#x2F;code&gt; or to &lt;code&gt;urn:kate:...&lt;&#x2F;code&gt; or to any other scheme as per requirement. And the idea of having the &lt;code&gt;AccessListRoot&lt;&#x2F;code&gt; as URN &lt;em&gt;like&lt;&#x2F;em&gt; structure is to enable upgradation to these paths without affecting block structure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-extensions-of-access-list&quot;&gt;Future extensions of &lt;code&gt;access_list&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;We can extend the notion of a block’s &lt;code&gt;access_list&lt;&#x2F;code&gt; to include witnesses:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;access_list := Set[ &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    List [ AddressWitnesses ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Set  [ AccessedStorageKey, List [ StorageKeyWitnesses] ],        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    Set  [ AccessedInBlockTransactionNumber, List [ AccessedStorageKeys ] ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and then get to define the a canonical specification for building the fingerprint.
This will allow an incremental path to partial or full statelessness, where it would be easy to bundle&#x2F;request &lt;strong&gt;witnesses&lt;&#x2F;strong&gt; using this &lt;code&gt;access_list&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The extra block validation will only be mandatory post the block number this EIP comes into effect, but the clients can still provide a way to generate (and possibly store) this access list  on request (via the &lt;code&gt;JSON&#x2F;RPC&lt;&#x2F;code&gt; api). However this is optional and client dependent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues as a result of this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Difficulty Bomb Delay to December 2021</title>
        <published>2021-05-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Hancock</name><uri>https://github.com/madeoftin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3554/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3554-ice-age-delay-targeting-december-2021/6188" />
        

        <id>https://wg-eips.ritovision.com/3554/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3554"
            label="EIP-3554" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3554/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Delays the difficulty bomb to show effect the first week of December 2021.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 9,700,000 blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Targeting for the Shanghai upgrade and&#x2F;or the Merge to occur before December 2021. Either the bomb can be readjusted at that time, or removed all together.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fake_block_number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9_700_000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The following script predicts a .1 second delay to blocktime the first week of december and a 1 second delay by the end of the month. This gives reason to address because the effect will be seen, but not so much urgency we don&#x27;t have space to work around if needed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;current_blknum&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; months&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Predicts the effect on block time (as a ratio) in a specified amount of months in the future.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    Vars used in last prediction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_blknum = 12382958&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    current_difficulty = 7393633000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    block adjustment = 9700000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-string&quot;&gt;    months = 6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;    &amp;#39;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;86400&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13.3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; blocks_per_month&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; months&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; **&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;future_blknum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block_adjustment&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 100000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; diff_adjustment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; current_difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2048&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;diff_adjust_coeff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; predict_diff_bomb_effect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12382958&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7393633000000000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9700000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;6&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Misjudging the effects of the difficulty can mean longer blocktimes than anticipated until a hardfork is released. Wild shifts in difficulty can affect this number severely. Also, gradual changes in blocktimes due to longer-term adjustments in difficulty can affect the timing of difficulty bomb epochs. This affects the usability of the network but unlikely to have security ramifications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduction in refunds</title>
        <published>2021-04-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3529/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3529-reduction-in-refunds-alternative-to-eip-3298-and-3403-that-better-preserves-existing-clearing-incentives/6097" />
        

        <id>https://wg-eips.ritovision.com/3529/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3529"
            label="EIP-3529" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3529/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Remove gas refunds for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, and reduce gas refunds for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; to a lower level where the refunds are still substantial, but they are no longer high enough for current &quot;exploits&quot; of the refund mechanism to be viable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas refunds for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; were originally introduced to motivate application developers to write applications that practice &quot;good state hygiene&quot;, clearing storage slots and contracts that are no longer needed. However, the benefits of this technique have proven to be far lower than anticipated, and gas refunds have had multiple unexpected harmful consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Refunds give rise to GasToken. GasToken has benefits in moving gas space from low-fee periods to high-fee periods, but it also has downsides to the network, particularly in exacerbating state size (as state slots are effectively used as a &quot;battery&quot; to save up gas) and inefficiently clogging blockchain gas usage&lt;&#x2F;li&gt;
&lt;li&gt;Refunds increase block size variance. The theoretical maximum amount of actual gas consumed in a block is nearly twice the on-paper gas limit (as refunds add gas space for subsequent transactions in a block, though refunds are capped at 50% of a transaction&#x27;s gas used). This is not fatal, but is still undesirable, especially given that refunds can be used to maintain 2x usage spikes for far longer than EIP-1559 can.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAX_REFUND_QUOTIENT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refund.&lt;&#x2F;li&gt;
&lt;li&gt;Replace &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;) with &lt;code&gt;SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt; (4,800 gas as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; + &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the max gas refunded after a transaction to &lt;code&gt;gas_used &#x2F;&#x2F; MAX_REFUND_QUOTIENT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Remark: Previously &lt;em&gt;max gas refunded&lt;&#x2F;em&gt; was defined as &lt;code&gt;gas_used &#x2F;&#x2F; 2&lt;&#x2F;code&gt;. Here we
name the constant &lt;code&gt;2&lt;&#x2F;code&gt; as &lt;code&gt;MAX_REFUND_QUOTIENT&lt;&#x2F;code&gt; and change its value to &lt;code&gt;5&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;#specification&quot;&gt;EIP-2200&lt;&#x2F;a&gt;, three cases for refunds were introduced:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the original value is nonzero, and the new value is zero, add &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; (currently 15,000) gas to the refund counter&lt;&#x2F;li&gt;
&lt;li&gt;If the original value is zero, the current value is nonzero, and the new value is zero, add &lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (currently 19,900) gas to the refund counter&lt;&#x2F;li&gt;
&lt;li&gt;If the original value is nonzero, the current value is a different nonzero value, and the new value equals the original value, add &lt;code&gt;SSTORE_RESET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (currently 4,900) gas to the refund counter&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Of these three, only (1) enables gastokens and allows a block to expend more gas on execution than the block gas limit. (2) does not have this property, because for the 19,900 refund to be obtained, &lt;em&gt;the same storage slot&lt;&#x2F;em&gt; must have been changed from zero to nonzero previously, costing 20,000 gas. The inability to obtain gas from clearing one storage slot and use it to edit another storage slot means that it cannot be used for gas tokens. Additionally, obtaining the refund requires &lt;em&gt;reverting&lt;&#x2F;em&gt; the effect of the storage write and expansion, so the refunded gas does not contribute to a client&#x27;s load in processing a block. (3) behaves similarly: the 4,900 refund can only be obtained when 5,000 gas had previously been spent on the same storage slot.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP deals with case (1). We can establish under what conditions a gastoken is nonviable (ie. you cannot get more gas out of a storage slot than you put in) by using a similar &quot;pairing&quot; argument, mapping each refund to a previous expenditure in the same transaction on the same storage slot. lf a storage slot is changed to zero when its original value is nonzero, there are two possibilities:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;This could be the first time that the storage slot is set to zero. In this case, we can pair this event with the &lt;code&gt;SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt; minimum cost of reading and editing the storage slot for the first time.&lt;&#x2F;li&gt;
&lt;li&gt;This could be the second or later time that the storage slot is set to zero. In this case, we can pair this event with the most recent previous time that the value was set &lt;em&gt;away&lt;&#x2F;em&gt; from zero, in which &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas is &lt;em&gt;removed&lt;&#x2F;em&gt; from the refund.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;For the second and later event, it does not matter what value &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; has, because every refund of that size is paired with a refund &lt;em&gt;removal&lt;&#x2F;em&gt; of the same size. This leaves the first event. For the total gas expended on the slot to be guaranteed to be positive, we need &lt;code&gt;SSTORE_CLEARS_SCHEDULE &amp;lt;= SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;. And so this EIP simply decreases &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; to the sum of those two costs.&lt;&#x2F;p&gt;
&lt;p&gt;One alternative intuition for this EIP is that there will not be a net refund for clearing data that has not yet been read (which is often &quot;useless&quot; data), but there will continue to be a net refund for clearing data that has been read (which is likely to be &quot;useful&quot; data).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are currently only applied &lt;em&gt;after&lt;&#x2F;em&gt; transaction execution, so they cannot affect how much gas is available to any particular call frame during execution. Hence, removing them will not break the ability of any code to execute, though it will render some applications economically nonviable.&lt;&#x2F;p&gt;
&lt;p&gt;Gas tokens will become valueless. DeFi arbitrage bots, which today frequently use either established gas token schemes or a custom alternative to reduce on-chain costs, would benefit from rewriting their code to remove calls to these no-longer-functional gas storage mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;However, fully preserving refunds in the &lt;code&gt;new = original = 0 != current&lt;&#x2F;code&gt; case, and keeping &lt;em&gt;some&lt;&#x2F;em&gt; refund in the other &lt;code&gt;nonzero -&amp;gt; zero&lt;&#x2F;code&gt; cases, ensures that a few key use cases that receive (and deserve) favorable gas cost treatment continue to do so. For example, &lt;code&gt;zero -&amp;gt; nonzero -&amp;gt; zero&lt;&#x2F;code&gt; storage set patterns continue to cost only ~100 gas. Two important examples of such patterns include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Anti-reentrancy locks (typically flipped from 0 to 1 right before a child call begins, and then flipped back to 0 when the child call ends)&lt;&#x2F;li&gt;
&lt;li&gt;ERC20 approve-and-send (the &quot;approved value&quot; goes from zero to nonzero when the token transfer is approved, and then back to zero when the token transfer processes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;effect-on-storage-clearing-incentives&quot;&gt;Effect on storage clearing incentives&lt;&#x2F;h3&gt;
&lt;p&gt;A criticism of earlier refund removal EIPs (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3298&#x2F;&quot;&gt;EIP-3298&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3403&#x2F;&quot;&gt;EIP-3403&lt;&#x2F;a&gt;) is that these EIPs fully remove the incentive to set a value to zero, encouraging users to not fully clear a storage slot if they expect even the smallest probability that they will want to use that storage slot again.&lt;&#x2F;p&gt;
&lt;p&gt;For example, if you have 1 unit of an ERC20 token and you are giving away or selling your entire balance, you could instead only give away 0.999999 units and leave the remainder behind. If you ever decide to re-acquire more of that token with the same account in the future, you would only have to pay 5000 gas (2100 for the read + 2900 for nonzero-to-nonzero set) for the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; instead of 22100 (20000 for the zero-to-nonzero set). Today, this is counterbalanced by the 15000 refund for clearing, so you only have an incentive to do this if you are more than &lt;code&gt;15000 &#x2F; 17100 = 87.7%&lt;&#x2F;code&gt; sure that you will use the slot again; with EIP-3298 or EIP-3403 the counterbalancing incentive would not exist, so setting to nonzero is better if your chance of using the slot again is &lt;em&gt;any&lt;&#x2F;em&gt; value greater than 0%.&lt;&#x2F;p&gt;
&lt;p&gt;A refund of 4800 gas remains, so there is only be an incentive to keep a storage slot nonzero if you expect a probability of more than &lt;code&gt;4800 &#x2F; 17100 = 28.1%&lt;&#x2F;code&gt; that you will use that slot again. This is not perfect, but it is likely higher than the average person&#x27;s expectations of later re-acquiring a token with the same address if they clear their entire balance of it.&lt;&#x2F;p&gt;
&lt;p&gt;The capping of refunds to 1&#x2F;5 of gas expended means that this refund can only be used to increase the amount of storage write operations needed to process a block by at most 25%, limiting the ability to use this mechanic for storage-write-focused denial-of-service attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;eip-2929-gas-costs&quot;&gt;EIP-2929 Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Note, there is a difference between &#x27;hot&#x27; and &#x27;cold&#x27; slots. This table shows the values as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; assuming that all touched storage slots were already &#x27;hot&#x27; (the difference being a one-time cost of &lt;code&gt;2100&lt;&#x2F;code&gt; gas).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;17800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-11882&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;with-reduced-refunds&quot;&gt;With reduced refunds&lt;&#x2F;h3&gt;
&lt;p&gt;If refunds were to be partially removed, by changing &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; from 15000 to 4800 (and removing selfdestruct refund) this would be the comparative table.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-1788&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-1788&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-1788&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;7600&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-1682&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are not visible to transaction execution, so this should not have any impact on transaction execution logic.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum amount of gas that can be spent on execution in a block is limited to the gas limit, if we do not count zero-to-nonzero &lt;code&gt;SSTORE&lt;&#x2F;code&gt;s that were later reset back to zero. It is okay to not count those, because if such an &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is reset, storage is not expanded and the client does not need to actually adjust the Merke tree; the gas consumption is refunded, but the effort normally required by the client to process those opcodes is also cancelled. &lt;strong&gt;Clients should make sure to not do a storage write if &lt;code&gt;new_value = original_value&lt;&#x2F;code&gt;; this was a prudent optimization since the beginning of Ethereum but it becomes more important now.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restricted Chain Context Type Transactions</title>
        <published>2021-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Isaac Ardis</name><uri>https://github.com/whilei</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3534/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3534-restricted-chain-context-transaction-type/6112" />
        

        <id>https://wg-eips.ritovision.com/3534/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3534"
            label="EIP-3534" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3534/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines a new transaction type with constraints on ancestor block hash, block author, and&#x2F;or block timestamp.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new EIP-2718 transaction type with the format &lt;code&gt;0x4 || rlp([chainId, chainContext, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This proposed &lt;code&gt;chainContext&lt;&#x2F;code&gt; element adds a constraint on the validity of a transaction to a chain segment meeting the referenced value(s). Four contexts are defined as subclasses of this type:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;segmentId&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These contexts can be used in arbitrary combinations. Annotated context value combinations are referenced by a composite integer prefix on the annotation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Establish a protocol-based mechanism with which transactions are able to articulate constraints on eligible chain contexts.
Generally, these constraints give the consumer (the transactor) an ability to express requirements about the transaction&#x27;s relationship to blockchain data and its provenance.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Restrict transaction applicability to a chain context that is currently available and reasoned about under some subjective view.
&lt;ul&gt;
&lt;li&gt;Introduces a way for transactions to describe a dependency on their current view of a chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Restrict transaction applicability to a chain context following some foregoing block (and its transactions).
&lt;ul&gt;
&lt;li&gt;Introduces a way for transactions to describe ancestral dependencies at a &quot;macro&quot; (block) level.
Indirectly, this offers a way for a transaction to depend on the presence of another, so long as the dependent transaction is in a different block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Restrict transaction applicability to blocks benefitting, or &lt;em&gt;not&lt;&#x2F;em&gt; benefitting, a preferred&#x2F;spurned miner address or addresses.
&lt;ul&gt;
&lt;li&gt;Introduces an opportunity&#x2F;market for miners to compete for consumers&#x27; transactions; under the status quo, the current miner-transaction processing service is almost perfectly homogeneous from the consumer perspective.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Restrict transaction applicability time span.
&lt;ul&gt;
&lt;li&gt;Introduces an alternative (to the status quo) way for consumers&#x2F;transactors to have transactions invalidated&#x2F;ejected from the transaction pool.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; &lt;code&gt;TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSACTION_TYPE_NUMBER&lt;&#x2F;code&gt; &lt;code&gt;0x4&lt;&#x2F;code&gt;.  See EIP-2718.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new EIP-2718 transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;TRANSACTION_TYPE_NUMBER&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP-2718 &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chainId, chainContext, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The EIP-2718 &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt;. The transaction is only valid for blockchain data satisfying ALL OF the annotations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_COMPOSITE_PREFIX&lt;&#x2F;code&gt;. A positive integer between &lt;code&gt;1&lt;&#x2F;code&gt; and &lt;code&gt;0xff&lt;&#x2F;code&gt; that represents the set of subclass annotations in the &lt;code&gt;chainContext&lt;&#x2F;code&gt; (&lt;em&gt;ie.&lt;&#x2F;em&gt; &lt;em&gt;which&lt;&#x2F;em&gt; chain context subclasses should the provided values be applied to). This value should be the sum of the subclass&#x27; &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;s are defined for Subclasses as octal-derived positive integers, limited to the set &lt;code&gt;2^0,2^1,2^2,2^3,2^4,2^5,2^6,2^7&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;chainContext&lt;&#x2F;code&gt; value should be of the form &lt;code&gt;ANNOTATION_COMPOSITE_PREFIX || [{subclass value}...]&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;...&lt;&#x2F;code&gt; means &quot;zero or more of the things to the left,&quot; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; denotes the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;chainContext&lt;&#x2F;code&gt; value should be encoded as &lt;code&gt;ANNOTATION_COMPOSITE_PREFIX || rlp[{subclass value}...]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;The values defined as subclasses below acts as constraints on transaction validity for specific chain contexts.
Transactions defining constraints which are not satisfied by their chain context should be rejected as invalid.
Blocks containing invalid transactions should be rejected as invalid themselves, per the &lt;em&gt;status quo&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subclass-combination&quot;&gt;Subclass Combination&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt; values annotating more than one subclass reference should provide those values in the following sequential order:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXPIRY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;As above, the &lt;code&gt;ANNOTATION_COMPOSITE_PREFIX&lt;&#x2F;code&gt; should be the sum of the designated subclass&#x27; &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subclasses&quot;&gt;Subclasses&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; value is used to represent each of the available context subclasses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;ancestorid&quot;&gt;&lt;code&gt;ancestorId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt; &lt;code&gt;bytes&lt;&#x2F;code&gt;. A byte array between 4 and 12 bytes in length.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt; is a reference to a specific block by concatenating the byte representation of a block number and the first 4 bytes of its hash.
The block number&#x27;s should be encoded as a big endian value and should have left-padding 0&#x27;s removed.
The block number value may be omitted in case of reference to the genesis block.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ANCESTOR_ID&lt;&#x2F;code&gt; value should be RLP encoded as a byte array for hashing and transmission.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eligibleminerlist&quot;&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; &lt;code&gt;[address...]&lt;&#x2F;code&gt;. A list of addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; &lt;code&gt;3&lt;&#x2F;code&gt;. The maximum number of addresses that can be provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value is an array of unique, valid addresses.
Any block containing a transaction using this value must have a block beneficiary included in this set.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be of the type &lt;code&gt;[{20 bytes}+]&lt;&#x2F;code&gt;, where &lt;code&gt;+&lt;&#x2F;code&gt; means &quot;one or more of the thing to the left.&quot;
Non-unique values are not permitted.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be RLP encoded for hashing and transmission.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value may NOT be provided adjacent to an &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ineligibleminerlist&quot;&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;4&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; &lt;code&gt;[address...]&lt;&#x2F;code&gt;. A list of addresses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; &lt;code&gt;3&lt;&#x2F;code&gt;. The maximum number of addresses that can be provided.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value is an array of unique, valid addresses.
Any block containing a transaction using this value must not have a block beneficiary included in this set.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be of the type &lt;code&gt;[{20 bytes}+]&lt;&#x2F;code&gt;, where &lt;code&gt;+&lt;&#x2F;code&gt; means &quot;one or more of the thing to the left.&quot;
Non-unique values are not permitted.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value should be RLP encoded for hashing and transmission.&lt;&#x2F;p&gt;
&lt;p&gt;An &lt;code&gt;INELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value may NOT be provided adjacent to an &lt;code&gt;ELIGIBLE_MINER_LIST&lt;&#x2F;code&gt; value.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;expiry&quot;&gt;&lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;8&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXPIRY&lt;&#x2F;code&gt; &lt;code&gt;integer&lt;&#x2F;code&gt;. A positive, unsigned scalar.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;EXPIRY&lt;&#x2F;code&gt; value is a scalar equal to the maximum valid block &lt;code&gt;timestamp&lt;&#x2F;code&gt; for a block including this transaction.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXPIRY&lt;&#x2F;code&gt; value should be RLP encoded as an integer for hashing and transmission.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;subclasses-1&quot;&gt;Subclasses&lt;&#x2F;h3&gt;
&lt;p&gt;Subclasses are defined with a high level of conceptual independence, and can be modified and&#x2F;or extended independently from this EIP.
Their specification definitions allow arbitrary mutual (&lt;code&gt;AND&lt;&#x2F;code&gt;) combinations.&lt;&#x2F;p&gt;
&lt;p&gt;This design is intended to form a proposal which offers a concrete set of specifics while doing so with enough flexibility for extension or modification later.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;annotation-prefix&quot;&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; values&#x27; use of octal-derived values, ie. &lt;code&gt;1, 2, 4, 8, 16, 32, 64, 128&lt;&#x2F;code&gt;, follows a conventional pattern of representing combinations from a limited set uniquely and succinctly, eg. Unix-style file permissions.
This EIP defines four of the eight possible context subclasses; this seems to leave plenty of room for future growth in this direction if required.
If this limit is met or exceeded, doing so will require a hard fork &lt;em&gt;de facto&lt;&#x2F;em&gt; (by virtue of making consensus protocol facing changes to transaction validation schemes), so revising this scheme as needed should be only incidental and trivial.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ancestorid-1&quot;&gt;&lt;code&gt;ancestorId&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Constrains the validity of a transaction by referencing a prior canonical block by number and hash.
The transaction is only valid when included in a block which has the annotated block as an ancestor.&lt;&#x2F;p&gt;
&lt;p&gt;Practically, the &quot;designated allowable chain segment&quot; can be understood as the segment of blocks from &lt;code&gt;0..ancestorId&lt;&#x2F;code&gt; inclusive.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;redundancy-to-chainid&quot;&gt;Redundancy to &lt;code&gt;chainId&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;This pattern can be understood as a correlate of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;chainId&lt;&#x2F;code&gt; specification.
EIP155 defines the restriction of transactions between chains; limiting the applicability of any EIP-155 transaction to a chain with the annotated ChainID.
&lt;code&gt;ancestorId&lt;&#x2F;code&gt; further restricts transaction application to one subsection (&quot;segment&quot;) of one chain.&lt;&#x2F;p&gt;
&lt;p&gt;From this constraint hierarchy, we note that an implementation of &lt;code&gt;ancestorId&lt;&#x2F;code&gt; can make &lt;code&gt;chainId&lt;&#x2F;code&gt; conceptually redundant.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;so-why-keep-chainid&quot;&gt;So why keep &lt;code&gt;chainId&lt;&#x2F;code&gt;?&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; is maintained as an invariant because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The use of the transaction type proposed by this EIP is optional, implying the continued necessity of &lt;code&gt;chainId&lt;&#x2F;code&gt; in the protocol infrastructure and tooling for legacy and other transaction types.&lt;&#x2F;li&gt;
&lt;li&gt;The presence of &lt;code&gt;ancestorId&lt;&#x2F;code&gt; in the transaction type proposed by this EIP is optional. If the value is not filled by an RCC transaction, the demand for &lt;code&gt;chainId&lt;&#x2F;code&gt; remains.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;chainId&lt;&#x2F;code&gt; value is not necessarily redundant to &lt;code&gt;ancestorId&lt;&#x2F;code&gt;, namely in cases where forks result in living chains. For example, an &lt;code&gt;ancestorId&lt;&#x2F;code&gt; reference to block &lt;code&gt;1_919_999&lt;&#x2F;code&gt; would be ambiguous between Ethereum and Ethereum Classic.&lt;&#x2F;li&gt;
&lt;li&gt;It would be possible to specify the omission of &lt;code&gt;chainId&lt;&#x2F;code&gt; in case of &lt;code&gt;ancestorId&lt;&#x2F;code&gt;&#x27;s use. This would add infrastructural complexity for the sake of removing the few bytes &lt;code&gt;chainId&lt;&#x2F;code&gt; typically requires; we do not consider this trade-off worth making.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; is used as the &lt;code&gt;v&lt;&#x2F;code&gt; value (of &lt;code&gt;v,r,s&lt;&#x2F;code&gt;) in the transaction signing scheme; removing or modifying this incurs complexity at a level below encoded transaction fields, demanding additional infrastructural complexity for implementation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The proposed design for &lt;code&gt;ancestorId&lt;&#x2F;code&gt; does not provide perfect precision (at the benefit of byte-size savings).
In the small chance that the value is ambiguous, the &lt;code&gt;chainId&lt;&#x2F;code&gt; maintains an infallible guarantee for a transaction&#x27;s chain specificity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;eligibleminerlist-1&quot;&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The transaction is only valid when included in a block having an &lt;code&gt;etherbase&lt;&#x2F;code&gt; contained in the annotated list of addresses.
The use of &quot;whitelist&quot; (&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;) in conjunction with a &quot;blacklist&quot; (&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;) is logically inconsistent; their conjunction is not allowed.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; limit of &lt;code&gt;3&lt;&#x2F;code&gt; is chosen to balance the interests of limiting the potential size of transactions, and to provide a sufficient level of articulation for the user. At the time of writing, the top 3 miners of Ethereum (by block, measured by known public addresses) account for 52% of all blocks produced.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ineligibleminerlist-1&quot;&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The transaction is only valid when included in a block having an &lt;code&gt;etherbase&lt;&#x2F;code&gt; &lt;em&gt;not&lt;&#x2F;em&gt; contained in the annotated list of addresses.
The use of &quot;blacklist&quot; (&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;) in conjunction with a &quot;whitelist&quot; (&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;) is logically inconsistent; their conjunction is not allowed.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;MAX_ELEMENTS&lt;&#x2F;code&gt; limit of &lt;code&gt;3&lt;&#x2F;code&gt; is chosen to balance the interests of limiting the potential size of transactions, and to provide a sufficient level of articulation for the user. At the time of writing, the top 3 miners of Ethereum (by block, measured by known public addresses) account for 52% of all blocks produced.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;expiry-1&quot;&gt;&lt;code&gt;expiry&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The transaction is only valid when included in a block having a &lt;code&gt;timestamp&lt;&#x2F;code&gt; less than the value annotated.
A positive integer is used because that corresponds to the specified type of block &lt;code&gt;timestamp&lt;&#x2F;code&gt; header values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subclass-combination-1&quot;&gt;Subclass Combination&lt;&#x2F;h3&gt;
&lt;p&gt;Since subclasses use octal-based values for &lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt;, they can be distinguishably combined as sums, provided as we assume annotation cardinality (ie ordering).
For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt; signals &lt;code&gt;ancestorId&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;2&lt;&#x2F;code&gt; signals &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;4&lt;&#x2F;code&gt; signals &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;8&lt;&#x2F;code&gt; signals &lt;code&gt;expiry&lt;&#x2F;code&gt; exclusively.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+2=3&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+4=5&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+8=9&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+2+8=11&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+4+8=13&lt;&#x2F;code&gt; combines &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;2+4=6&lt;&#x2F;code&gt; is NOT PERMITTED. It would combine &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ANNOTATION_PREFIX&lt;&#x2F;code&gt; &lt;code&gt;1+2+4+8=15&lt;&#x2F;code&gt; is NOT PERMITTED. It would combine &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; and &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt; (and &lt;code&gt;ancestorId&lt;&#x2F;code&gt; and &lt;code&gt;expiry&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since ordering is defined and demanded for multiple values, annotated references remain distinguishable. For example:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt; &lt;code&gt;3[e4e1c0e78b1ec3,[Df7D7e053933b5cC24372f878c90E62dADAD5d42]]&lt;&#x2F;code&gt; - Transaction can only be included in a block having a canonical ancestor block numbered &lt;code&gt;15_000_000&lt;&#x2F;code&gt; and with a hash prefixed with the bytes &lt;code&gt;e78b1ec3&lt;&#x2F;code&gt;, and if the containing block uses &lt;code&gt;Df7D7e053933b5cC24372f878c90E62dADAD5d42&lt;&#x2F;code&gt; as the beneficiary.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;chainContext&lt;&#x2F;code&gt; &lt;code&gt;10[[Df7D7e053933b5cC24372f878c90E62dADAD5d42],1619008030]&lt;&#x2F;code&gt; - Transaction can only be included in a block naming &lt;code&gt;Df7D7e053933b5cC24372f878c90E62dADAD5d42&lt;&#x2F;code&gt; as the &lt;code&gt;etherbase&lt;&#x2F;code&gt; beneficiary, and which has a timestamp greater than &lt;code&gt;1619008030&lt;&#x2F;code&gt; (Wed Apr 21 07:27:10 CDT 2021).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-2930-inheritance&quot;&gt;EIP-2930 Inheritance&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2930&quot;&gt;EIP-2930 Optional Access List Type Transaction&lt;&#x2F;a&gt; is used as an assumed &quot;base&quot; transaction type for this proposal.
However, this is NOT a conceptual dependency; the included &lt;code&gt;accessList&lt;&#x2F;code&gt; portion of this proposal (the only differential from post-EIP-155 legacy transaction fields) can readily be removed.
Standing on the shoulders of EIP-2930 is only intended to support and further the adoption of next-generation transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-target&quot;&gt;Signature target&lt;&#x2F;h3&gt;
&lt;p&gt;The signature signs over the transaction type as well as the transaction data.
This is done to ensure that the transaction cannot be “re-interpreted” as a transaction of a different type.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Segment ID&lt;&#x2F;th&gt;&lt;th&gt;Block Number&lt;&#x2F;th&gt;&lt;th&gt;Canonical Block Hash&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;e78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;01e78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;e4e1c0e78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;15_000_000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;e8d4a50fffe78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;999_999_999_999&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;7fffffffffffffffe78b1ec3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;9223372036854775807&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xe78b1ec31bcb535548ce4b6ef384deccad1e7dc599817b65ab5124eeaaee3e58&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Further test cases, TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-4-bytes-of-a-block-hash-is-safe-enough-for-the-ancestorid&quot;&gt;Why 4 bytes of a block hash is &quot;safe enough&quot; for the &lt;code&gt;ancestorId&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;&#x2F;strong&gt;: The chance of an ineffectual &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is about 1 in between ~4 billion and ~40 billion, with the greater chance for intentional duplication scenarios, eg. malicious reorgs.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;If a collision &lt;em&gt;does&lt;&#x2F;em&gt; happen&lt;&#x2F;strong&gt;, that means the transaction will be valid on both segments (as is the case under the status quo).&lt;&#x2F;p&gt;
&lt;p&gt;Four bytes, instead of the whole hash (32 bytes), was chosen only to reduce the amount of information required to cross the wire to implement this value.
Using the whole hash would result in a &quot;perfectly safe&quot; implementation, and every additional byte reduces the chance of collision exponentially.&lt;&#x2F;p&gt;
&lt;p&gt;The goal of the &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is to disambiguate one chain segment from another, and in doing so, enable a transaction to define with adequate precision which chain it needs to be on.
When a transaction&#x27;s &lt;code&gt;ancestorId&lt;&#x2F;code&gt; references a block, we want to be pretty sure that that reference won&#x27;t get confused with a different block than the one the author of the transaction had in mind.&lt;&#x2F;p&gt;
&lt;p&gt;We assume the trait of collision resistance is uniformly applicable to all possible subsets of the block hash value, so our preference of using the &lt;em&gt;first&lt;&#x2F;em&gt; 4 bytes is arbitrary and functionally equivalent to any other subset of equal length.&lt;&#x2F;p&gt;
&lt;p&gt;For the sake of legibility and accessibility, the following arguments will reference the hex representation of 4 bytes, which is 8 characters in length, eg. &lt;code&gt;e78b1ec3&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The chance of a colliding &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is &lt;code&gt;1&#x2F;(16^8=4_294_967_296)&lt;&#x2F;code&gt; times whatever we take the chance of the existence of an equivalently-numbered block (on an alternative chain) to be. Assuming a generous ballpark chance of 10% (&lt;code&gt;1&#x2F;10&lt;&#x2F;code&gt;) for any given block having a public uncle, this yields &lt;code&gt;(1&#x2F;(16^8=4_294_967_296) * 1&#x2F;10&lt;&#x2F;code&gt;. Note that this ballpark assumes &quot;normal&quot; chain and network behavior. In the case of an enduring competing chain segment, this value rises to 100% (&lt;code&gt;1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eligibleminerlist-2&quot;&gt;&lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Miners who do not find themselves listed in an annotated &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; should be expected to immediately remove the transaction from their transaction pool.&lt;&#x2F;p&gt;
&lt;p&gt;In a pessimistic outlook, we should also expect that these ineligible nodes would not offer rebroadcasts of these transactions, potentially impacting the distribution (and availability) of the transactions to their intended miners. On the other hand, miners are incentivized to make themselves available for reception of such transactions, and there are many ways this is feasible both on-network and off-.&lt;&#x2F;p&gt;
&lt;p&gt;The author of a transaction using the &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; must assume that the &quot;general availability&quot; of the blockchain state database for such a transaction will be lower than a nonrestrictive transaction (since only a subset of miners will be able to process the transaction).&lt;&#x2F;p&gt;
&lt;p&gt;A final consideration is the economics of a whitelisted miner concerning the processing order of transactions in which they are whitelisted and those without whitelists.
Transactions without whitelists would appear at first glean to be more competitive, and thus should be processed with priority.
However, miners following such a strategy may find their reputation diminished, and, in the worst case, see the assertive preferences of transaction authors shift to their competitors and beyond their reach.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ineligibleminerlist-2&quot;&gt;&lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In addition to the concerns and arguments presented by &lt;code&gt;eligibleMinerList&lt;&#x2F;code&gt; above, there is a unique concern for &lt;code&gt;ineligibleMinerList&lt;&#x2F;code&gt;: in order for a miner entity to avoid ineligibility by a blacklist, they only need to use an alternative adhoc address as the block beneficiary.
In principle, this is ineluctable.&lt;&#x2F;p&gt;
&lt;p&gt;However, there are associated costs to the &quot;dodging&quot; miner that should be considered.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The creation of an account requires time and energy. But indeed, this work can be done at any convenient time and circumstance. Probably marginal, but non-zero.&lt;&#x2F;li&gt;
&lt;li&gt;The transfer of funds from multiple accounts requires a commensurate number of transactions. Block rewards are applied after transactions are processed, so the miner is unable to simultaneously shift funds from an adhoc account to a target account in the same block they mine (which would otherwise be a &quot;free&quot; transaction).&lt;&#x2F;li&gt;
&lt;li&gt;In using an adhoc address to dodge a blacklist, the miner may also cause their ineligibility from contemporary whitelist transactions.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validation-costs&quot;&gt;Validation costs&lt;&#x2F;h3&gt;
&lt;p&gt;Miner lists and expiry depend on easily cached and contextually available conditions (ie. the containing block header). The infrastructural overhead costs for enforcing these validations are expected to be nominal.&lt;&#x2F;p&gt;
&lt;p&gt;Validation of &lt;code&gt;ancestorId&lt;&#x2F;code&gt; demands the assertion of a positive database hit by block number (thereby cross-referencing a stored block&#x27;s hash).
This necessary lookup can be (and maybe already is) cached, but we must expect less than 100% hits on cached values, since the lookup value is arbitrary.
With that in mind, however, the value provided to a transaction using a deep &lt;code&gt;ancestorId&lt;&#x2F;code&gt; is increasingly marginal, so we should expect
most transactions using this field to use a relatively small set of common, shallow, cache-friendly values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-size-increase&quot;&gt;Transaction size increase&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed additional fields potentially increase transaction size.
The proposed fields are not associated with any gas costs, establishing no protocol-defined economic mitigation for potential spam.
However, transactions which are considered by a miner to be undesirable can be simply dropped from the transaction pool and ignored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waved via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Data Opcodes</title>
        <published>2021-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Papageorgiou</name><uri>https://github.com/alex-ppg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3508/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-draft-transaction-data-opcodes/6017" />
        

        <id>https://wg-eips.ritovision.com/3508/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3508"
            label="EIP-3508" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3508/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Provide access to original transaction data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces the following three EVM instructions: &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt;, &lt;code&gt;ORIGINDATASIZE&lt;&#x2F;code&gt;, and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;These three instructions are meant to provide access to the original transaction&#x27;s &lt;code&gt;data&lt;&#x2F;code&gt; payload, enabling a gas-efficient way of accessing large data payloads in cross-contract calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the Ethereum development scene matures, more ambitious and complex features are introduced into smart contracts more often than not requiring the utilization of complex and at times large data structures. Given the inherent limits of the EVM, however, transporting large data structures in between contracts is a costly task that can at times lead to even futile scenarios whereby the gas consumption of such an operation is impossible to execute within the gas limit bounds as well as without sacrificing a large chunk of ETH to facilitate its gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this EIP is to render these features viable by introducing a way via which multi-contract systems are able to access the same in-memory data source without necessarily transmitting the full payload between them.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP enables elaborate smart contract features to become part of a larger call-chain by efficiently reading data from the original transaction payload rather than requiring the data to be passed in as call-level data. Its inclusion will mainly benefit advanced trustless schemes to manifest, such as efficient verification of Merkle Patricia trees validating the storage value of a particular Ethereum block or EVM-based layer 2 solutions.&lt;&#x2F;p&gt;
&lt;p&gt;A side-effect of this change is that smart contract systems relying entirely on origin data inherently guarantee that the data they receive has not been malformed by an intermediate smart contract call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;origindataload-0x47-origindatasize-0x48-and-origindatacopy-0x49&quot;&gt;ORIGINDATALOAD (&lt;code&gt;0x47&lt;&#x2F;code&gt;), ORIGINDATASIZE (&lt;code&gt;0x48&lt;&#x2F;code&gt;) and ORIGINDATACOPY (&lt;code&gt;0x49&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;These instructions are meant to operate similarly to their call-prefixed counterparts with the exception that they instead operate on the original &lt;code&gt;data&lt;&#x2F;code&gt; of a transaction instead of the current call&#x27;s data. In detail:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;ORIGINDATALOAD (&lt;code&gt;0x47&lt;&#x2F;code&gt;) performs similarly to CALLDATALOAD (&lt;code&gt;0x35&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;ORIGINDATASIZE (&lt;code&gt;0x48&lt;&#x2F;code&gt;) performs similarly to CALLDATASIZE (&lt;code&gt;0x36&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;ORIGINDATACOPY (&lt;code&gt;0x49&lt;&#x2F;code&gt;) performs similarly to CALLDATACOPY (&lt;code&gt;0x37&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As the data is retrieved once again from the execution environment, the costs for the three instructions will be &lt;code&gt;G_verylow&lt;&#x2F;code&gt;, &lt;code&gt;G_base&lt;&#x2F;code&gt; and &lt;code&gt;G_base + G_verylow * (number of words copied, rounded up)&lt;&#x2F;code&gt; respectively.&lt;&#x2F;p&gt;
&lt;p&gt;The transaction data the &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; opcodes operate on will be equivalent to the &lt;code&gt;calldata&lt;&#x2F;code&gt; specified in the &lt;code&gt;args*&lt;&#x2F;code&gt; parameter to the nearest &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) up the stack.  If there is no &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; in the stack then &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; will operate on the transaction&#x27;s original &lt;code&gt;data&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;p&gt;This interaction ensures full compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; and ensures that no form of discrimination is introduced back into the system by this EIP e.g. by contracts entirely relying on &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; and thus allowing only EOAs to supply data to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;authcall-0xf7-interaction&quot;&gt;AUTHCALL (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) Interaction&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; that will be part of the London fork has introduced a new call instruction called &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) that will replace a transaction&#x27;s &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;) with the context variable &lt;code&gt;authorized&lt;&#x2F;code&gt;. The intention of &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; is to prevent discrimination between smart contracts and EOAs which &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; initially facilitated and as a result, it is sensible also replace the values retrieved by the &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; opcodes to the ones used in the &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-conventions&quot;&gt;Naming Conventions&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ORIGIN&lt;&#x2F;code&gt;-prefixed instructions attempted to conform to the existing naming convention of &lt;code&gt;CALL&lt;&#x2F;code&gt;-prefixed instructions given the existence of the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;) instruction which is equivalent to the &lt;code&gt;CALLER&lt;&#x2F;code&gt; (&lt;code&gt;0x33&lt;&#x2F;code&gt;) instruction but on the original transaction&#x27;s context.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instruction-address-space&quot;&gt;Instruction Address Space&lt;&#x2F;h3&gt;
&lt;p&gt;The instruction address space of the &lt;code&gt;0x30-0x3f&lt;&#x2F;code&gt; has been exhausted by calls that already provide information about the execution context of a call so a new range had to be identified that is suitable for the purposes of the EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Given that the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; &lt;code&gt;CHAINID&lt;&#x2F;code&gt; opcode was included at &lt;code&gt;0x46&lt;&#x2F;code&gt;, it made sense to include additional transaction-related data beyond it since the Chain ID is also included in transaction payloads apart from the blocks themselves, rendering the &lt;code&gt;0x46-0x4f&lt;&#x2F;code&gt; address space reserved for more transaction-related data that may be necessary in the future, such as the EOA&#x27;s nonce.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The opcodes ORIGINDATALOAD (&lt;code&gt;0x47&lt;&#x2F;code&gt;), ORIGINDATASIZE (&lt;code&gt;0x48&lt;&#x2F;code&gt;), and ORIGINDATACOPY (&lt;code&gt;0x49&lt;&#x2F;code&gt;) essentially perform the same thing as opcodes CALLDATALOAD (&lt;code&gt;0x35&lt;&#x2F;code&gt;), CALLDATASIZE (&lt;code&gt;0x36&lt;&#x2F;code&gt;), and CALLDATACOPY (&lt;code&gt;0x37&lt;&#x2F;code&gt;) respectively and thus share the exact same gas costs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instruction-space-pollution&quot;&gt;Instruction Space Pollution&lt;&#x2F;h3&gt;
&lt;p&gt;One can argue that multiple new EVM instructions pollute the EVM instruction address space and could cause issues in assigning sensible instruction codes to future instructions. This particular issue was assessed and a methodology via which the raw RLP encoded transaction may be accessible to the EVM was ideated. This would &lt;em&gt;future-proof&lt;&#x2F;em&gt; the new instruction set as it would be usable for other members of the transaction that may be desired to be accessible on-chain in the future, however, it would also cause a redundancy in the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP does not alter or adjust existing functionality provided by the EVM and as such, no known issues exist.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;introspective-contracts&quot;&gt;Introspective Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Atomically, the &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt; values should be considered insecure as they can easily be spoofed by creating an entry smart contract with the appropriate function signature and arguments that consequently invokes other contracts within the call chain. In brief, one should always assume that &lt;code&gt;tx.data != calldata&lt;&#x2F;code&gt; and these instructions should not be used as an introspection tool alone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;denial-of-service-attack&quot;&gt;Denial-of-Service Attack&lt;&#x2F;h3&gt;
&lt;p&gt;An initial concern that may arise from this EIP is the additional contextual data that must be provided at the software level of nodes to the EVM in order for it to be able to access the necessary data via the &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt; instructions.&lt;&#x2F;p&gt;
&lt;p&gt;This would lead to an increase in memory consumption, however, this increase should be negligible if at all existent given that the data of a transaction should already exist in memory as part of its execution process; a step in the overall inclusion of a transaction within a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-contract-system-gas-reduction&quot;&gt;Multi-Contract System Gas Reduction&lt;&#x2F;h3&gt;
&lt;p&gt;Given that most complex smart contract systems deployed on Ethereum today rely on cross-contract interactions whereby values are passed from one contract to another via function calls, the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt;-prefixed instruction set would enable a way for smart contract systems to acquire access to the original transaction data at any given step in the call chain execution which could result in cross-contract calls ultimately consuming less gas if the data passed between them is reduced as a side-effect of this change.&lt;&#x2F;p&gt;
&lt;p&gt;The gas reduction, however, would be an implementation-based optimization that would also be solely applicable for rudimentary memory arguments rather than storage-based data, the latter of which is most commonly utilized in these types of calls. As a result, the overall gas reduction observed by this change will be negligible for most implementations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Destination Opcode</title>
        <published>2021-04-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Alex Papageorgiou</name><uri>https://github.com/alex-ppg</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3520/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3520-transaction-destination-opcode/6058" />
        

        <id>https://wg-eips.ritovision.com/3520/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3520"
            label="EIP-3520" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3520/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Provide access to the original recipient of a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces the following EVM instruction: &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This instruction is meant to provide access to the original recipient of the transaction, the &lt;code&gt;to&lt;&#x2F;code&gt; address, enabling new ways of introspection to be applied in conjunction with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3508&#x2F;&quot;&gt;EIP-3508&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;It is undeniable that smart contracts are becoming more interconnected than ever. Up until this point, smart contracts have entirely relied on compliant interfaces and introspection to introduce a new step in the call chain of a complex multi-contract interaction. However, this presents a forwards-only approach which limits the types of interactions that can manifest.&lt;&#x2F;p&gt;
&lt;p&gt;The purpose of this EIP is to provide a way via which a contract is able to identify the entry-point of a transaction on the blockchain and deduce what was the original intention of the transaction by applying introspection on the original transaction data itself.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP enables the development of new types of smart contracts as it can open new pathways for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;721&#x2F;&quot;&gt;EIP-721&lt;&#x2F;a&gt; NFTs and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20&lt;&#x2F;a&gt; tokens to detect which action their transaction is part of, such as detecting a liquidity provision to a decentralized exchange or a loan within a collateralized lending protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;entrypoint-0x4a&quot;&gt;ENTRYPOINT (&lt;code&gt;0x4a&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; instruction uses 0 stack arguments and pushes the original &lt;code&gt;to&lt;&#x2F;code&gt; member of the transaction onto the stack. The address yielded by the instruction is a 160-bit value padded to 256-bits. The operation costs &lt;code&gt;G_base&lt;&#x2F;code&gt; to execute, similarly to &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The address returned by the &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode will be equivalent to the &lt;code&gt;to&lt;&#x2F;code&gt; address parameter specified in the nearest &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; up the stack.  If there is no &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; in the stack then &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; will retrieve the original transaction&#x27;s &lt;code&gt;to&lt;&#x2F;code&gt; field.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;authcall-0xf7-interaction&quot;&gt;AUTHCALL (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) Interaction&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; introduced a new call instruction called &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) that will replace a transaction&#x27;s &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;) with the context variable &lt;code&gt;authorized&lt;&#x2F;code&gt;. The intention of &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; is to prevent discrimination between smart contracts and EOAs which &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; initially facilitated. The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode by itself re-introduces discrimination into the system as it indirectly allows one to evaluate whether the smart contract code being executed is done so by an EOA by validating that &lt;code&gt;ENTRYPOINT == ADDRESS&lt;&#x2F;code&gt; where &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0x30&lt;&#x2F;code&gt;) retrieves the currently executing account address. Therefore, it is sensible also replace the values retrieved by the &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode to the target of an &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This interaction ensures full compatibility with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; and ensures that no form of discrimination is introduced back into the system by this EIP.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-conventions&quot;&gt;Naming Conventions&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; instruction came to be by defining a sensible name that immediately and clearly depicts what it is meant to achieve by signaling the first interaction of a particular call, i.e. the entry-point.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instruction-address-space&quot;&gt;Instruction Address Space&lt;&#x2F;h3&gt;
&lt;p&gt;Equivalent to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3508&#x2F;&quot;&gt;EIP-3508&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h3&gt;
&lt;p&gt;The opcode ENTRYPOINT (&lt;code&gt;0x4a&lt;&#x2F;code&gt;) essentially performs the same thing as the opcode ORIGIN (&lt;code&gt;0x32&lt;&#x2F;code&gt;) and thus shares the exact same gas cost.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;dependency-on-eip-3508&quot;&gt;Dependency on EIP-3508&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; (&lt;code&gt;0x4a&lt;&#x2F;code&gt;) instruction alone has no perceivable benefit as it can be replaced by the &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;) instruction and as such should solely be introduced to the system in conjunction with the &lt;code&gt;ORIGINDATA*&lt;&#x2F;code&gt; opcodes defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3508&#x2F;&quot;&gt;EIP-3508&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The EIP does not alter or adjust existing functionality provided by the EVM and as such, no known issues exist.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;introspective-contracts&quot;&gt;Introspective Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; instruction allows the association of the &lt;code&gt;ORIGINDATALOAD&lt;&#x2F;code&gt; and &lt;code&gt;ORIGINDATACOPY&lt;&#x2F;code&gt; values with a particular smart contract address and interface, enabling introspection to be applied based on the function signature invoked and the arguments provided to reliably deduce the call-path via which a particular smart contract was invoked and allowing a more granular level of interaction to be defined in such special cases.&lt;&#x2F;p&gt;
&lt;p&gt;However, this type of introspection should solely be applied on pre-approved contracts rather than user-defined ones as the value stemming from this type of introspection entirely relies on a contract&#x27;s code immutability and proper function, both of which a user supplied contract can easily bypass.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;caller-discrimination&quot;&gt;Caller Discrimination&lt;&#x2F;h3&gt;
&lt;p&gt;The instructions of this EIP should not be utilized as a way to discriminate between EOA callers and smart contracts, as this type of differentiation can be broken by an &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; as defined in the specification chapter.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-creation-behaviour&quot;&gt;Contract Creation Behaviour&lt;&#x2F;h3&gt;
&lt;p&gt;The behaviour of the &lt;code&gt;ENTRYPOINT&lt;&#x2F;code&gt; opcode during a contract creation will result in the opcode yielding the zero-address as the first address interacted with in the transaction. This should be taken into account by contract implementations in a similar fashion to how &lt;code&gt;ecrecover&lt;&#x2F;code&gt; invalid signatures are handled to prevent software misbehaviours from arising.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce access list cost</title>
        <published>2021-04-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3521/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3521-reduce-access-list-cost/6072" />
        

        <id>https://wg-eips.ritovision.com/3521/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3521"
            label="EIP-3521" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3521/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the cost of declaring &lt;code&gt;tx.to&lt;&#x2F;code&gt; storage keys in access lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, a transaction must read at least 25 distinct storage slots in &lt;code&gt;tx.to&lt;&#x2F;code&gt;
before it&#x27;s more expensive to forego an access list.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ACCESS_LIST_ADDRESS_COST + (ACCESS_LIST_STORAGE_KEY_COST + WARM_STORAGE_READ_COST) * x = COLD_SLOAD_COST * x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x = 24&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;EIP-2930 requires the address under which the storage keys reside be declared
explicitly, since it must be added to the EIP-2929 &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; list.
However, &lt;code&gt;tx.to&lt;&#x2F;code&gt; is a special case that is added by default, so paying
&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; for &lt;code&gt;tx.to&lt;&#x2F;code&gt; is essentially paying twice for the same
address. Avoiding overpayment here will reduce the differential to just 5 unique
reads before using an access list is cheaper -- making them a more attractive
option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Treat the first occurrence of &lt;code&gt;tx.to&lt;&#x2F;code&gt; in an access list as &lt;code&gt;calldata&lt;&#x2F;code&gt; for gas
accounting purposes. Do not charge &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; for it. Storage
keys underneath the address are unaffected.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;tx.to == nil&lt;&#x2F;code&gt;, &lt;code&gt;tx.to&lt;&#x2F;code&gt; is defined be the derived contract address created by
the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-charge-at-all&quot;&gt;Why charge at all?&lt;&#x2F;h3&gt;
&lt;p&gt;EIP-2930 is specifically written to make access lists simple to reason about and
validate. It may be possible to modify the structure of the access list to avoid
including &lt;code&gt;tx.to&lt;&#x2F;code&gt; explicitly, but this would renege on the spirit of EIP-2930.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-charge-as-calldata&quot;&gt;Why charge as &lt;code&gt;calldata&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of &lt;code&gt;calldata&lt;&#x2F;code&gt; was  thoroughly analyzed in EIP-2028 to determine
a fair value that is not susceptible to denial-of-service attacks. We consider
this the lower bound on how much transaction data should cost. Since there is
no computation burden imposed for adding &lt;code&gt;tx.to&lt;&#x2F;code&gt; to the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;
map (it&#x27;s added by default by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;), there is no reason to charge more than
the absolute minimum for the data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 320&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0x00ffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 308&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 2720&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0x00&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 4620&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0x00&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &amp;quot;0xffffffffffffffffffffffffffffffffffffffff&amp;quot;: [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0x00&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;cost = 6520&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SUDO Opcode</title>
        <published>2021-04-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	<author>
		<name>Baptiste Vauthey</name><uri>https://github.com/thabaptiser</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3455/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3455-sudo-opcode/5860" />
        

        <id>https://wg-eips.ritovision.com/3455/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3455"
            label="EIP-3455" />
        

        
        

        
        <summary type="html">A new opcode is introduced to allow calling from an arbitrary sender address.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3455/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode, &lt;code&gt;SUDO&lt;&#x2F;code&gt;, is introduced with the same parameters as &lt;code&gt;CALL&lt;&#x2F;code&gt;, plus another parameter to specify the sender address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are many use cases for being able to set the sender.&lt;&#x2F;p&gt;
&lt;p&gt;Many tokens are stuck irretrievably because nobody has the key for the owner address.
In particular, at address zero there is approximately 17 billion USD in tokens and ether, according to etherscan.
With &lt;code&gt;SUDO&lt;&#x2F;code&gt;, anyone could free that value, leading to an economic boom that would end poverty and world hunger.
Instead it is sitting there idle like the gold in Fort Knox.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;It is a common mistake to send &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; tokens to the token address instead of the intended recipient.
This happens because users paste the token address into the recipient fields.
Currently there is no way to recover these tokens.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;Many scammers have fraudulently received tokens and ETH via trust-trading.
Their victims currently have no way to recover their funds.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;Large amounts of users have accidentally locked up tokens and ether by losing their private keys.
This is inefficient and provides a bad user experience.
To accommodate new and inexperienced users, there needs to be a way to recover funds after the private key has been lost.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, there are many tokens and ether sitting in smart contracts locked due to a bug.
We could finally close EIP issue #156.
We cannot currently reclaim ether from stuck accounts.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; fixes this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new opcode (&lt;code&gt;SUDO&lt;&#x2F;code&gt;) at &lt;code&gt;0xf8&lt;&#x2F;code&gt;.
&lt;code&gt;SUDO&lt;&#x2F;code&gt; pops 8 parameters from the stack.
Besides the sender parameter, the parameters shall match &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gas: Integer; Maximum gas allowance for message call, safely using current gas counter if the counter is lower&lt;&#x2F;li&gt;
&lt;li&gt;Sender: Address, truncated to lower 40 bytes; Sets &lt;code&gt;CALLER&lt;&#x2F;code&gt; inside the call frame&lt;&#x2F;li&gt;
&lt;li&gt;To: Address, truncated to lower 40 bytes; sets &lt;code&gt;ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Value: Integer, raises exception amount specified is less than the value in Sender account; transferred with call to recipient balance, sets &lt;code&gt;CALLVALUE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;InStart: Integer; beginning of memory to use for &lt;code&gt;CALLDATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;InSize: Integer; length of memory to use for &lt;code&gt;CALLDATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;OutStart: Integer; beginning of memory to replace with &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;OutSize: Integer; maximum &lt;code&gt;RETURNDATA&lt;&#x2F;code&gt; to place in memory&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Following execution, &lt;code&gt;SUDO&lt;&#x2F;code&gt; pushes a result value to the stack, indicating success or failure.
If the call ended with &lt;code&gt;STOP&lt;&#x2F;code&gt;, &lt;code&gt;RETURN&lt;&#x2F;code&gt;, or &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, &lt;code&gt;1&lt;&#x2F;code&gt; is pushed.
If the call ended with &lt;code&gt;REVERT&lt;&#x2F;code&gt;, &lt;code&gt;INVALID&lt;&#x2F;code&gt;, or an EVM assertion, &lt;code&gt;0&lt;&#x2F;code&gt; is pushed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;GAS&lt;&#x2F;code&gt; parameter is first so that callers can tediously compute how much of their remaining gas to send at the last possible moment.
The remaining parameters inherited from &lt;code&gt;CALL&lt;&#x2F;code&gt; are in the same order, with sender inserted between.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;It will be fine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Expanded Clique Block Choice Rule</title>
        <published>2021-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3436/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3436-expanded-clique-block-choice-rule/5809" />
        

        <id>https://wg-eips.ritovision.com/3436/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3436"
            label="EIP-3436" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3436/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add a four step block rule to Clique that should reduce block production deadlocks&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current specification of Clique allows for multiple competing blocks from producers but does not
provide any strategies to pick blocks aside from the current &quot;highest total difficulty&quot; rule. This
EIP proposes a four step choice rule of highest total difficulty, shortest chain, most recently
in-turn, and lowest hash. This would prevent deadlocks that have occurred in production systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There has been more than one deadlock in the Goerli multi-client Clique network. The number of
active validators was greater than 1&#x2F;2 of the available validators so a chain halt should not have
occurred. The halt was resolved by an inactive validator coming back on line. The state of the chain
was in one of two configurations of 8 validators that can result in a chain halt. Three of the four
clients observed a choice sequence of lowest total difficulty followed by first observed block. Geth
added one extra rule of preferring the shortest chain before preferring the first observed block.
This fork would have resolved itself with Geth&#x27;s rule, but there is still a configuration where the
chain can halt with a shortest chain rule.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;When a Clique validator is arbitrating the canonical status between two different chain head blocks,
they should choose the canonical block with the following ordered priorities.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Choose the block with the most total difficulty.&lt;&#x2F;li&gt;
&lt;li&gt;Then choose the block with the lowest block number.&lt;&#x2F;li&gt;
&lt;li&gt;Then choose the block whose validator had the least recent in-turn block assignment.&lt;&#x2F;li&gt;
&lt;li&gt;Then choose the block with the lowest hash.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;When resolving rule 3 clients should use the following formula, where &lt;code&gt;validator_index&lt;&#x2F;code&gt; is the integer
index of the validator that signed the block when sorted as per epoch checkpointing,
&lt;code&gt;header_number&lt;&#x2F;code&gt; is the number of the header, and &lt;code&gt;validator_count&lt;&#x2F;code&gt; is the count of the current
validators. Clients should choose the block with the &lt;strong&gt;largest&lt;&#x2F;strong&gt; value. Note that an in-turn block
is considered to be the most recent in-turn block.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(header_number - validator_index) % validator_count&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When resolving rule 4 the hash should be converted into an unsigned 256 bit integer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two scenarios of a halted chain are known based on the current total difficulty then first observed
rule. One of the scenarios is also resistant to the shortest chain rule.&lt;&#x2F;p&gt;
&lt;p&gt;For the first scenario where chains of different lengths can halt consider a block with 8
validators, whose addresses sort to the same order as their designation in this example. A fully
in-order chain exists and validator number 8 has just produced an in-turn block and then validators
5, 7 and 8 go offline, leaving validators 1 to 6 to produce blocks. Two forks form, one with an
in-order block from validator 1 and then an out of order block from validator 3. The second fork
forms from validators 2, 4, and 6 in order. Both have a net total difficulty of 3 more than the
common ancestor. So in this case if both forks become aware of the other fork then both are
considered equally viable and neither set of validators should switch to the newly observed fork. In
this case, adding a shortest chain rule would break the deadlock as the even numbered validators
would adopt the shorter chain.&lt;&#x2F;p&gt;
&lt;p&gt;For the second scenario with the same validator set and in-order chain with validator 7 having just
produced an in order block, then validators 7 and 8 go offline. Two forks form, 1,3,5 on one side
and 2,4,6 on the other. Both forks become aware of the other fork after producing their third block.
In this case both forks have equal total difficulty and equal length. So Geth&#x27;s rule would not break
the tie and only the arrival of one of the missing validators fix the chain. In a worst case
scenario the odd and even chains would produce a block for 7 and 8 respectively, and chain halt
would result with no validators that have not chosen a fork. Only a manual rollback would fix this.&lt;&#x2F;p&gt;
&lt;p&gt;One consideration when formulating the rules is that the block choice should be chosen so that it
would encourage the maximum amount of in-order blocks. Selecting a chain based on shortest chain
implicitly prefers the chain with more in-order blocks. When selecting between competing out of
order chains the validator who is closest to producing an in-order block in the future should have
their chain declined so that they are available to produce an in-order block sooner.&lt;&#x2F;p&gt;
&lt;p&gt;At least one client has been observed producing multiple blocks at the same height with the same
difficulty, so a final catch-all standard of lowest block hash should break any remaining ties.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The current block choice rules are a mix of most total difficulty and most total difficulty plus
shortest chain.&lt;&#x2F;p&gt;
&lt;p&gt;As long as the majority of the active validators implement the block choice rules then a client who
only implements the existing difficulty based rule will eventually align with the chain preferred by
these rules. If less than a majority implement these rules then deadlocks can still occur, and
depend on the first observation of problematic blocks, which is no worse than the current situation.&lt;&#x2F;p&gt;
&lt;p&gt;If clients only partially implement the rule as long as every higher ranked rule is also implemented
then the situation will be no worse than today.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Malicious and motivated attackers who are participating in the network can force the chain to halt
with well crafted block production. With a fully deterministic choice rule the opportunity to halt
is diminished. Attackers still have the same opportunities to flood the network with multiple blocks
at the same height. A deterministic rule based on the lowest hash reduces the impact of such a
flooding attack. A malicious validator could exploit this deterministic rule to produce a
replacement block. Such an attack exists in current implementations but a deterministic hash rule
makes such replacements more likely. However the impact of such an attack seems low to trivial at
this time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Median Gas Premium</title>
        <published>2021-03-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>HexZorro</name><uri>https://github.com/hexzorro</uri>
	</author>
	
	<author>
		<name>Mojtaba Tefagh</name><uri>https://github.com/mtefagh</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3416/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3416-median-gas-premium/5755" />
        

        <id>https://wg-eips.ritovision.com/3416/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3416"
            label="EIP-3416" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3416/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A transaction pricing mechanism with a fixed-per-block network fee and a median inclusion fee with additive updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There is a base fee per gas in protocol, which can move up or down by a maximum of 1&#x2F;8 in each block. The base fee per gas is adjusted by the protocol to target an average gas usage per block instead of an absolute gas usage per block.  The base fee is increased when blocks are over the gas limit target and decreases when blocks are under the gas limit target. Transaction senders specify their fees by providing &lt;em&gt;only one value&lt;&#x2F;em&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The fee cap which represents the maximum total (base fee + gas premium) that the transaction sender would be willing to pay to get their transaction included, resembles the current maximum gas price specified by senders but in this protocol change proposal the final gas price paid, most of the time, will be lower than the proposed by the transaction sender.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then there is a gas premium that is directly computed as 50% of (fee cap - base fee). This gas premium gets added onto the base fee to calculate the gas price that will be used in the weighted median computation. The gas premium, determined directly by a specified fee cap, can either be set to a fairly low value to compensate miners for uncle rate risk only with the base fee, or to a high value to compete during sudden bursts of activity. Using all transactions that the miner wants to include in the block, a &lt;strong&gt;weighted median gas premium&lt;&#x2F;strong&gt; is computed, not considering in the computation 5% of gas price outliers on the upper-side for extra robustness against miner manipulation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We target the following goals:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Gas prices spikes are mathematically smoothed out. EIP1559 does not seems to really tackle gas premium volatility and UX.&lt;&#x2F;li&gt;
&lt;li&gt;Maintain gas price preference, i.e. transaction senders willing to pay extra in fees will be rewarded with early preferential inclusion in the blocks, because the miners want to maximize their profits and include transactions with higher fee caps first to maximize the median.&lt;&#x2F;li&gt;
&lt;li&gt;Final gas price paid by the sender is, most of the time, smaller than the maximum gas price specified by sender.&lt;&#x2F;li&gt;
&lt;li&gt;Gas pricing is more robust to sender manipulation or miner manipulation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Ethereum currently prices transaction fees using a simple auction mechanism, where users send transactions with bids (&quot;gasprices&quot;) and miners choose transactions with the highest bids, and transactions that get included pay the bid that they specify. This leads to several large sources of inefficiency:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Current extreme volatility of gas prices is hurting user experience&lt;&#x2F;strong&gt;: if you observe  online gas price metrics, the current trends in recommended gas prices can change substantially by the minute, making the user experience in the network very awkward. Also, gas volatility makes the mining business more unpredictable and costly, because miners need to spend money hedging the risks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Mismatch between volatility of transaction fee levels and social cost of transactions&lt;&#x2F;strong&gt;: bids to include transactions on mature public blockchains, that have enough usage so that blocks are full, tend to be extremely volatile. On Ethereum, minimum bids range between 1 nanoeth (10^9 nanoeth = 1 ETH), but sometimes go over 100 nanoeth and have reached over 200 nanoeth. This clearly creates many inefficiencies, because it&#x27;s absurd to suggest that the cost incurred by the network from accepting one more transaction into a block actually is 200x more when gas prices are 200 nanoeth than when they are 1 nanoeth; in both cases, it&#x27;s a difference between 8 million gas and 8.02 million gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Needless delays for users&lt;&#x2F;strong&gt;: because of the hard per-block gas limit coupled with natural volatility in transaction volume, transactions often wait for several blocks before getting included, but this is socially unproductive; no one significantly gains from the fact that there is no &quot;slack&quot; mechanism that allows one block to be bigger and the next block to be smaller to meet block-by-block differences in demand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Inefficiencies of first price auctions&lt;&#x2F;strong&gt;: The current approach, where transaction senders publish a transaction with a bid a maximum fee, miners choose the highest-paying transactions, and everyone pays what they bid. This is well-known in mechanism design literature to be highly inefficient, and so complex fee estimation algorithms are required. But even these algorithms often end up not working very well, leading to frequent fee overpayment. We need a more stable fee metric that is computed inside the protocol.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The proposal in this EIP is to start with a base fee amount which is adjusted up and down by the protocol based on how congested the network is. When the network exceeds the target per-block gas usage, the base fee increases slightly and when capacity is below the target, it decreases slightly. Because these base fee changes are constrained, the maximum difference in base fee from block to block is predictable. This then allows wallets to auto-set the gas fees for users in a highly reliable fashion. It is expected that most users will not have to manually adjust gas fees, even in periods of high network activity. For most users the base fee will be estimated by their wallet and a small gas premium related to the urgency and the priority they want to instill into the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;This is a classic fork without a long migration time.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;: TBD.  Block number at or after which EIP-3416 transactions are valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_TARGET_MAX_CHANGE&lt;&#x2F;code&gt;: &lt;code&gt;1 &#x2F;&#x2F; 1024&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCK_GAS_USED&lt;&#x2F;code&gt;: total gas consumed by transaction included in the block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PARENT_GAS_USED&lt;&#x2F;code&gt;: same as &lt;code&gt;BLOCK_GAS_USED&lt;&#x2F;code&gt; for parent block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CURRENT_BLOCK&lt;&#x2F;code&gt;: The current block that is being worked with (either being validated, or being produced).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE&lt;&#x2F;code&gt;: 16th item in the block header. Represents the amount of attoeth burned for every unit of gas a transaction uses.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PARENT_BASE_FEE&lt;&#x2F;code&gt;: same as &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; for parent block.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;: &lt;code&gt;1 &#x2F;&#x2F; 8&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INITIAL_BASE_FEE&lt;&#x2F;code&gt; : Median gas price in &lt;code&gt;FORK_BLOCK_NUMBER - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;process&quot;&gt;Process&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;At &lt;code&gt;block.number == FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; we set &lt;code&gt;BASE_FEE = INITIAL_BASE_FEE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; is set, from &lt;code&gt;FORK_BLOCK_NUMBER + 1&lt;&#x2F;code&gt;, as follows
&lt;ul&gt;
&lt;li&gt;Let &lt;code&gt;GAS_DELTA = (PARENT_GAS_USED - PARENT_GAS_TARGET) &#x2F;&#x2F; PARENT_GAS_TARGET&lt;&#x2F;code&gt; (possibly negative).&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;BASE_FEE = PARENT_BASE_FEE + GAS_DELTA * BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Transactions since &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; are encoded the same as the current ones &lt;code&gt;rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])&lt;&#x2F;code&gt; where &lt;code&gt;v,r,s&lt;&#x2F;code&gt; is a signature of &lt;code&gt;rlp([nonce, gasPrice, gasLimit, to, value, data])&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt; is the &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; specified by the sender according to this proposal.&lt;&#x2F;li&gt;
&lt;li&gt;To produce transactions since &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the new &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; field (maintaining legacy name of &lt;code&gt;gasPrice&lt;&#x2F;code&gt; in the transaction) is set as follows (and the &lt;code&gt;GAS_PREMIUM&lt;&#x2F;code&gt; is computed as specified):
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FEE_CAP&lt;&#x2F;code&gt;: &lt;code&gt;tx.gasPrice&lt;&#x2F;code&gt;, serves as the absolute maximum that the transaction sender is willing to pay.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS_PREMIUM = (FEE_CAP - BASE_FEE) &#x2F; 2&lt;&#x2F;code&gt; serves as a sender-preferred median premium to the miner, beyond the base fee.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;FEE_CAP &amp;lt; BASE_FEE&lt;&#x2F;code&gt; then the transaction is considered invalid and cannot be included in the current block, but might be included in future blocks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;During transaction execution, for EIP3416 transactions we calculate the cost to the &lt;code&gt;tx.origin&lt;&#x2F;code&gt; and the gain to the &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; as follows:
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;GASPRICE = BASE_FEE + median((tx_i.gasPrice - BASE_FEE) &#x2F; 2)&lt;&#x2F;code&gt; among all transactions &lt;code&gt;tx_i&lt;&#x2F;code&gt; included in the same block, &lt;em&gt;weighted by gas consumed&lt;&#x2F;em&gt; and not including the top 5% of outlier gas price in calculation. By weighted median without 5% of the upper-side outliers, we mean that each gas unit spent is ordered according to the corresponding transaction by &lt;code&gt;BASE_FEE + tx.gasPrice &#x2F; 2&lt;&#x2F;code&gt; and then the value chosen will be the one separating the lower 95% in two parts.&lt;&#x2F;li&gt;
&lt;li&gt;Let &lt;code&gt;GASUSED&lt;&#x2F;code&gt; be the gas used during the transaction execution&#x2F;state transition.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;tx.origin&lt;&#x2F;code&gt; initially pays &lt;code&gt;GASPRICE * tx.gasLimit&lt;&#x2F;code&gt;, and gets refunded &lt;code&gt;GASPRICE * (tx.gasLimit - GASUSED)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The miners can still use a &lt;code&gt;greedy&lt;&#x2F;code&gt; strategy to include new transactions in the proposed blocks by adding the transactions ordered by larger &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; first. This is similar to how current blocks are filled, and is a consequence of &lt;code&gt;FEE_CAP&lt;&#x2F;code&gt; and &lt;code&gt;GAS_PREMIUM&lt;&#x2F;code&gt; being a positive linear function of each other.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale behind the premium being 50% of (fee cap - base fee) is that at any given point the average network sender has an average fee cap, and we assume that between base fee and fee cap the sender has no specific preference, as long as the transaction is included in some block. Then, the sender is happy with a median premium among this uniform range. Another justification can be that the user also knows that this new version of the pricing protocol for the complete block uses a median, then is fair for him to apply a median within his preferential range, assuming an uniform sampling there. Simulations (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;c6kyRNMuTnKf_SlolmevRg#An-improvement-for-the-premium&quot;&gt;here&lt;&#x2F;a&gt;) with Ethereum gas data shows indeed that median one of the most robust metric.s&lt;&#x2F;p&gt;
&lt;p&gt;The 5% top outliers removal, not considered in the median, or similar number, is to give extra robustness against miner manipulation, because as current network utilization has been around 97% for the last 6 months the miners can include their own transactions on the empty 3% to try to manipulate and increase the median price (even this manipulation effect will be very small on the final price).&lt;&#x2F;p&gt;
&lt;p&gt;The rationale for the &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; update formula is that we are using an additive version (&lt;code&gt;PARENT_BASE_FEE + GAS_DELTA * BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;) to avoid an attack of senders sending this fee to zero. This attack was simulated and observed for multiplicative formula proposed in previous version (&lt;code&gt;PARENT_BASE_FEE + PARENT_BASE_FEE * GAS_DELTA * BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt;). See an article about the attack and the simulation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;mtefagh.github.io&#x2F;fee&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Another rationale for the additive &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; update formula is that it guarantees (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pdfs.semanticscholar.org&#x2F;3d2d&#x2F;773983c5201b58586af463f045befae5bbf2.pdf&quot;&gt;this&lt;&#x2F;a&gt; article) that the optimal execution strategy (scheduling broadcasts in order to pay less fee) for a batch of nonurgent transactions is to spread the transactions across different blocks which in turn helps to avoid network congestion and lowers volatility. For the multiplicative formula, it is exactly the reverse, that is, spikes (dumping all your transactions at once) are incentivized as described &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;path-dependence-of-eip-1559-and-the-simulation-of-the-resulting-permanent-loss&#x2F;8964&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The rationale for the &lt;code&gt;BASE_FEE_MAX_CHANGE&lt;&#x2F;code&gt; being &lt;code&gt;1 &#x2F;&#x2F; 8&lt;&#x2F;code&gt; is that the &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; is designed to be very adaptative to block utilization changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The backward compatibility is very straightforward because there are no new fields added to the transactions. Pricing of the gas per block on the miner&#x2F;validator side is still fast to compute but a little more complex. Changes only affect miners&#x2F;validators. Wallets are no affected by this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Senders cannot manipulate the minimum fee because the minimum &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; is controlled by the miners with small increments or decrements on each new block proposed.&lt;&#x2F;li&gt;
&lt;li&gt;Above the &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; the senders have a very limited ability to manipulate and lower the final gas price they pay because they have to move the weighted median close to &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; and, as we know, this is a very robust statistic.&lt;&#x2F;li&gt;
&lt;li&gt;Miners have a very limited ability to manipulate and raise the final gas price paid by senders above &lt;code&gt;BASE_FEE&lt;&#x2F;code&gt; because to influence the final gas price they have to stuff fake transactions beyond the top 5% of the blocks. In average and currently, only the top 3% of the block is empty, so to fill-up 5% of the block they need to start dropping profitable transactions to reach 5%. Only beyond 5% of the top block gas they can start moving the median a little and the median is still a very robust statistic, not liable to being easily manipulated.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Partial removal of refunds</title>
        <published>2021-03-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3403/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3298-removal-of-refunds/5430" />
        

        <id>https://wg-eips.ritovision.com/3403/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3403"
            label="EIP-3403" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3403/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Remove gas refunds for SELFDESTRUCT, and restrict gas refunds for SSTORE to one specific case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas refunds for SSTORE and SELFDESTRUCT were originally introduced to motivate application developers to write applications that practice &quot;good state hygiene&quot;, clearing storage slots and contracts that are no longer needed. However, they are not widely used for this, and poor state hygiene continues to be the norm. It is now widely accepted that the only solution to state growth is some form of statelessness or state expiry, and if such a solution is implemented, then disused storage slots and contracts would start to be ignored automatically.&lt;&#x2F;p&gt;
&lt;p&gt;Gas refunds additionally have multiple harmful consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Refunds give rise to GasToken. GasToken has benefits in moving gas space from low-fee periods to high-fee periods, but it also has downsides to the network, particularly in exacerbating state size (as state slots are effectively used as a &quot;battery&quot; to save up gas) and inefficiently clogging blockchain gas usage&lt;&#x2F;li&gt;
&lt;li&gt;Refunds increase block size variance. The theoretical maximum amount of actual gas consumed in a block is nearly twice the on-paper gas limit (as refunds add gas space for subsequent transactions in a block, though refunds are capped at 50% of a transaction&#x27;s gas used). This is not fatal, but is still undesirable, especially given that refunds can be used to maintain 2x usage spikes for far longer than EIP 1559 can.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-mutex-usecase&quot;&gt;The mutex usecase&lt;&#x2F;h3&gt;
&lt;p&gt;There are two typical ways to implement mutexes: &#x27;0-1-0&#x27; and &#x27;1-2-1. Let&#x27;s see how they differ&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&#x27;0-1-0&#x27;:
&lt;ul&gt;
&lt;li&gt;Istanbul: 1612&lt;&#x2F;li&gt;
&lt;li&gt;Berlin: 212&lt;&#x2F;li&gt;
&lt;li&gt;NoRefund: 20112&lt;&#x2F;li&gt;
&lt;li&gt;EIP-3403: 1112&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&#x27;1-2-1&#x27;:
&lt;ul&gt;
&lt;li&gt;Istanbul: 1612&lt;&#x2F;li&gt;
&lt;li&gt;Berlin: 212&lt;&#x2F;li&gt;
&lt;li&gt;NoRefund: 3012&lt;&#x2F;li&gt;
&lt;li&gt;EIP-3403: 3012&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: In reality, there are never a negative gas cost, since the refund is capped at 0.5 * gasUsed.
However, these tables show the negative values, since a more real-world scenario would likely spend the
extra gas on other operations.&#x27;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSTORE_REFUND_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;19000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Remove the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refund.&lt;&#x2F;li&gt;
&lt;li&gt;Remove the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; refund in all cases except for one specific case: if the &lt;em&gt;new value&lt;&#x2F;em&gt; and &lt;em&gt;original value&lt;&#x2F;em&gt; of the storage slot both equal 0 but the &lt;em&gt;current value&lt;&#x2F;em&gt; does not (those terms being defined as in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1283&quot;&gt;EIP-1283&lt;&#x2F;a&gt;), refund &lt;code&gt;SSTORE_REFUND_GAS&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Preserving refunds in the &lt;code&gt;new = original = 0 != current&lt;&#x2F;code&gt; case ensures that a few key use cases that deserve favorable gas cost treatment continue to receive favorable gas cost treatment, particularly:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Anti-reentrancy locks (typically flipped from 0 to 1 right before a child call begins, and then flipped back to 0 when the child call ends)&lt;&#x2F;li&gt;
&lt;li&gt;ERC20 approve-and-send (the &quot;approved value&quot; goes from zero to nonzero when the token transfer is approved, and then back to zero when the token transfer processes)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It also preserves two key goals of EIP 3298:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gas tokens continue to be non-viable, because each 19000 refund is only possible because of 19000 extra gas that was paid for flipping that storage slot from zero to nonzero earlier in the same transaction, so you can&#x27;t clear some storage slots and use that saved gas to fill others.&lt;&#x2F;li&gt;
&lt;li&gt;The total amount of gas &lt;em&gt;spent on execution&lt;&#x2F;em&gt; is capped at the gas limit. Every 19000 refund for flipping a storage slot non from zero -&amp;gt; zero is only possible because of 19000 extra gas paid for flipping that slot from zero -&amp;gt; nonzero earlier in the same transaction; that gas paid for a storage write and expansion that were both reverted and so do not actually need to be applied to the Merkle tree. Hence, this extra gas does not contribute to risk.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are currently only applied &lt;em&gt;after&lt;&#x2F;em&gt; transaction execution, so they cannot affect how much gas is available to any particular call frame during execution. Hence, removing them will not break the ability of any code to execute, though it will render some applications economically nonviable.&lt;&#x2F;p&gt;
&lt;p&gt;Gas tokens in particular will become valueless. DeFi arbitrage bots, which today frequently use either established gas token schemes or a custom alternative to reduce on-chain costs, would benefit from rewriting their code to remove calls to these no-longer-functional gas storage mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;2929-gas-costs&quot;&gt;2929 Gas Costs&lt;&#x2F;h3&gt;
&lt;p&gt;Note, there is a difference between &#x27;hot&#x27; and &#x27;cold&#x27; slots. This table shows the values as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; assuming that all touched storage slots were already &#x27;hot&#x27; (the difference being a one-time cost of &lt;code&gt;2100&lt;&#x2F;code&gt; gas).&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;2800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19900&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;17800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-11882&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;with-eip-3403-partial-refunds&quot;&gt;With EIP-3403 partial refunds&lt;&#x2F;h3&gt;
&lt;p&gt;If refunds were to be partially removed, as specified &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;3403&#x2F;&quot;&gt;here&lt;&#x2F;a&gt;, this would be the comparative table. &lt;strong&gt;This table also assumes touched storage slots were already &#x27;hot&#x27;&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Effective gas (after refund)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;19000&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;td&gt;19000&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;21118&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are not visible to transaction execution, so this should not have any impact on transaction execution logic.&lt;&#x2F;p&gt;
&lt;p&gt;The maximum amount of gas that can be spent on execution in a block is limited to the gas limit, if we do not count zero-to-nonzero SSTOREs that were later reset back to zero. It is okay to not count those, because if such an SSTORE is reset, storage is not expanded and the client does not need to actually adjust the Merke tree; the gas consumption is refunded, but the effort normally required by the client to process those opcodes is also cancelled. &lt;strong&gt;Clients should make sure to not do a storage write if &lt;code&gt;new_value = original_value&lt;&#x2F;code&gt;; this was a prudent optimization since the beginning of Ethereum but it becomes more important now.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EOF - EVM Object Format v1</title>
        <published>2021-03-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Piotr Dobaczewski</name><uri>https://github.com/pdobacz</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3540/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/evm-object-format-eof/5727" />
        

        <id>https://wg-eips.ritovision.com/3540/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3540"
            label="EIP-3540" />
        

        
        

        
        <summary type="html">EOF is an extensible and versioned container format for EVM bytecode with a once-off validation at deploy time.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3540/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce an extensible and versioned container format for the EVM with a once-off validation at deploy time. The version described here brings the tangible benefit of code and data separation, and allows for easy introduction of a variety of changes in the future. This change relies on the reserved byte introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To summarise, EOF bytecode has the following layout:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;magic, version, (section_kind, section_size_or_sizes)+, 0, &amp;lt;section contents&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;On-chain deployed EVM bytecode contains no pre-defined structure today. Code is typically validated in clients to the extent of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis at runtime, every single time prior to execution. This poses not only an overhead, but also a challenge for introducing new or deprecating existing features.&lt;&#x2F;p&gt;
&lt;p&gt;Validating code during the contract creation process allows code versioning without an additional version field in the account. Versioning is a useful tool for introducing or deprecating features, especially for larger changes (such as significant changes to control flow, or features like account abstraction).&lt;&#x2F;p&gt;
&lt;p&gt;The format described in this EIP introduces a simple and extensible container with a minimal set of changes required to both clients and languages, and introduces validation.&lt;&#x2F;p&gt;
&lt;p&gt;The first tangible feature it provides is separation of code and data. This separation is especially beneficial for on-chain code validators (like those utilised by layer-2 scaling tools, such as Optimism), because they can distinguish code and data (this includes deployment code and constructor arguments too). Currently, they a) require changes prior to contract deployment; b) implement a fragile method; or c) implement an expensive and restrictive jump analysis. Code and data separation can result in ease of use and significant gas savings for such use cases. Additionally, various (static) analysis tools can also benefit, though off-chain tools can already deal with existing code, so the impact is smaller.&lt;&#x2F;p&gt;
&lt;p&gt;A non-exhaustive list of proposed changes which could benefit from this format:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Including a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-table (to avoid analysis at execution time) and&#x2F;or removing &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s entirely.&lt;&#x2F;li&gt;
&lt;li&gt;Introducing static jumps (with relative addresses) and jump tables, and disallowing dynamic jumps at the same time.&lt;&#x2F;li&gt;
&lt;li&gt;Multibyte opcodes without any workarounds.&lt;&#x2F;li&gt;
&lt;li&gt;Representing functions as individual code sections instead of subroutines.&lt;&#x2F;li&gt;
&lt;li&gt;Introducing special sections for different use cases, notably Account Abstraction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.&lt;&#x2F;p&gt;
&lt;p&gt;In order to guarantee that every EOF-formatted contract in the state is valid, we need to prevent already deployed (and not validated) contracts from being recognized as such format. This is achieved by choosing a byte sequence for the &lt;em&gt;magic&lt;&#x2F;em&gt; that doesn&#x27;t exist in any of the already deployed contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remarks&quot;&gt;Remarks&lt;&#x2F;h3&gt;
&lt;p&gt;If code starts with the &lt;code&gt;MAGIC&lt;&#x2F;code&gt;, it is considered to be EOF formatted, otherwise it is considered to be &lt;em&gt;legacy&lt;&#x2F;em&gt; code. For clarity, the &lt;code&gt;MAGIC&lt;&#x2F;code&gt; together with a version number &lt;em&gt;n&lt;&#x2F;em&gt; is denoted as the &lt;em&gt;EOFn prefix&lt;&#x2F;em&gt;, e.g. &lt;em&gt;EOF1 prefix&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;EOF-formatted contracts are created using new instructions which are introduced in a separate EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode &lt;code&gt;0xEF&lt;&#x2F;code&gt; is currently an undefined instruction, therefore: &lt;em&gt;It pops no stack items and pushes no stack items, and it causes an exceptional abort when executed.&lt;&#x2F;em&gt; This means legacy &lt;em&gt;initcode&lt;&#x2F;em&gt; or already deployed legacy &lt;em&gt;code&lt;&#x2F;em&gt; starting with this instruction will continue to abort execution.&lt;&#x2F;p&gt;
&lt;p&gt;Unless otherwise specified, all integers are encoded in big-endian byte order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-validation&quot;&gt;Code validation&lt;&#x2F;h3&gt;
&lt;p&gt;We introduce &lt;em&gt;code validation&lt;&#x2F;em&gt; for new contract creation. To achieve this, we define a format called EVM Object Format (EOF), containing a version indicator, and a ruleset of validity tied to a given version.&lt;&#x2F;p&gt;
&lt;p&gt;Legacy code is not affected by EOF code validation.&lt;&#x2F;p&gt;
&lt;p&gt;Code validation is performed during contract creation, and is elaborated on in separate EIPs.
The EOF format itself and its formal validation are described in the following sections.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;container-specification&quot;&gt;Container specification&lt;&#x2F;h3&gt;
&lt;p&gt;EOF container is a binary format with the capability of providing the EOF version number and a list of EOF sections.&lt;&#x2F;p&gt;
&lt;p&gt;The container starts with the EOF prefix:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;magic&lt;&#x2F;td&gt;&lt;td&gt;2-bytes&lt;&#x2F;td&gt;&lt;td&gt;0xEF00&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;version&lt;&#x2F;td&gt;&lt;td&gt;1-byte&lt;&#x2F;td&gt;&lt;td&gt;0x01–0xFF&lt;&#x2F;td&gt;&lt;td&gt;EOF version number&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The EOF prefix is followed by at least one section header. Each section header contains two fields, &lt;code&gt;section_kind&lt;&#x2F;code&gt; and either &lt;code&gt;section_size&lt;&#x2F;code&gt; or &lt;code&gt;section_size_list&lt;&#x2F;code&gt;, depending on the kind. &lt;code&gt;section_size_list&lt;&#x2F;code&gt; is a list of size values when multiple sections of this kind are allowed, encoded as a count of items followed by the items.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;section_kind&lt;&#x2F;td&gt;&lt;td&gt;1-byte&lt;&#x2F;td&gt;&lt;td&gt;0x01–0xFF&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint8&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;section_size&lt;&#x2F;td&gt;&lt;td&gt;2-bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000–0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;section_size_list&lt;&#x2F;td&gt;&lt;td&gt;dynamic&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;uint16, uint16+&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The list of section headers is terminated with the &lt;em&gt;section headers terminator byte&lt;&#x2F;em&gt; &lt;code&gt;0x00&lt;&#x2F;code&gt;. The body content follows immediately after.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;container-validation-rules&quot;&gt;Container validation rules&lt;&#x2F;h4&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; MUST NOT be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;section_kind&lt;&#x2F;code&gt; MUST NOT be &lt;code&gt;0&lt;&#x2F;code&gt;. The value &lt;code&gt;0&lt;&#x2F;code&gt; is reserved for &lt;em&gt;section headers terminator byte&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;There MUST be at least one section (and therefore section header).&lt;&#x2F;li&gt;
&lt;li&gt;Stray bytes outside of sections MUST NOT be present. This includes trailing bytes after the last section.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;eof-version-1&quot;&gt;EOF version 1&lt;&#x2F;h3&gt;
&lt;p&gt;EOF version 1 is made up of several EIPs, including this one. Some values in this specification are only discussed briefly. To understand the full scope of EOF, it is necessary to review each EIP in-depth.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;container&quot;&gt;Container&lt;&#x2F;h4&gt;
&lt;p&gt;The EOF version 1 container consists of a &lt;code&gt;header&lt;&#x2F;code&gt; and &lt;code&gt;body&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;container := header, body&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;header := &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    magic, version, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_type, type_size, &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_code, num_code_sections, code_size+,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [kind_container, num_container_sections, container_size+,]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kind_data, data_size,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    terminator&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;body := types_section, code_section+, container_section*, data_section&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;types_section := (inputs, outputs, max_stack_increase)+&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;note: &lt;code&gt;,&lt;&#x2F;code&gt; is a concatenation operator, &lt;code&gt;+&lt;&#x2F;code&gt; should be interpreted as &quot;one or more&quot; of the preceding item, &lt;code&gt;*&lt;&#x2F;code&gt; should be interpreted as &quot;zero or more&quot; of the preceding item, and &lt;code&gt;[item]&lt;&#x2F;code&gt; should be interpreted as an optional item.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;header&quot;&gt;Header&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;magic&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0xEF00&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;version&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;EOF version&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_type&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x01&lt;&#x2F;td&gt;&lt;td&gt;kind marker for type section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;type_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0004-0x1000&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the type section content, 4 bytes per code section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_code&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x02&lt;&#x2F;td&gt;&lt;td&gt;kind marker for code size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;num_code_sections&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0x0400&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the number of the code sections&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;code_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the code section content&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_container&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x03&lt;&#x2F;td&gt;&lt;td&gt;kind marker for container size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;num_container_sections&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0001-0x0100&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the number of the container sections&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;container_size&lt;&#x2F;td&gt;&lt;td&gt;4 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x00000001-0xFFFFFFFF&lt;&#x2F;td&gt;&lt;td&gt;32-bit unsigned big-endian integer denoting the length of the container section content&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;kind_data&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0xFF&lt;&#x2F;td&gt;&lt;td&gt;kind marker for data size section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_size&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000-0xFFFF&lt;&#x2F;td&gt;&lt;td&gt;16-bit unsigned big-endian integer denoting the length of the data section content (*)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;terminator&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00&lt;&#x2F;td&gt;&lt;td&gt;marks the end of the header&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;(*) For not yet deployed containers this can be greater than the actual content length.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;body&quot;&gt;Body&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;name&lt;&#x2F;th&gt;&lt;th&gt;length&lt;&#x2F;th&gt;&lt;th&gt;value&lt;&#x2F;th&gt;&lt;th&gt;description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;types_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;stores code section metadata&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;inputs&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00-0x7F&lt;&#x2F;td&gt;&lt;td&gt;number of stack elements the code section consumes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;outputs&lt;&#x2F;td&gt;&lt;td&gt;1 byte&lt;&#x2F;td&gt;&lt;td&gt;0x00-0x7F&lt;&#x2F;td&gt;&lt;td&gt;number of stack elements the code section returns&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;max_stack_increase&lt;&#x2F;td&gt;&lt;td&gt;2 bytes&lt;&#x2F;td&gt;&lt;td&gt;0x0000-0x03FF&lt;&#x2F;td&gt;&lt;td&gt;maximum increase of the operand stack height by the code section&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;code_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary bytecode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;container_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary EOF-formatted container&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;data_section&lt;&#x2F;td&gt;&lt;td&gt;variable&lt;&#x2F;td&gt;&lt;td&gt;n&#x2F;a&lt;&#x2F;td&gt;&lt;td&gt;arbitrary sequence of bytes&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: A special value of &lt;code&gt;outputs&lt;&#x2F;code&gt; being &lt;code&gt;0x80&lt;&#x2F;code&gt; is designated to denote non-returning functions as defined in a separate EIP.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;eof-version-1-validation-rules&quot;&gt;EOF version 1 validation rules&lt;&#x2F;h4&gt;
&lt;p&gt;The following validity constraints are placed on the container format:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;types_size&lt;&#x2F;code&gt; is divisible by &lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;the number of code sections must be equal to &lt;code&gt;types_size &#x2F; 4&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;data body length may be shorter than &lt;code&gt;data_size&lt;&#x2F;code&gt; for a not yet deployed container&lt;&#x2F;li&gt;
&lt;li&gt;the total size of a container must not exceed &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; (as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;changes-to-execution-semantics&quot;&gt;Changes to execution semantics&lt;&#x2F;h3&gt;
&lt;p&gt;For an EOF contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Execution starts at the first byte of code section 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;GAS&lt;&#x2F;code&gt; are rejected by validation in EOF contracts, with no replacements&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; are rejected by validation in EOF contracts, replacement instructions to be introduced in a separate EIP.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (or any replacement instruction for EOF) from an EOF contract to a non-EOF contract (legacy contract, EOA, empty account) is disallowed, and it should fail in the same mode as if the call depth check failed. We allow legacy to EOF path for existing proxy contracts to be able to use EOF upgrades.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For a legacy contract:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the target account of &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; is an EOF contract, then it will copy up to 2 bytes from &lt;code&gt;EF00&lt;&#x2F;code&gt;, as if that would be the code.&lt;&#x2F;li&gt;
&lt;li&gt;If the target account of &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is an EOF contract, then it will return &lt;code&gt;0x9dbf3648db8210552e9c4f75c6a1c3057c0ca432043bd648be15fe7be05646f5&lt;&#x2F;code&gt; (the hash of &lt;code&gt;EF00&lt;&#x2F;code&gt;, as if that would be the code).&lt;&#x2F;li&gt;
&lt;li&gt;If the target account of &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; is an EOF contract, then it will return 2.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt; Like for legacy targets, the aforementioned behavior of &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; does not apply to EOF contract targets mid-creation, i.e. those report same as accounts without code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EVM and&#x2F;or account versioning has been discussed numerous times over the past years. This proposal aims to learn from them.
See &quot;Ethereum account versioning&quot; on the Fellowship of Ethereum Magicians Forum for a good starting point.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;execution-vs-creation-time-validation&quot;&gt;Execution vs. creation time validation&lt;&#x2F;h3&gt;
&lt;p&gt;This specification introduces creation time validation, which means:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;All created contracts with &lt;em&gt;EOFn&lt;&#x2F;em&gt; prefix are valid according to version &lt;em&gt;n&lt;&#x2F;em&gt; rules. This is very strong and useful property. The client can trust that the deployed code is well-formed.&lt;&#x2F;li&gt;
&lt;li&gt;In the future, this allows to serialize &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; map in the EOF container and eliminate the need of implicit &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis required before execution.&lt;&#x2F;li&gt;
&lt;li&gt;Or to completely remove the need for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instructions.&lt;&#x2F;li&gt;
&lt;li&gt;This helps with deprecating EVM instructions and&#x2F;or features.&lt;&#x2F;li&gt;
&lt;li&gt;The biggest disadvantage is that deploy-time validation of EOF code must be enabled in two hard-forks. However, the first step (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;) is already deployed in London.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The alternative is to have execution time validation for EOF. This is performed every single time a contract is executed, however clients may be able to cache validation results. This &lt;em&gt;alternative&lt;&#x2F;em&gt; approach has the following properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Because the validation is consensus-level execution step, it means the execution always requires the entire code. This makes &lt;em&gt;code merkleization impractical&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Can be enabled via a single hard-fork.&lt;&#x2F;li&gt;
&lt;li&gt;Better backwards compatibility: data contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte or the &lt;em&gt;EOF prefix&lt;&#x2F;em&gt; can be deployed. This is a dubious benefit, however.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-magic&quot;&gt;The MAGIC&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The first byte &lt;code&gt;0xEF&lt;&#x2F;code&gt; was chosen because it is reserved for this purpose by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3541&#x2F;&quot;&gt;EIP-3541&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The second byte &lt;code&gt;0x00&lt;&#x2F;code&gt; was chosen to avoid clashes with three contracts which were deployed on &lt;strong&gt;Mainnet&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0xca7bf67ab492b49806e24b6e2e4ec105183caa01&lt;&#x2F;code&gt;: &lt;code&gt;EFF09f918bf09f9fa9&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x897da0f23ccc5e939ec7a53032c5e80fd1a947ec&lt;&#x2F;code&gt;: &lt;code&gt;EF&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x6e51d4d9be52b623a3d3a2fa8d3c5e3e01175cd0&lt;&#x2F;code&gt;: &lt;code&gt;EF&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;No contracts starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; bytes exist on public testnets: Goerli, Ropsten, Rinkeby, Kovan and Sepolia at their London fork block.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;&#x2F;strong&gt;: This EIP MUST NOT be enabled on chains which contain bytecodes starting with &lt;code&gt;MAGIC&lt;&#x2F;code&gt; and not being valid EOF.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-version-range-start-with-1&quot;&gt;EOF version range start with 1&lt;&#x2F;h3&gt;
&lt;p&gt;The version number 0 will never be used in EOF, so we can call legacy code &lt;em&gt;EOF0&lt;&#x2F;em&gt;.
Also, implementations may use APIs where 0 version number denotes legacy code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;section-structure&quot;&gt;Section structure&lt;&#x2F;h3&gt;
&lt;p&gt;We have considered different questions for the sections:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Streaming headers (i.e. &lt;code&gt;section_header, section_data, section_header, section_data, ...&lt;&#x2F;code&gt;) are used in some other formats (such as WebAssembly). They are handy for formats which are subject to editing (adding&#x2F;removing sections). That is not a useful feature for EVM. One minor benefit applicable to our case is that they do not require a specific &quot;header terminator&quot;. On the other hand they seem to play worse with code chunking &#x2F; merkleization, as it is better to have all section headers in a single chunk.&lt;&#x2F;li&gt;
&lt;li&gt;Whether to have a header terminator or to encode &lt;code&gt;number_of_sections&lt;&#x2F;code&gt; or &lt;code&gt;total_size_of_headers&lt;&#x2F;code&gt;. Both raise the question of how large of a value these fields should be able to hold. A terminator byte seems to avoid the problem of choosing a size which is too small without any perceptible downside, so it is the path taken.&lt;&#x2F;li&gt;
&lt;li&gt;(EOF1) Whether to encode section sizes as fixed 16-bit (32-bit for container section size) values or some kind of variable length field (e.g. LEB128). We have opted for fixed size. Should this be limiting in the future, a new EOF version could change the format. Besides simplifying client implementations, not using LEB128 also greatly simplifies on-chain parsing.&lt;&#x2F;li&gt;
&lt;li&gt;Whether or not to have more structure to the container header for all EOF versions to follow. In order to allow future formats optimized for chunking and merkleization (verkleization) it was decided to keep it generic and specify the structure only for a specific EOF version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;data-only-contracts&quot;&gt;Data-only contracts&lt;&#x2F;h3&gt;
&lt;p&gt;See section &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7480&#x2F;#lack-of-extdatacopy&quot;&gt;Lack of &lt;code&gt;EXTDATACOPY&lt;&#x2F;code&gt; in EIP-7480&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-contracts-can-only-delegatecall-eof1-contracts&quot;&gt;EOF1 contracts can only &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; EOF1 contracts&lt;&#x2F;h3&gt;
&lt;p&gt;Currently contracts can selfdestruct in three different ways (directly through &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, indirectly through &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and indirectly through &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;). &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; disables the first two possibilities, however the third possibility remains. Allowing EOF1 contracts to only &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; other EOF1 contracts allows the following strong statement: EOF1 contract can never be destructed. Attacks based on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; completely disappear for EOF1 contracts. These include destructed library contracts (e.g. Parity Multisig).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof1-containers-have-a-size-limit&quot;&gt;EOF1 containers have a size limit&lt;&#x2F;h3&gt;
&lt;p&gt;Imposing an EOF-validation time limit for the size of EOF containers provides a reference limit of how large the containers should EVM implementations be able to handle when validating and processing containers. &lt;code&gt;MAX_INITCODE_SIZE&lt;&#x2F;code&gt; was chosen for EOF1, as it is what contract creation currently allows for.&lt;&#x2F;p&gt;
&lt;p&gt;Given one of the main reasons for the limit is to avoid attack vectors on &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis, and EOF removes the need for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;-analysis and introduces a cost structure for deploy-time analysis, in the future this limit could be increased or even lifted for EOF.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;kind-data-could-be-0x04-not-0xff&quot;&gt;&lt;code&gt;kind_data&lt;&#x2F;code&gt; could be &lt;code&gt;0x04&lt;&#x2F;code&gt; not &lt;code&gt;0xff&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Putting the data section last as &lt;code&gt;0xff&lt;&#x2F;code&gt; has the advantage of aligning with the fact that it always comes last. We&#x27;re avoiding a situation that a new section kind would need to go before the data section and break the section kind ordering. At the same time, data section being last is advantageous because it is the section which gets data appended to during contract deployment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a breaking change given that any code starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; was not deployable before (and resulted in exceptional abort if executed), but now some subset of such codes can be deployed and executed successfully.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of &lt;code&gt;MAGIC&lt;&#x2F;code&gt; guarantees that none of the contracts existing on the chain are affected by the new rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;With the anticipated EOF extensions, the validation is expected to have linear computational and space complexity.
We think that the validation cost is sufficiently covered by:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3860&#x2F;&quot;&gt;EIP-3860&lt;&#x2F;a&gt; for &lt;em&gt;initcode&lt;&#x2F;em&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;high per-byte cost of deploying &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reject new contract code starting with the 0xEF byte</title>
        <published>2021-03-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Andrei Maiboroda</name><uri>https://github.com/gumb0</uri>
	</author>
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><uri>https://github.com/chriseth</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3541/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/evm-object-format-eof/5727" />
        

        <id>https://wg-eips.ritovision.com/3541/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:3541"
            label="EIP-3541" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3541/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Disallow new code starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte to be deployed. Code already existing in the account trie starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte is not affected semantically by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts conforming to the EVM Object Format (EOF) are going to be validated at deploy time. In order to guarantee that every EOF-formatted contract in the state is valid, we need to prevent already deployed (and not validated) contracts from being recognized as such format. This will be achieved by choosing a byte sequence for the &lt;em&gt;magic&lt;&#x2F;em&gt; that doesn&#x27;t exist in any of the already deployed contracts. To prevent the growth of the search space and to limit the analysis to the contracts existing before this fork, we disallow the starting byte of the format (the first byte of the magic).&lt;&#x2F;p&gt;
&lt;p&gt;Should the EVM Object Format proposal not be deployed in the future, the &lt;em&gt;magic&lt;&#x2F;em&gt; can be used by other features depending on versioning. In the case versioning becomes obsolete, it is simple to roll this back by allowing contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte to be deployed again.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After &lt;code&gt;block.number == HF_BLOCK&lt;&#x2F;code&gt; new contract creation (via create transaction, &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions) results in an exceptional abort if the &lt;em&gt;code&lt;&#x2F;em&gt;&#x27;s first byte is &lt;code&gt;0xEF&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;remarks&quot;&gt;Remarks&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;initcode&lt;&#x2F;em&gt; is the code executed in the context of the &lt;em&gt;create&lt;&#x2F;em&gt; transaction, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions. The &lt;em&gt;initcode&lt;&#x2F;em&gt; returns &lt;em&gt;code&lt;&#x2F;em&gt; (via the &lt;code&gt;RETURN&lt;&#x2F;code&gt; instruction), which is inserted into the account. See section 7 (&quot;Contract Creation&quot;) in the Yellow Paper for more information.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode &lt;code&gt;0xEF&lt;&#x2F;code&gt; is currently an undefined instruction, therefore: &lt;em&gt;It pops no stack items and pushes no stack items, and it causes an exceptional abort when executed.&lt;&#x2F;em&gt; This means &lt;em&gt;initcode&lt;&#x2F;em&gt; or already deployed &lt;em&gt;code&lt;&#x2F;em&gt; starting with this instruction will continue to abort execution.&lt;&#x2F;p&gt;
&lt;p&gt;The exceptional abort due to &lt;em&gt;code&lt;&#x2F;em&gt; starting with &lt;code&gt;0xEF&lt;&#x2F;code&gt; behaves exactly the same as any other exceptional abort that can occur during &lt;em&gt;initcode&lt;&#x2F;em&gt; execution, i.e. in case of abort all gas provided to a &lt;code&gt;CREATE*&lt;&#x2F;code&gt; or create transaction is consumed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte was chosen because it resembles &lt;strong&gt;E&lt;&#x2F;strong&gt;xecutable &lt;strong&gt;F&lt;&#x2F;strong&gt;ormat.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts using unassigned opcodes are generally understood to be at risk of changing semantics. Hence using the unassigned &lt;code&gt;0xEF&lt;&#x2F;code&gt; should have lesser effects, than choosing an assigned opcode, such as &lt;code&gt;0xFD&lt;&#x2F;code&gt; (&lt;code&gt;REVERT&lt;&#x2F;code&gt;), &lt;code&gt;0xFE&lt;&#x2F;code&gt; (&lt;code&gt;INVALID)&lt;&#x2F;code&gt;, or &lt;code&gt;0xFF&lt;&#x2F;code&gt; (&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;). Arguably while such contracts may not be very useful, they are still using valid opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;Analysis in May 2021, on &lt;code&gt;18084433&lt;&#x2F;code&gt; contracts in state, showed that there are 0 existing contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte, as opposed to 1, 4, and 12 starting with &lt;code&gt;0xFD&lt;&#x2F;code&gt;, &lt;code&gt;0xFE&lt;&#x2F;code&gt;, and &lt;code&gt;0xFF&lt;&#x2F;code&gt;, respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Each test case below may be executed in 3 different contexts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;create transaction (no account code)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;, with account code: &lt;code&gt;0x6000356000523660006000f0151560165760006000fd5b&lt;&#x2F;code&gt; (Yul code: &lt;code&gt;mstore(0, calldataload(0)) if iszero(create(0, 0, calldatasize())) { revert(0, 0) }&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;, with account code: &lt;code&gt;0x60003560005260003660006000f5151560185760006000fd5b&lt;&#x2F;code&gt; (Yul code: &lt;code&gt;mstore(0, calldataload(0)) if iszero(create2(0, 0, calldatasize(), 0)) { revert(0, 0) }&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Case&lt;&#x2F;th&gt;&lt;th&gt;Calldata&lt;&#x2F;th&gt;&lt;th&gt;Expected result&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;deploy one byte &lt;code&gt;ef&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360016000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy two bytes &lt;code&gt;ef00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360026000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy three bytes &lt;code&gt;ef0000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360036000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy 32 bytes &lt;code&gt;ef00...00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60ef60005360206000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract not deployed, transaction fails&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;deploy one byte &lt;code&gt;fe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x60fe60005360016000f3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;new contract deployed, transaction succeeds&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a breaking change given new code starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte will not be deployable, and contract creation will result in a failure. However, given bytecode is executed starting at its first byte, code deployed with &lt;code&gt;0xEF&lt;&#x2F;code&gt; as the first byte is not executable anyway.&lt;&#x2F;p&gt;
&lt;p&gt;While this means no currently executable contract is affected, it does rejects deployment of new data contracts starting with the &lt;code&gt;0xEF&lt;&#x2F;code&gt; byte.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any security or DoS risks posed by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>5 FNV primes for ethash</title>
        <published>2021-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>mineruniter969</name><uri>https://github.com/mineruniter969</uri>
	</author>
	
	<author>
		<name>mineruniter969</name><email>mineruniter969@tutanota.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3372/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3372-apply-minor-modifications-to-the-ethash-algorithm-to-break-current-asic-implementations-eip-969-resubmission/5655" />
        

        <id>https://wg-eips.ritovision.com/3372/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3372"
            label="EIP-3372" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3372/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce 5 new FNV primes into the ethash algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is to kick current ASIC implementations out of the network to keep the Ethereum network secure and healthy by changing the &lt;code&gt;fnv&lt;&#x2F;code&gt; constants.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ASICs provide a severe centralization risk for the Ethereum network. If we do not get rid of them, small GPU miners will be forced to exit the Ethereum mining because EIP-1559 will make them mining at a loss. Furthermore, ASIC production will be concentrated only at one or two parties, which will make the Ethereum hashrate centralized. Also, it is worth noting that Ethash ASIC machines cost 10k+ USD, while GPUs are priced less than 1000 USD.&lt;&#x2F;p&gt;
&lt;p&gt;With GPUs, miners can switch to other mining algorithms, but with ASICs, it is impossible. Leaving everything as-is will almost certainly a very tough (from the side of miners) integration of the Ethereum 2.0.&lt;&#x2F;p&gt;
&lt;p&gt;In short, this EIP is required to keep the Ethereum network stable and decentralized by keeping the ASIC business away.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= ETHASH11_BLKNUM&lt;&#x2F;code&gt;, activate the &lt;code&gt;ethash1.1&lt;&#x2F;code&gt; algorithm version.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ethash1-1&quot;&gt;ethash1.1&lt;&#x2F;h3&gt;
&lt;p&gt;Prior to this change, &lt;code&gt;fnv&lt;&#x2F;code&gt; hash function is used throughout the &lt;code&gt;hashimoto&lt;&#x2F;code&gt; function. &lt;code&gt;fnv&lt;&#x2F;code&gt; is identical for all steps, &lt;code&gt;ethash1.1&lt;&#x2F;code&gt; will introduce additional &lt;code&gt;fnvA&lt;&#x2F;code&gt;, &lt;code&gt;fnvB&lt;&#x2F;code&gt;, &lt;code&gt;fnvC&lt;&#x2F;code&gt;, &lt;code&gt;fnvD&lt;&#x2F;code&gt;, and &lt;code&gt;fnvE&lt;&#x2F;code&gt; functions. All those functions will have different FNV constants.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Previously used FNV prime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_0 0x1000193&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; New FNV primes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_A 0x10001a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_B 0x10001ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_C 0x10001cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_D 0x10001e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;#define FNV_PRIME_E 0x10001f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Prior to this EIP, all parts of Ethash are using the &lt;code&gt;fnv&lt;&#x2F;code&gt; (hereinafter referenced as &lt;code&gt;fnv0&lt;&#x2F;code&gt;) function.  As of the introduction of this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;fnvA&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv0&lt;&#x2F;code&gt; in the DAG item selection step&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fnvB&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv0&lt;&#x2F;code&gt; in the DAG item mix step&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fnvC(fnvD(fnvE&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv0(fnv0(fnv0(&lt;&#x2F;code&gt; in the compress mix step&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;fnv0&lt;&#x2F;code&gt; in the DAG generation step should remain unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;ASIC Miners have become a threat to the future of Ethereum and a hard fork is required to remove them from the network before additional damage is caused. EIP-3372 proposes the minimum necessary to do so and will not affect ETH stakeholders or the network like Ethash 2.0 would. The threat ASICs pose is legal, social, moral, technical, monetary, and environmental. As we continue to come closer to the merge ASICs will attack the network and the developers personally as they have done in the past because miners will always pursue profits.&lt;&#x2F;p&gt;
&lt;p&gt;Legally and socially ASIC&#x27;s have previously been a threat and a nuisance. As Hudson describes Linzhi attacked the EF and developers personally seeking to spread lies and misinformation while sending legal threats during discussions around EIP-1057. His account is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Souptacular&#x2F;linzhi&quot;&gt;here&lt;&#x2F;a&gt; and in his own words&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;ASIC manufacturer Linzhi has both pressured me and told lies&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;With their attacks and harassment on staff demonstrated in the below image:
&lt;img src=&quot;upload:&#x2F;&#x2F;n8TJsS8hEEH4DXYJ2WDzblm5qJo.jpeg&quot; alt=&quot;&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Socially and morally the Ethereum community must adopt a no-tolerance policy towards personal attacks on its developers. It is only because of the core developers that Ethereum has value, the community cannot allow large companies free reign to attack them personally and must seek to protect each developer as they are a resource that keeps Ethereum viable. Multiple developers were &quot;burned&quot; during this event. As we accelerate the merge, it is likely that ASIC companies will repeat their actions and again attack the developers personally while pursuing legal options. This is seen not only by their actions during EIP-1057 but recent discussion around EIP-969 where legal threats from them caused the champion of that EIP to dropout and forcing me to submit this EIP anonymously. Ethereum cannot allow its actors to be threatened without consequence and this is a fight that must happen now while they are weak rather than pre-merge where they are stronger which will result in a delayed merge and hurt the value of Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;ASICs have the greatest incentives and resources to commit bad acts because they are centralized in farms this is why Vitalik designed ETH to be ASIC-resistant because ASICs had ruined BTC&#x27;s principles of decentralization. Each day their power and control over the network grows. ASICs are against the founding principles of Ethereum which promotes a decentralized system run by common people, not a single owner of large warehouses. F2Pool which consists largely of ASIC farms has become the #3 largest pool controlling around 10% of hashrate. Their farms can be viewed on their webpage. In November 2020 they were 23TH&#x2F;s yet today they are 45.6 TH&#x2F;s. That&#x27;s a doubling in 4 months and their growth is accelerating as additional ASICs come online. ASICs are becoming a threat that will soon dominate the network and action must be taken now to head them off.&lt;&#x2F;p&gt;
&lt;p&gt;ASICs on F2Pool have long been known to be &quot;bad actors&quot; on the BTC network. They are known for market manipulation and dumping BTC to manipulate prices (I could not post the source link as this is a new account). What will these ASICs do once they find out that they are about to lose millions prior to the merge? Ethereum is not just a network it is a community and they will use their financial resources and pour millions into delaying the merge as they launch legal case after legal case. They will attack the developers and the community as they seek to squeeze every last dollar.&lt;&#x2F;p&gt;
&lt;p&gt;The reason Ethereum was founded on the principle of being anti-ASIC is because Vitalik had seen the damage ASICs had caused to the BTC network as they pursued profits rather than the betterment of the network. GPU miners are decentralized and disorganized which makes them a much lower threat than warehouses under one central corporation that is outside the legal system and thus cannot be held to account for bad acts.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-3372 also works to protect the environment. Post merge, gpus will go into the secondary market or move to other coins. However, ASICs will become junk. As more ASICs are produced, Ethereum increases its environmental footprint. These ASICs are being mass produced in greater numbers despite it being public that the merge is being accelerated. It is clear that these ASIC manufacturers and buyers must either be ignorant of the accelerated merge or plan to delay it. Because they dump their ETH they have no stake in the network except the money they can squeeze from it and if by making trouble they can give themselves another day than they will do it.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, Ethereum has always sought to pursue &quot;minimum issuance&quot;. By reducing the amount of miners that can pose a threat to the network, Ethereum also decreases how much it needs to pay for protection. Some EIP&#x27;s are being prepared to increase miner incomes post EIP-1559 should a threat appear. EIP-3372 eliminates the need to pay more for security and allows miners to be paid less without compromising the network&#x27;s security. As we go forward closer to the merge, the community must reduce attack vectors so as to reduce the cost of the merge itself and maximize the security of the network. The community already pays too much for protection and by reducing threats we can reduce this cost. ASIC warehouse farms are dumping all the ETH they make which is suppressing the price of ETH. Although rare, several individual GPU miners are taking part in staking or have gone on to join the community in development or our financial endeavors. They thus are more valuable to the community than a warehouse of future junk. There is no need for the Ethereum community to continue to pay for soon-to-be obsolete hardware that will end up in landfills.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;technical-overview&quot;&gt;Technical Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Ethash 1.1 will replace the only FNV prime with five new primes at the stage of the hash computation. The prime used for the DAG generation is remained unchanged, while all others are be changed. This will not prevent ASIC companies from creating new ASICs that adapt but so close to the merge it is unlikely they will do so, and even if they do they are unlikely to be able to produce enough to again be a threat.
The choice of FNV constants are based on the formal specification that is available on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ietf&quot;&gt;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-eastlake-fnv-14#section-2.1&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We apologize for the delay in submitting the justification for this EIP. As the community may or may not be aware, the original champion was forced to stop working on this EIP due to legal attacks from ASIC companies. It has taken us this long to review his work and find a new champion. To protect ourselves we are submitting this anonymously and would request the community&#x27;s aid in our endeavor to maintain our anonymity and some lenience given the circumstances and threats we face pursuing this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Mining hardware that is optimized for ethash may no longer work if the &lt;code&gt;fnv&lt;&#x2F;code&gt; constants are baked into the hardware and cannot be changed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-vectors&quot;&gt;Test Vectors&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;first&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4242424242424242&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;aa6a928db9b548ebf20fc9a74e9200321426f1c2db1571636cdd3a33eb162b36&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;f901f3a00000000000000000000000000000000000000000000000000000000000000000a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a09178d0f23c965d81f0834a4c72c6253ce6830f4022b1359aaebfc1ecba442d4ea056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302000080830f4240808080a058f759ede17a706c93f13030328bcea40c1d1341fb26f2facd21ceb0dae57017884242424242424242&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;3972318778d2af9d3c5c3dfc463bc2a5ebeebd1a7a04392708ff94d29aa18c5f&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16776896&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;full_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1073739904&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2a8de2adf89af77358250bf908bf04ba94a6e8c3ba87775564a41d269a05e4ce&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;35ded12eecf2ce2e8da2e15c06d463aae9b84cb2530a00b932e4bbc484cde353&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;second&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;307692cf71b12f6d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;mixHash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;4a2ef8287dc21f5def0d4e9694208c56e574b1692d7b254822a3f4704d8ad1ba&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;f901f7a01bef91439a3e070a6586851c11e6fd79bbbea074b2b836727b8e75c7d4a6b698a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794ea3cb5f94fa2ddd52ec6dd6eb75cf824f4058ca1a00c6e51346be0670ce63ac5f05324e27d20b180146269c5aab844d09a2b108c64a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008302004002832fefd880845511ed2a80a0e55d02c555a7969361cf74a9ec6211d8c14e4517930a00442f171bdb1698d17588307692cf71b12f6d&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;seed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;result&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;5ab98957ba5520d4e367080f442e37a047cfd9d2857b6e00dd12d82900d108a6&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16776896&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;full_size&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1073739904&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;header_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;100cbec5e5ef82991290d0d93d758f19082e71f234cf479192a8b94df6da6bfe&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;cache_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;35ded12eecf2ce2e8da2e15c06d463aae9b84cb2530a00b932e4bbc484cde353&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Predictable Proof-of-Work (POW) Sunsetting</title>
        <published>2021-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Query0x</name><uri>https://github.com/Query0x</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3374/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3374-predictable-proof-of-work-sunsetting" />
        

        <id>https://wg-eips.ritovision.com/3374/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3374"
            label="EIP-3374" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3374/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Sets block reward to 3 and reduces it to 1 linearly over the course of about 1 year.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Sets the block reward to 3 ETH and then incrementally decreases it every block for 2,362,000 blocks (approximately 1 year) until it reaches 1 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Unnecessarily abrupt changes to the Ethereum ecosystem cause disruption and disharmony resulting in the disenfranchisement of community members while undermining stability and confidence.  While moves from Proof-of-Work to Proof-of-Stake will undoubtedly cause friction between those community members vested in either, all benefit from a measured, predictable transition.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Is issuance neutral over 1 year, and reduces issuance beyond that.&lt;&#x2F;li&gt;
&lt;li&gt;Sets an initial block reward of 3;&lt;&#x2F;li&gt;
&lt;li&gt;Introduces an ongoing, predictable reduction in future mining rewards down to 1, effectively &quot;sunsetting&quot; POW and codifying the move to POS;&lt;&#x2F;li&gt;
&lt;li&gt;Reduces economic incentives for continued development of ASICs;&lt;&#x2F;li&gt;
&lt;li&gt;Allows the impacts of decreasing miner rewards to be measured and monitored rather than relying on conjecture and game theory, so adjustments can be made if necessary.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_START_BLOCK_NUMBER: TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_DURATION: 2_362_000&lt;&#x2F;code&gt; &#x2F;&#x2F; (about one year)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_END_BLOCK_NUMBER: FORK_BLOCK_NUMBER + TRANSITION_DURATION&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STARTING_REWARD: 3_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENDING_REWARD: 1_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REWARD_DELTA: STARTING_REWARD - ENDING_REWARD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-reward&quot;&gt;Block Reward&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_END_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ENDING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; REWARD_DELTA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_DURATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Picking starting and ending block reward values that are equidistant from the current block reward rate of 2 ensures the impact of this EIP will be issuance neutral over the one year time frame.  Temporarily raising the block reward to 3 blunts the initial impact of a sudden miner revenue decrease and the continual reductions thereafter codify Ethereum&#x27;s move to POS by increasingly disincentivizing POW.  Importantly, this approach moderates the rate of change so impacts and threats can be measured and monitored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hardcoded Block Gas Limit</title>
        <published>2021-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Philippe Castonguay</name><uri>https://github.com/PhABC</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3382/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3382-hardcoded-gas-limit" />
        

        <id>https://wg-eips.ritovision.com/3382/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3382"
            label="EIP-3382" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3382/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Hardcode the block gas limit to &lt;code&gt;12,500,000&lt;&#x2F;code&gt; gas per block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Updates the block validation rules such that a block is invalid if the &lt;code&gt;gas_limit&lt;&#x2F;code&gt; header field is not equal to &lt;code&gt;12,500,000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Both Ethereum&#x27;s Proof of Work and Proof of Stake designs assume that block producers are financially rational, but does not assume block producers to be benevolent. There is one exception however, and it is when block producers choose the gas limit of a block where it is assumed that block producers care about the long term health and decentralisation of the chain. Indeed, the block gas limit is one of the only parameters in Ethereum that is not dictated by node consensus, but instead is chosen by block producers. This decision was initially made to allow urgent changes in the block gas limit if necessary. Both drastically increasing or decreasing this parameter could have serious consequences that may not be desired. It is therefore a critical parameter that should require node consensus to avoid any sudden harmful change imposed by a small number of actors on the rest of the network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Refer to &lt;code&gt;gasLimit&lt;&#x2F;code&gt; as &lt;code&gt;gasTarget&lt;&#x2F;code&gt; post EIP-1559.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;added-consensus-constraint&quot;&gt;Added Consensus Constraint&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the &lt;code&gt;header.gasLimit&lt;&#x2F;code&gt; &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be equal to &lt;code&gt;BLOCK_GAS_LIMIT&lt;&#x2F;code&gt;, where &lt;code&gt;BLOCK_GAS_LIMIT&lt;&#x2F;code&gt; is a hardcoded constant set to &lt;code&gt;12,500,000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;keeping-gaslimit-in-block-headers&quot;&gt;Keeping gasLimit in Block Headers&lt;&#x2F;h3&gt;
&lt;p&gt;While it would be possible to remove the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; field from block headers, it would change the data structure to be hashed, which could lead to unintended consequences. It is therefore easier to leave the gasLimit as part of block headers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chosen-gas-limit&quot;&gt;Chosen Gas Limit&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;12,500,000&lt;&#x2F;code&gt; value is being proposed as it&#x27;s the current block gas limit as of time of writing this EIP. The actual amount could be altered with a subsequent EIP to avoid deviating from the core intent of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backward compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Rapid changes to the gas limit will likely be more difficult to execute, which could be problematic if an urgent situation arise that required changing the gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase block rewards to 3 ETH, with 2 Year Decay to 1 ETH Scheduled</title>
        <published>2021-03-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Michael D. Carter</name><uri>https://github.com/BitsBeTrippin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3368/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3368-block-reward-increase-w-decay-for-next-two-years/5550" />
        

        <id>https://wg-eips.ritovision.com/3368/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3368"
            label="EIP-3368" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3368/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Changes the block reward paid to proof-of-work (POW) miners to 3 ETH from existing 2 ETH and starts a decay schedule for next two years to 1 ETH Block Reward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Set the block reward to 3 ETH and then decrease it slightly every block for 4,724,000 blocks (approximately 2 years) until it reaches 1 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;A sudden drop in PoW mining rewards could result in a sudden precipitous decrease in mining profitability that may drive miners to auction off their hashrate to the highest bidder while they figure out what to do with their now &quot;worthless&quot; hardware. If enough hashrate is auctioned off in this way at the same time, an attacker will be able to rent a large amount of hashing power for a short period of time at relatively low cost vs. reward and potentially attack the network. By setting the block reward to X (where X is enough to offset the sudden profitability decrease) and then decreasing it over time to Y (where Y is a number below the sudden profitability decrease), we both avoid introducing long term inflation while at the same time spreading out the rate that individual miners cross into a transitional range. This approach offers a higher level of confidence and published schedule of yield, while allowing mining participants time to gracefully repurpose&#x2F;sell their hardware. This greatly increases ethereums PoW security by keeping incentives aligned to ethereum and not being force projected to short term brokerage for the highest bidder. Additionally the decay promotes a known schedule of a deflationary curve, aligning to the overall Minimal Viable Issuance directive aligned to a 2 year transition schedule for Proof of Stake, consensus replacement of Proof of Work. Security is paramount in cryptocurrency blockchains and the risk to a 51% non-resistant chain is real. The scope of Ethereum&#x27;s current hashrate has expanded to hundreds of thousands of new participants and over 2.5x original ATH hashrate&#x2F;difficulty. While the largest by hashrate crypto is bitcoin, ethereum is not far behind the total network size in security aspects. This proposal is focused to keep that superiority in security one of the key aspects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adjust block, uncle, and nephew rewards&lt;&#x2F;p&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_START_BLOCK_NUMBER: TBD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_DURATION: 4_724_000&lt;&#x2F;code&gt; (about two years)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TRANSITION_END_BLOCK_NUMBER: FORK_BLOCK_NUMBER + TRANSITION_DURATION&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STARTING_REWARD: 3_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ENDING_REWARD: 1_000_000_000_000_000_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REWARD_DELTA: STARTING_REWARD - ENDING_REWARD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;block-reward&quot;&gt;Block Reward&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_END_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ENDING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; STARTING_REWARD&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; REWARD_DELTA&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_DURATION&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TRANSITION_START_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;2 years was chosen because it gives miners sufficient time to find alternative uses for their hardware and&#x2F;or get their hardware back out onto the open market (e.g., in the form of gaming GPUs) without flooding the market suddenly. This proposal should ONLY be considered as a last resort as something we have in our pocket should the &quot;network need to attract hashing power quickly and then bleed it off over time&quot; rather than &quot;something that is scheduled to be included in X hard fork&quot; ; Recommendation to have in a fast track state, but NOT deployed to mainnet unless needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit account nonce to 2^52</title>
        <published>2021-03-07T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3338/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2681-limit-account-nonce-to-2-64-1/4324" />
        

        <id>https://wg-eips.ritovision.com/3338/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3338"
            label="EIP-3338" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3338/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Limit account nonce to be between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2^52&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Account nonces are currently specified to be arbitrarily long unsigned integers. Dealing with arbitrary length data in the state witnesses is not optimal, therefore this EIP will allow proofs to represent the nonce in a more optimized way.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it could prove beneficial to transaction formats, where some improvements are potentially sought by at least three other proposals.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, this facilitates a minor optimisation in clients, because the nonce no longer needs to be kept as a 256-bit number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt; introduce two new restrictions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Consider any transaction invalid, where the nonce exceeds &lt;code&gt;2^52&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CREATE&lt;&#x2F;code&gt; instruction to abort with an exceptional halt, where the account nonce is &lt;code&gt;2^52&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It is unlikely for any nonce to reach or exceed the proposed limit. If one would want to reach that limit via external transactions, it would cost at least &lt;code&gt;21000 * (2^64-1) = 387_381_625_547_900_583_915_000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It must be noted that in the past, in the Morden testnet, each new account had a starting nonce of &lt;code&gt;2^20&lt;&#x2F;code&gt; in order to differentiate transactions from mainnet transactions.
This mode of replay protection is out of fashion since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; introduced a more elegant way using chain identifiers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Most clients already consider the nonce field to be 64-bit, such as go-ethereum.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;All integer values &amp;lt;= 2^52 can be encoded in a 64-bit floating point without any loss of precision, making this value easy to work with in languages that only have floating point number support.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While this is a breaking change, no actual effect should be visible:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;There is no account in the state currently which would have a nonce exceeding that value. As of November 2020, the account &lt;code&gt;0xea674fdde714fd979de3edf0f56aa9716b898ec8&lt;&#x2F;code&gt; is responsible for the highest account nonce at approximately 29 million.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Paged memory allocation for the EVM</title>
        <published>2021-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3336/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eips-3336-and-3337-improving-the-evms-memory-model/5482" />
        

        <id>https://wg-eips.ritovision.com/3336/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3336"
            label="EIP-3336" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3336/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Changes the memory model for the EVM to use pagination.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Presently, the EVM charges for memory as a linear array starting at address 0 and extending to the highest address that has been read from or written to. This suffices for simple uses, but means that compilers have to generate programs that use memory compactly, which leads to wasted gas with reallocation of memory elements, and makes some memory models such as separate heap and stack areas impractical. This EIP proposes changing to a page-based billing model, which adds minimal complexity to implementations, while providing for much more versatility in EVM programs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Most modern computers implement &quot;virtual memory&quot; for userspace programs, where programs have access to a large address space, with pages of RAM that are allocated as needed by the OS. This allows them to distribute data throughout memory in ways that minimises the amount of reallocation and copying that needs to go on, and permits flexible use of memory for data with different lifetimes. Implementing a simple version of paged memory inside the EVM will provide the same flexibility to compilers targeting the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PAGE_BITS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PAGE_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;96&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-memory-allocation-in-evm-implementations&quot;&gt;Changes to memory allocation in EVM implementations&lt;&#x2F;h3&gt;
&lt;p&gt;Memory is now allocated in pages of &lt;code&gt;2**PAGE_BITS&lt;&#x2F;code&gt; bytes each. The most significant &lt;code&gt;256 - PAGE_BITS&lt;&#x2F;code&gt; bits of each memory address denote the page number, while the least significant &lt;code&gt;PAGE_BITS&lt;&#x2F;code&gt; bits of the memory address denote the location in the page. Pages are initialized to contain all zero bytes and allocated when the first byte from a page is read or written.&lt;&#x2F;p&gt;
&lt;p&gt;EVM implementations are encouraged to store the pagetable as an associative array (eg, hashtable or dict) mapping from page number to an array of bytes for the page.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-memory-expansion-gas-cost&quot;&gt;Changes to memory expansion gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;Presently, the total cost to extend the memory to &lt;code&gt;a&lt;&#x2F;code&gt; words long is &lt;code&gt;Cmem(a) = 3 * a + floor(a ** 2 &#x2F; 512)&lt;&#x2F;code&gt;. If the memory is already &lt;code&gt;b&lt;&#x2F;code&gt; words long, the incremental cost is &lt;code&gt;Cmem(a) - Cmem(b)&lt;&#x2F;code&gt;. &lt;code&gt;a&lt;&#x2F;code&gt; is the number of words required to cover the range from memory address 0 to the last word that has been read or written by the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;Under this EIP, we define a new memory cost function, based on the number of allocated pages. This function is &lt;code&gt;Cmem&#x27;(p) = max(PAGE_BASE_COST * (p - 1) + floor(2 * (p - 1) ** 2), 0)&lt;&#x2F;code&gt;. As above, if the memory already contains &lt;code&gt;q&lt;&#x2F;code&gt; pages, the incremental cost is &lt;code&gt;Cmem&#x27;(p) - Cmem&#x27;(q)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-mload-and-mstore&quot;&gt;Changes to &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Loading a word from memory or storing a word to memory requires instantiating any pages that it touches that do not already exist, with the resulting gas cost as described above. If the word being loaded or stored resides in a single page, the gas cost remains unchanged at 3 gas. If the word being loaded spans two pages, the cost is 6 gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-other-memory-touching-opcodes&quot;&gt;Changes to other memory-touching opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;, &lt;code&gt;CODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;MSTORE8&lt;&#x2F;code&gt; and any other opcodes that read or write memory are modified as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any page they touch for reading or writing is instantiated if it is not already.&lt;&#x2F;li&gt;
&lt;li&gt;Memory expansion gas is charged as described above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;memory-expansion-gas-cost&quot;&gt;Memory expansion gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The new gas cost follows the same curve as the previous one, while ensuring that the new gas cost is always less than or equal to the previous cost. This prevents existing programs that make assumptions about memory allocation gas costs from resulting in errors, without unduly discounting memory below what it costs today. Intuitively, a program that uses up to a page boundary pays for one page less than they would under the old model, while a program that uses one word more than a page boundary pays for one word less than they would under the old model.&lt;&#x2F;p&gt;
&lt;p&gt;We believe that this incremental reduction will not have a significant impact on the effective gas limit, as it gets proportionally smaller as programs use more RAM.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-cost-for-mloads-and-mstores-spanning-two-pages&quot;&gt;Additional cost for MLOADs and MSTOREs spanning two pages&lt;&#x2F;h3&gt;
&lt;p&gt;Loading or storing data spanning two memory pages requires more work from the EVM implementation, which must split the word at the page boundary and update the two (possibly disjoint) pages. Since we cannot guarantee loads and stores in existing EVM programs are page-aligned, we cannot prohibit this behaviour for efficiency. Instead, we propose treating each as two loads or stores for gas accounting purposes. This discourages the use of this functionality, and accounts for the additional execution cost, without prohibiting it outright.&lt;&#x2F;p&gt;
&lt;p&gt;This will result in additional gas costs for any programs that perform these operations. We believe this to be minimal, and hope to do future analysis to confirm this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new function for memory expansion gas cost is designed specifically to avoid backwards compatibility issues by always charging less than or equal to the amount the current EVM would charge. Under some circumstances existing programs will be charged more for MLOADs and MSTOREs that span page boundaries as described above; we believe these changes will affect a minimum of programs and have only a small impact on their gas consumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Potential CPU DoS issues arising from additional work done under the new model are alleviated by charging more for non-page-aligned reads and writes. Charges for memory expansion asymptotically approach those currently in force, so this change will not permit programs to allocate substantially more memory than they can today.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Frame pointer support for memory load and store operations</title>
        <published>2021-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3337/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eips-3336-and-3337-improving-the-evms-memory-model/5482" />
        

        <id>https://wg-eips.ritovision.com/3337/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3337"
            label="EIP-3337" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3337/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces four new opcodes for loading data from and storing data to memory offset by a frame pointer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces four new opcodes, &lt;code&gt;MLOADFP&lt;&#x2F;code&gt;, &lt;code&gt;MSTOREFP&lt;&#x2F;code&gt;, &lt;code&gt;GETFP&lt;&#x2F;code&gt; and &lt;code&gt;SETFP&lt;&#x2F;code&gt; that allow for more efficient memory access offset by a user-controlled quantity called the &quot;frame pointer&quot;. This permits compilers to more efficiently offload ephemeral data such as local variables to memory instead of the EVM&#x27;s evaluation stack, which has a number of benefits, including the effective elimination of restrictions on the number of local variables in a function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In most commonly used VMs, ephemeral data such as local variables, function arguments, and return addresses is stored in a region of memory called the stack. In contrast to the EVM&#x27;s evaluation stack, this area of memory is randomly accessible, and thus can store an arbitrary amount of data, which can be referenced from anywhere they remain in scope. Although this model is possible in the current EVM design, it is made difficult by the linear model of memory (addressed in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3336&#x2F;&quot;&gt;EIP-3336&lt;&#x2F;a&gt;) and by the lack of opcodes for relative memory access commonly found in other architectures. This EIP proposes new opcodes that permit this form of memory use, without imposing undue burden on EVM implementers or on runtime efficiency.&lt;&#x2F;p&gt;
&lt;p&gt;In the current EVM model, a compiler wishing to use this pattern would have to store the frame pointer - which points to the start or end of the current memory stack frame - in memory, and load it each time they wish to reference it. For example, loading a value from memory offset by the frame pointer would require the following sequence of operations:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSHn x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSH1 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ADD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This consumes a total of 15 gas, and takes up at least 7 bytes of bytecode each time it is referenced. In contrast, after this EIP, the equivalent sequence of operations is:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSH1 x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOADFP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This consumes only 6 gas, and takes at least 3 bytes of bytecode. The effort required from the EVM implementation is equivalent, costing only one extra addition operation over a regular &lt;code&gt;MLOAD&lt;&#x2F;code&gt;. The alternative of storing values on the stack, which requires 3 gas and 1 byte of bytecode for a &lt;code&gt;DUPn&lt;&#x2F;code&gt; operation, but it is now at most twice as efficient rather than 5 times as efficient, making storing values in memory a viable alternative.&lt;&#x2F;p&gt;
&lt;p&gt;Likewise, before this EIP a frame-pointer relative store requires the following sequence of operations:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSHn x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSH1 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MLOAD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ADD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MSTORE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This consumes 15 gas and at least 7 bytes of bytecode. After this EIP, the equivalent sequence of operations is:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Gas used&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PUSHn x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MSTOREFP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consuming only 6 gas and at least 3 bytes of bytecode, while once again only requiring EVM implementations to do one extra addition operation. The alternative of storing values on the stack requires 6 gas and 2 bytes of bytecode for the sequence &lt;code&gt;SWAPn POP&lt;&#x2F;code&gt;, making it no more efficient than memory storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;frame-pointer&quot;&gt;Frame pointer&lt;&#x2F;h3&gt;
&lt;p&gt;A new EVM internal state variable called the &quot;frame pointer&quot; is introduced. This is a signed integer that starts at 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;setfp-opcode&quot;&gt;&lt;code&gt;SETFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode, &lt;code&gt;SETFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5c&lt;&#x2F;code&gt;. This opcode costs &lt;code&gt;G_low&lt;&#x2F;code&gt; (3 gas) and takes one argument from the stack. The argument is stored as the new value of the frame pointer.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;getfp-opcode&quot;&gt;&lt;code&gt;GETFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode, &lt;code&gt;GETFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5d&lt;&#x2F;code&gt;. This opcode costs &lt;code&gt;G_low&lt;&#x2F;code&gt; (3 gas) and takes no arguments. It takes the current value of the frame pointer and pushes it to the stack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mloadfp-opcode&quot;&gt;&lt;code&gt;MLOADFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;MLOADFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5e&lt;&#x2F;code&gt;. This opcode acts in all ways identical to &lt;code&gt;MLOAD&lt;&#x2F;code&gt;, except that the value of the frame pointer is added to the address before loading data from memory. An attempt to load data from a negative address should be treated identically to an invalid opcode, consuming all gas and reverting the current execution context.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mstorefp-opcode&quot;&gt;&lt;code&gt;MSTOREFP&lt;&#x2F;code&gt; opcode&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;MSTOREFP&lt;&#x2F;code&gt; is introduced with value &lt;code&gt;0x5f&lt;&#x2F;code&gt;. This opcode acts in all ways identical to &lt;code&gt;MSTORE&lt;&#x2F;code&gt;, except that the value of the frame pointer is added to the address before storing data to memory. An attempt to store data to a negative address should be treated identically to an invalid opcode, consuming all gas and reverting the current execution context.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;cost-of-new-opcodes&quot;&gt;Cost of new opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;The cost of the new opcodes &lt;code&gt;MLOADFP&lt;&#x2F;code&gt; and &lt;code&gt;MSTOREFP&lt;&#x2F;code&gt; reflects the cost of &lt;code&gt;MLOAD&lt;&#x2F;code&gt; and &lt;code&gt;MSTORE&lt;&#x2F;code&gt;. They are generally equivalent in cost with the exception of an extra addition operation, which imposes negligible cost.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the new opcodes &lt;code&gt;SETFP&lt;&#x2F;code&gt; and &lt;code&gt;GETFP&lt;&#x2F;code&gt; is based on other common low-cost opcodes such as &lt;code&gt;PUSH&lt;&#x2F;code&gt; and &lt;code&gt;POP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;absence-of-mstore8fp&quot;&gt;Absence of &lt;code&gt;MSTORE8FP&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;MSTORE8FP&lt;&#x2F;code&gt; opcode was not included because it is expected that it would be used infrequently, and there is a desire to minimise the size of the instruction set and to conserve opcodes for future use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP exclusively introduces new opcodes, and as a result should not impact any existing programs unless they operate under the assumption that these opcodes are undefined, which we believe will not be the case.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;DoS risks are mitigated by correct pricing of opcodes to reflect current execution costs. No other security considerations pertain to this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MEDGASPRICE Opcode</title>
        <published>2021-03-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Justice Hudson</name><uri>https://github.com/jchancehud</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3332/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/medgasprice-opcode-eip/5480" />
        

        <id>https://wg-eips.ritovision.com/3332/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3332"
            label="EIP-3332" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3332/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An opcode for getting the median gas price of the parent block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt; opcode that returns the median gas price for the parent block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the emergence of rollups as core mechanisms in scaling Ethereum there are a number of common transactions that can be front-run. Optimistic rollups rely on the submission of fraud proofs to maintain the integrity of their systems. As a result actors submitting fraud proofs typically receive a financial reward for doing so. This opens a trivial front-running strategy of watching the mempool for fraud proof submissions and copying such transactions with a much higher gas price to reap the reward. Such front-runners do not perform validation independently and de-incentivize others from performing validation. Adding a mechanism enforcing an upper bound on gas prices for a transaction could be an effective defense against such front-running attacks.&lt;&#x2F;p&gt;
&lt;p&gt;Consider a smart contract that wants to implement a first come first serve mechanism. Such a mechanism must defeat the inherently pay-to-win nature of the gas price market. Enforcing a maximum gas price for a transaction relies on the fact that transactions of the same gas price are generally processed in a first in first out way by Ethereum miners. A contract currently has few options for setting a max gas price:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set a constant value at a reasonable rate given the current gas prices&lt;&#x2F;li&gt;
&lt;li&gt;Allow an individual or group of individuals to adjust a max gas price over time&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;More elaborate schemes could likely be constructed but all would involve storing gas price information on chain increasing the number of transactions and costing Ether.&lt;&#x2F;p&gt;
&lt;p&gt;Given a median gas price opcode a contract can set a maximum gas price as a function of the last blocks gas price. This can easily be implemented using a strategy such as the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; Assume that block.medgasprice is bound to MEDGASPRICE (0x46)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function submitFraudProof(bytes calldata proof) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  require(tx.gasprice &amp;lt;= maxGasPrice());&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  &#x2F;&#x2F; process the fraud proof and provide a reward (if valid)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function maxGasPrice() public view returns (uint) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return 3 * block.medgasprice;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Given the contract implementation above a client would simply call &lt;code&gt;maxGasPrice&lt;&#x2F;code&gt; to determine the gas price to use when submitting a fraud proof. This particular implementation allows up to 3x the median gas price of the last block to be used.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;forwards-compatibility&quot;&gt;Forwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-1559&quot;&gt;EIP-1559&lt;&#x2F;a&gt; plans to change the fee market in a number of ways. Most notably is the creation of a base fee that is burned. In this context an &quot;inclusion fee&quot; still exists as a part of the total fee. Consider the following two cases:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-sizes-are-increasing-all-available-gas-is-being-consumed&quot;&gt;Block sizes are increasing (all available gas is being consumed)&lt;&#x2F;h4&gt;
&lt;p&gt;In this case there will be bidding contention in the inclusion fee to incentivize miners to include transactions. A median gas price operator would still be helpful as an attacker could supply a high inclusion fee to bump honest transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-sizes-are-decreasing-excess-gas-is-available&quot;&gt;Block sizes are decreasing (excess gas is available)&lt;&#x2F;h4&gt;
&lt;p&gt;In this case an attacker could specify a high inclusion fee to incentivize miners to include their transaction early in the block. Miners are incentivized to do so as including expensive transactions first reduces the risk of a revert (and partial refund) occurring.&lt;&#x2F;p&gt;
&lt;p&gt;Given these two cases this EIP seems relevant in the context of EIP-1559.&lt;&#x2F;p&gt;
&lt;p&gt;Post EIP-1559 &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt; should return the median &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; of the previous block.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-3198&quot;&gt;EIP-3198&lt;&#x2F;a&gt; is required for the above strategies to be implemented. With the inclusion of &lt;code&gt;BASEFEE (0x48)&lt;&#x2F;code&gt; a contract can subtract the &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; from the &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; to determine the inclusion fee per gas being paid for the transaction and thus implement an upper bound.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= TBD&lt;&#x2F;code&gt;, add a new opcode &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the median gas price of the parent block onto the stack.&lt;&#x2F;p&gt;
&lt;p&gt;|  Op  	| Input 	| Output 	| Cost 	|
|:----:	|:-----:	|:------:	|:----:	|
| 0x46 	|   0   	|    1   	|   8  	|&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Having access to the current gas price economy allows contracts to implement more robust and automated logic surrounding acceptable transaction gas prices.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;naming-note&quot;&gt;Naming note&lt;&#x2F;h3&gt;
&lt;p&gt;The name &lt;code&gt;MEDGASPRICE&lt;&#x2F;code&gt; was chosen because the median gas price of the network can only be calculated from the latest complete block. Thus transactions being executed should expect the median gas price to be calculated from the previous block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backwards incompabitility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The strategy described for preventing front-running by setting an upper bound on the gas price of transactions has a few caveats:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;It relies on miners being impartial. Reordering transactions with the same gas price is a trivial means of defeating this strategy.&lt;&#x2F;li&gt;
&lt;li&gt;The value returned by &lt;code&gt;MEDGASPRICE (0x46)&lt;&#x2F;code&gt; may fluctuate rapidly between blocks. If a transaction is not included immediately it may either fail (if the gas price drops) or become vulnerable to front-running (if the gas price increases).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Removal of refunds</title>
        <published>2021-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3298/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3298-removal-of-refunds/5430" />
        

        <id>https://wg-eips.ritovision.com/3298/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3298"
            label="EIP-3298" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3298/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Remove gas refunds for SSTORE and SELFDESTRUCT.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Gas refunds for SSTORE and SELFDESTRUCT were originally introduced to motivate application developers to write applications that practice &quot;good state hygiene&quot;, clearing storage slots and contracts that are no longer needed. However, they are not widely used for this, and poor state hygiene continues to be the norm. It is now widely accepted that the only solution to state growth is some form of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;@HWeNw8hNRimMm2m2GH56Cw&#x2F;state_size_management&quot;&gt;statelessness or state expiry&lt;&#x2F;a&gt;, and if such a solution is implemented, then disused storage slots and contracts would start to be ignored automatically.&lt;&#x2F;p&gt;
&lt;p&gt;Gas refunds additionally have multiple harmful consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Refunds give rise to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gastoken.io&#x2F;&quot;&gt;GasToken&lt;&#x2F;a&gt;. GasToken has benefits in moving gas space from low-fee periods to high-fee periods, but it also has downsides to the network, particularly in exacerbating state size (as state slots are effectively used as a &quot;battery&quot; to save up gas) and inefficiently clogging blockchain gas usage&lt;&#x2F;li&gt;
&lt;li&gt;Refunds increase block size variance. The theoretical maximum amount of actual gas consumed in a block is nearly twice the on-paper gas limit (as refunds add gas space for subsequent transactions in a block, though refunds are capped at 50% of a transaction&#x27;s gas used). This is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;@vbuterin&#x2F;eip_1559_spikes&quot;&gt;not fatal&lt;&#x2F;a&gt;, but is still undesirable, especially given that refunds can be used to maintain 2x usage spikes for far longer than EIP 1559 can.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;p&gt;Do not apply the &lt;code&gt;refund&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The description above is sufficient to describe the change, but for the sake of clarity we enumerate all places where gas refunds are currently used and which should&#x2F;could be removed within a node implementation.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Remove all use of the &quot;refund counter&quot; in SSTORE gas accounting, as defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2200&quot;&gt;EIP 2200&lt;&#x2F;a&gt;. Particularly:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a storage slot is changed and the &lt;em&gt;current value&lt;&#x2F;em&gt; equals the &lt;em&gt;original value&lt;&#x2F;em&gt;, but does not equal the &lt;em&gt;new value&lt;&#x2F;em&gt;, &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; is deducted (plus &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; if &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2929#sstore-changes&quot;&gt;prescribed by EIP 2929 rules&lt;&#x2F;a&gt;), but no modifications to the refund counter are made.&lt;&#x2F;li&gt;
&lt;li&gt;If a storage slot is changed and the &lt;em&gt;current value&lt;&#x2F;em&gt; equals neither the &lt;em&gt;new value&lt;&#x2F;em&gt; nor the &lt;em&gt;original value&lt;&#x2F;em&gt; (regardless of whether or not the latter two are equal), &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is deducted (plus &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; if &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-2929#sstore-changes&quot;&gt;prescribed by EIP 2929 rules&lt;&#x2F;a&gt;), but no modifications to the refund counter are made.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Remove the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refund.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A full removal of refunds is the simplest way to solve the issues with refunds; any gains from partial retention of the refund mechanism are not worth the complexity that that would leave remaining in the Ethereum protocol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds are currently only applied &lt;em&gt;after&lt;&#x2F;em&gt; transaction execution, so they cannot affect how much gas is available to any particular call frame during execution. Hence, removing them will not break the ability of any code to execute, though it will render some applications economically nonviable.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gastoken.io&#x2F;&quot;&gt;GasToken&lt;&#x2F;a&gt; in particular will become valueless. DeFi arbitrage bots, which today frequently use either established GasToken schemes or a custom alternative to reduce on-chain costs, would benefit from rewriting their code to remove calls to these no-longer-functional gas storage mechanisms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An implementation can be found here: https:&#x2F;&#x2F;gist.github.com&#x2F;holiman&#x2F;460f952716a74eeb9ab358bb1836d821#gistcomment-3642048&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-case-changes&quot;&gt;Test case changes&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;The &quot;original&quot;, &quot;1st&quot;, &quot;2nd&quot;, &quot;3rd&quot; columns refer to the value of storage slot 0 before the execution and after each SSTORE.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;Berlin (cold)&quot; column gives the post-Berlin (EIP 2929) gas cost assuming the storage slot had not yet been accessed.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;Berlin (hot)&quot; column gives the post-Berlin gas cost assuming the storage slot has already been accessed.&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;Berlin (hot) + norefund&quot; column gives the post-Berlin gas cost assuming the storage slot has already been accessed, &lt;strong&gt;and assuming this EIP has been implemented&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Gas costs are provided with refunds subtracted; if the number is negative this means that refunds exceed gas costs. The 50% refund limit is not applied (due to the implied assumption that this code is only a small fragment of a much larger execution).&lt;&#x2F;p&gt;
&lt;p&gt;If refunds were to be removed, this would be the comparative table&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;th&gt;Istanbul&lt;&#x2F;th&gt;&lt;th&gt;Berlin (cold)&lt;&#x2F;th&gt;&lt;th&gt;Berlin (hot)&lt;&#x2F;th&gt;&lt;th&gt;Berlin (hot)+norefund&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;22212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;22212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;22212&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;td&gt;20112&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-9188&lt;&#x2F;td&gt;&lt;td&gt;-9888&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-9188&lt;&#x2F;td&gt;&lt;td&gt;-9888&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;-9188&lt;&#x2F;td&gt;&lt;td&gt;-9888&lt;&#x2F;td&gt;&lt;td&gt;-11988&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;5112&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;td&gt;3012&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;2312&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;td&gt;212&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;21618&lt;&#x2F;td&gt;&lt;td&gt;22318&lt;&#x2F;td&gt;&lt;td&gt;20218&lt;&#x2F;td&gt;&lt;td&gt;40118&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;-8382&lt;&#x2F;td&gt;&lt;td&gt;-9782&lt;&#x2F;td&gt;&lt;td&gt;-11882&lt;&#x2F;td&gt;&lt;td&gt;5918&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PUSH0 instruction</title>
        <published>2021-02-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Hugo De la cruz</name><uri>https://github.com/hugo-dc</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3855/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3855-push0-instruction/7014" />
        

        <id>https://wg-eips.ritovision.com/3855/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3855"
            label="EIP-3855" />
        

        
        

        
        <summary type="html">Introduce a new instruction which pushes the constant value 0 onto the stack</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3855/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce the &lt;code&gt;PUSH0&lt;&#x2F;code&gt; (&lt;code&gt;0x5f&lt;&#x2F;code&gt;) instruction, which pushes the constant value 0 onto the stack.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many instructions expect offsets as inputs, which in a number of cases are zero. A good example is the return data parameters of &lt;code&gt;CALLs&lt;&#x2F;code&gt;, which are set to zeroes in case the contract prefers using &lt;code&gt;RETURNDATA*&lt;&#x2F;code&gt;. This is only one example, but there are many other reasons why a contract would need to push a zero value. They can achieve that today by &lt;code&gt;PUSH1 0&lt;&#x2F;code&gt;, which costs 3 gas at runtime, and is encoded as two bytes which means &lt;code&gt;2 * 200&lt;&#x2F;code&gt; gas deployment cost.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the overall cost many try to use various other instructions to achieve the same effect. Common examples include &lt;code&gt;PC&lt;&#x2F;code&gt;, &lt;code&gt;MSIZE&lt;&#x2F;code&gt;, &lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt;, &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;, &lt;code&gt;CODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;CALLVALUE&lt;&#x2F;code&gt;, and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;. Some of these cost only 2 gas and are a single byte long, but their value can depend on the context.&lt;&#x2F;p&gt;
&lt;p&gt;We have conducted an analysis on Mainnet (block ranges 8,567,259…8,582,058 and 12,205,970…12,817,405), and ~11.5% of all the &lt;code&gt;PUSH*&lt;&#x2F;code&gt; instructions executed push a value of zero.&lt;&#x2F;p&gt;
&lt;p&gt;The main motivations for this change include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reducing contract code size.&lt;&#x2F;li&gt;
&lt;li&gt;Reducing the risk of contracts (mis)using various instructions as an optimisation measure. Repricing&#x2F;changing those instructions can be more risky.&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the need to use &lt;code&gt;DUP&lt;&#x2F;code&gt; instructions for duplicating zeroes.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;To put the &quot;waste&quot; into perspective, across existing accounts 340,557,331 bytes are wasted on &lt;code&gt;PUSH1 00&lt;&#x2F;code&gt; instructions, which means 68,111,466,200 gas was spent to deploy them. In practice a lot of these accounts share identical bytecode with others, so their total stored size in clients is lower, however the deploy time cost must have been paid nevertheless.&lt;&#x2F;p&gt;
&lt;p&gt;An example for 2) is changing the behaviour of &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; such that it may not be guaranteed to be zero at the beginning of the call frame.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The instruction &lt;code&gt;PUSH0&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x5f&lt;&#x2F;code&gt;. It has no immediate data, pops no items from the stack, and places a single item with the value 0 onto the stack. The cost of this instruction is 2 gas (aka &lt;code&gt;base&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;base&lt;&#x2F;code&gt; gas cost is used for instructions which place constant values onto the stack, such as &lt;code&gt;ADDRESS&lt;&#x2F;code&gt;, &lt;code&gt;ORIGIN&lt;&#x2F;code&gt;, and so forth.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opcode&quot;&gt;Opcode&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;0x5f&lt;&#x2F;code&gt; means it is in a &quot;contiguous&quot; space with the rest of the &lt;code&gt;PUSH&lt;&#x2F;code&gt; implementations and potentially could share the implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new opcode which did not exist previously. Already deployed contracts using this opcode could change their behaviour after this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;5F&lt;&#x2F;code&gt; -- successful execution, stack consist of a single item, set to zero&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;5F5F..5F&lt;&#x2F;code&gt; (1024 times) -- successful execution, stack consists of 1024 items, all set to zero&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;5F5F..5F&lt;&#x2F;code&gt; (1025 times) -- execution aborts due to out of stack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any impact on security. Note that jumpdest-analysis is unaffected, as &lt;code&gt;PUSH0&lt;&#x2F;code&gt; has no immediate data bytes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Giving Ethereum fees to Future Salaries</title>
        <published>2021-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Victor Porton</name><uri>https://github.com/vporton</uri>
	</author>
	
	<author>
		<name>Victor Porton</name><email>porton@narod.ru</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3267/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/discussion-of-eip-3267/5343" />
        

        <id>https://wg-eips.ritovision.com/3267/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3267"
            label="EIP-3267" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3267/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Transfer a part of Ethereum transfer&#x2F;mining fees to Future Salaries contract&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Transfer a part (exact fractions - TBD) of mining&#x2F;transfer fees + (probably: TBD) some minted ETH to the &lt;code&gt;DonateETH&lt;&#x2F;code&gt; contract configured to transfer to &lt;code&gt;SalaryWithDAO&lt;&#x2F;code&gt; contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal solves two problems at once:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It provides a big amount of &quot;money&quot; to common good producers. That obviously personally benefits common good producers, allowing them to live better human lives, it increases peoples&#x27; and organizations&#x27; both abilities and incentives to produce common goods. That benefits the humanity as a whole and the Ethereum ecosystem in particular. See more in the discussion why it&#x27;s crucial.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;This would effectively decrease circulating ETH supply. The necessity to decrease the (circulating) ETH supply (by locking ETH in Future Salaries system for a long time) is a well-known important thing to be done.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Paradoxically, it will directly benefit miners&#x2F;validators, see the discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;(TBD)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;SalaryWithDAO&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (&lt;code&gt;address&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DefaultDAOInterface&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (&lt;code&gt;address&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MintPerPeriod&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (&lt;code&gt;uint256&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TransferFraction&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (0..1)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MineFraction&lt;&#x2F;code&gt; = &lt;code&gt;TBD&lt;&#x2F;code&gt; (0..1)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3267&#x2F;assets&#x2F;contracts&#x2F;README&#x2F;&quot;&gt;The contract&#x27;s source&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Prior to &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;SalaryWithDAO&lt;&#x2F;code&gt; and &lt;code&gt;DefaultDAOInterface&lt;&#x2F;code&gt; contracts will be deployed to the network and exist at the above specified addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Change the Ethereum clients to transfer at every ETH transfer and every ETH mine a fixed fraction &lt;code&gt;TransferFraction&lt;&#x2F;code&gt; of the transferred ETH and &lt;code&gt;MineFraction&lt;&#x2F;code&gt; of the mined ETH to a fixed account (decide the account number, it can be for example &lt;code&gt;0x00000000000000000000000000000000000000001&lt;&#x2F;code&gt; or even &lt;code&gt;0x00000000000000000000000000000000000000000&lt;&#x2F;code&gt; or a random account).&lt;&#x2F;p&gt;
&lt;p&gt;Change the Ethereum clients to mint &lt;code&gt;MintPerPeriod&lt;&#x2F;code&gt; ETH to the contract &lt;code&gt;DonateETH&lt;&#x2F;code&gt; every some time (e.g. the first transaction of the first block every UTC day - TBD how often).&lt;&#x2F;p&gt;
&lt;p&gt;Change the Ethereum clients to every some time (e.g. the second transaction of the first block every UTC day - TBD how often) transfer the entire ETH from this account to the contract &lt;code&gt;DonateETH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Because this EIP solves a similar problem, cancel any other EIPs that burn ETH (except gas fees) during transfers or mining. (TBD: We should transfer more ETH in this EIP than we burned accordingly older accepted EIPs, because this EIP has the additional advantages of: 1. funding common goods; 2. better aligning values of ETH and values of tokens).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The Future Salaries is the &lt;em&gt;only&lt;&#x2F;em&gt; known system of distributing significant funds to common good producers. (Quadratic funding aimed to do a similar thing, but in practice as we see on GitCoin it favors a few developers, ignores project of highly advanced scientific research that is hard to explain to an average developer, and encourages colluding, and it just highly random due to small number of donors. Also quadratic funding simply does not gather enough funds to cover common good needs). So this EIP is the only known way to recover the economy.&lt;&#x2F;p&gt;
&lt;p&gt;The economical model of Future Salaries is described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3267&#x2F;.&#x2F;assets&#x2F;science-salaries.pdf&quot;&gt;this research article preprint&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Funding multiple oracles with different finish time would alleviate the future trouble that the circulating ETH (or other tokens) supply would suddenly increase when the oracle finishes. It would effectively exclude some ETH from the circulation forever.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Because transferring to the aforementioned account is neither mining nor a transaction, we get a new kinds of ETH transfers, so there may be some (expected moderate impact) troubles with applications that have made assumptions about ETH transfers all occurring either as miner payments or transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The DAO that controls account restoration may switch to a non-effective or biased way of voting (for example to being controlled by one human) thus distributing funds unfairly. This problem could be solved by a future fork of Ethereum that would &quot;confiscate&quot; control from the DAO.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;See more in the discussion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>MCOPY - Memory copying instruction</title>
        <published>2021-02-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paul Dworzanski</name><uri>https://github.com/poemm</uri>
	</author>
	
	<author>
		<name>Jared Wasinger</name><uri>https://github.com/jwasinger</uri>
	</author>
	
	<author>
		<name>Casey Detrio</name><uri>https://github.com/cdetrio</uri>
	</author>
	
	<author>
		<name>Pawel Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5656/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-5656-mcopy-instruction/10890" />
        

        <id>https://wg-eips.ritovision.com/5656/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:5656"
            label="EIP-5656" />
        

        
        

        
        <summary type="html">An efficient EVM instruction for copying memory areas</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5656/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Provide an efficient EVM instruction for copying memory areas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Memory copying is a basic operation, yet implementing it on the EVM comes with overhead.&lt;&#x2F;p&gt;
&lt;p&gt;This was recognised and alleviated early on with the introduction of the &quot;identity&quot; precompile, which accomplishes
memory copying by the use of &lt;code&gt;CALL&lt;&#x2F;code&gt;&#x27;s input and output memory offsets. Its cost is &lt;code&gt;15 + 3 * (length &#x2F; 32)&lt;&#x2F;code&gt; gas, plus
the call overhead. The identity precompile was rendered ineffective by the raise of the cost of &lt;code&gt;CALL&lt;&#x2F;code&gt; to 700, but subsequently
the reduction by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; made it slightly more economical.&lt;&#x2F;p&gt;
&lt;p&gt;Copying exact words can be accomplished with &lt;code&gt;&amp;lt;offset&amp;gt; MLOAD &amp;lt;offset&amp;gt; MSTORE&lt;&#x2F;code&gt; or &lt;code&gt;&amp;lt;offset&amp;gt; DUP1 MLOAD DUP2 MSTORE&lt;&#x2F;code&gt;,
at a cost of at least 12 gas per word. This is fairly efficient if the offsets are known upfront and the copying can be unrolled.
In case copying is implemented at runtime with arbitrary starting offsets, besides the control flow overhead, the offset
will need to be incremented using &lt;code&gt;32 ADD&lt;&#x2F;code&gt;, adding at least 6 gas per word.&lt;&#x2F;p&gt;
&lt;p&gt;Copying non-exact words is more tricky, as for the last partial word, both the source and destination needs to be loaded,
masked, or&#x27;d, and stored again. This overhead is significant. One edge case is if the last &quot;partial word&quot; is a single byte,
it can be efficiently stored using &lt;code&gt;MSTORE8&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As example use case, copying 256 bytes costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;at least 757 gas pre-EIP-2929 using the identity precompile&lt;&#x2F;li&gt;
&lt;li&gt;at least 157 gas post-EIP-2929 using the identity precompile&lt;&#x2F;li&gt;
&lt;li&gt;at least 96 gas using unrolled &lt;code&gt;MLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;MSTORE&lt;&#x2F;code&gt; instructions&lt;&#x2F;li&gt;
&lt;li&gt;27 gas using this EIP&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;According to an analysis of blocks 10537502 to 10538702, roughly 10.5% of memory copies would have had improved performance with the
availability of an &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Memory copying is used by languages like Solidity and Vyper, where we expect this improvement to provide efficient means of building
data structures, including efficient sliced access and copies of memory objects. Having a dedicated &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction would also add
forward protection against future gas cost changes to &lt;code&gt;CALL&lt;&#x2F;code&gt; instructions in general.&lt;&#x2F;p&gt;
&lt;p&gt;Having a special &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction makes the job of static analyzers and optimizers easier, since the effects of a &lt;code&gt;CALL&lt;&#x2F;code&gt; in general
have to be fenced, whereas an &lt;code&gt;MCOPY&lt;&#x2F;code&gt; instruction would be known to only have memory effects. Even if special cases are added
for precompiles, a future hard fork could change &lt;code&gt;CALL&lt;&#x2F;code&gt; effects, and so any analysis of code using the identity precompile would only
be valid for a certain range of blocks.&lt;&#x2F;p&gt;
&lt;p&gt;Finally, we expect memory copying to be immensely useful for various computationally heavy operations, such as EVM384,
where it is identified as a significant overhead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The instruction &lt;code&gt;MCOPY&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x5E&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;input-stack&quot;&gt;Input stack&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;top - 0&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;dst&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;top - 1&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;src&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;top - 2&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This ordering matches the other copying instructions, i.e. &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;, &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Per yellow paper terminology, it should be considered part of the &lt;code&gt;W_copy&lt;&#x2F;code&gt; group of opcodes, and follow the gas calculation for &lt;code&gt;W_copy&lt;&#x2F;code&gt; in the yellow paper. While the calculation in the yellow paper should be considered the final word, for reference, as of time of this writing, that currently means its gas cost is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;words_copied = (length + 31) &#x2F;&#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;g_verylow    = 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;g_copy       = 3 * words_copied + memory_expansion_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost     = g_verylow + g_copy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;output-stack&quot;&gt;Output stack&lt;&#x2F;h3&gt;
&lt;p&gt;This instruction returns no stack items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;It copies &lt;code&gt;length&lt;&#x2F;code&gt; bytes from the offset pointed at &lt;code&gt;src&lt;&#x2F;code&gt; to the offset pointed at &lt;code&gt;dst&lt;&#x2F;code&gt; in memory.
Copying takes place as if an intermediate buffer was used, allowing the destination and source to overlap.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;length &amp;gt; 0&lt;&#x2F;code&gt; and (&lt;code&gt;src + length&lt;&#x2F;code&gt; or &lt;code&gt;dst + length&lt;&#x2F;code&gt;) is beyond the current memory length, the memory is extended with respective gas cost applied.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of this instruction mirrors that of other &lt;code&gt;Wcopy&lt;&#x2F;code&gt; instructions and is &lt;code&gt;Gverylow + Gcopy * ceil(length &#x2F; 32)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Production implementation of exact-word memory copying and partial-word memory copying can be found in the Solidity, Vyper and Fe compilers.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; the call overhead using the identity precompile was reduced from 700 to 100 gas.
This is still prohibitive for making the precompile a reasonable alternative again.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new instruction which did not exist previously. Already deployed contracts using this instruction could change their behaviour after this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;MCOPY 0 32 32&lt;&#x2F;code&gt; - copy 32 bytes from offset 32 to offset 0.&lt;&#x2F;p&gt;
&lt;p&gt;pre (spaces included for readability):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000000 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MCOPY 0 0 32&lt;&#x2F;code&gt; - copy 32 bytes from offset 0 to offset 0.&lt;&#x2F;p&gt;
&lt;p&gt;pre:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0101010101010101010101010101010101010101010101010101010101010101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0101010101010101010101010101010101010101010101010101010101010101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MCOPY 0 1 8&lt;&#x2F;code&gt; - copy 8 bytes from offset 1 to offset 0 (overlapping).&lt;&#x2F;p&gt;
&lt;p&gt;pre (space at byte 8):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0001020304050607 080000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0102030405060708 080000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MCOPY 1 0 8&lt;&#x2F;code&gt; - copy 8 bytes from offset 0 to offset 1 (overlapping).&lt;&#x2F;p&gt;
&lt;p&gt;pre (space at byte 8):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0001020304050607 080000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;post:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000010203040506 070000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gas used: 6&lt;&#x2F;p&gt;
&lt;h3 id=&quot;full-test-suite&quot;&gt;Full test suite&lt;&#x2F;h3&gt;
&lt;p&gt;A full suite of tests can be found in the execution spec tests: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;c0065176a79f89d93f4c326186fc257ec5b8d5f1&#x2F;tests&#x2F;cancun&#x2F;eip5656_mcopy&quot;&gt;MCOPY suite&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Clients should take care that their implementation does not use an intermediate buffer (see for instance that the C stdlib &lt;code&gt;memmove&lt;&#x2F;code&gt; function does not use an intermediate buffer), as this is a potential Denial of Service (DoS) vector. Most language builtins &#x2F; standard library functions for moving bytes have the correct performance characteristics here.&lt;&#x2F;p&gt;
&lt;p&gt;This aside, the analysis for Denial of Service (DoS) and memory exhaustion attacks is identical to other opcodes which touch memory, as the memory expansion follows the same pricing rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Difficulty Bomb Delay to Q2&#x2F;2022</title>
        <published>2021-01-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/q9f</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3238/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/3239" />
        

        <id>https://wg-eips.ritovision.com/3238/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3238"
            label="EIP-3238" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3238/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Delays the difficulty bomb so 30 second blocks won&#x27;t happen until around Q2&#x2F;2022.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting eleven million blocks later than the actual block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Even after the Ethereum 2.0 mainnet launch, Ethash proof-of-work mining on the legacy chain should be feasible. It should allow miners sealing new blocks every 13~15 seconds on average for another ten months and allow both Ethereum 1.x and Ethereum 2.0 developers to conclude the merge.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 11_000_000) if block.number &amp;gt;= FORK_BLOCK_NUMBER else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by another ~26 million seconds (approximately ~9.89 months), so the chain would be back at ~30 second block times in Q2&#x2F;2022. Hopefully, by then the Eth1-to-Eth2 merge will be concluded and the ice age fulfilled its task.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to consider this EIP either with or shortly after the Berlin hard-fork but not later than July 2021.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, in order to maintain stability of the system, a it can be considered to activate this EIP along with EIP-1559 fee market changes in a bundle. With the delay of the ice age, there is a desire to no further increase inflation and rather incentivize users to participate in proof-of-stake consensus instead.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues with this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BASEFEE opcode</title>
        <published>2021-01-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3198/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3198-basefeeopcode/5162" />
        

        <id>https://wg-eips.ritovision.com/3198/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3198"
            label="EIP-3198" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3198/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Adds an opcode that gives the EVM access to the block&#x27;s base fee.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BASEFEE (0x48)&lt;&#x2F;code&gt; that returns the value of the base fee of the current block it is executing in.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The intended use case would be for contracts to get the value of the base fee. This feature would enable or improve existing use cases, such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Contracts that need to set bounties for anyone to &quot;poke&quot; them with a transaction could set the bounty to be &lt;code&gt;BASEFEE + x&lt;&#x2F;code&gt;, or &lt;code&gt;BASEFEE * (1 + x)&lt;&#x2F;code&gt;. This makes the mechanism more reliable, because they will always pay &quot;enough&quot; regardless of market conditions.&lt;&#x2F;li&gt;
&lt;li&gt;Gas futures can be implemented based on it. This would be more precise than gastokens.&lt;&#x2F;li&gt;
&lt;li&gt;Improve the security for state channels, plasma, optirolls and other fraud proof driven solutions. Having the &lt;code&gt;BASEFEE&lt;&#x2F;code&gt; as an input allows you to lengthen the challenge period automatically if you see that the &lt;code&gt;BASEFEE&lt;&#x2F;code&gt; is high.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;BASEFEE&lt;&#x2F;code&gt; opcode at &lt;code&gt;(0x48)&lt;&#x2F;code&gt;, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;|  Op  	| Input 	| Output 	| Cost 	|
|:----:	|:-----:	|:------:	|:----:	|
| 0x48 	|   0   	|    1   	|   2  	|&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The value of the base fee is needed to process transactions. That means it&#x27;s value is already available before running the EVM code.
The opcode does not add extra complexity and additional read&#x2F;write operations, hence the choice of &lt;code&gt;G_base&lt;&#x2F;code&gt; gas cost.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with this opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;nominal-case&quot;&gt;Nominal case&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming current block base fee is &lt;code&gt;7 wei&lt;&#x2F;code&gt;.
This should push the value &lt;code&gt;7&lt;&#x2F;code&gt; (left padded byte32) to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x4800&lt;&#x2F;code&gt; (&lt;code&gt;BASEFEE, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;BASEFEE&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[7]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The value of the base fee is not sensitive and is publicly accessible in the block header. There are no known security implications with this opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase block rewards to 5 ETH</title>
        <published>2020-12-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Tinner</name><uri>https://github.com/Terra854</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3143/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3143-increase-block-rewards-to-5-eth/5061" />
        

        <id>https://wg-eips.ritovision.com/3143/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3143"
            label="EIP-3143" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3143/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Changes the block reward paid to proof-of-work (POW) miners to 5 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; block rewards will be increased to a base of 5 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the transaction fees (tx fees) portion of the mining rewards makes up a significant portion of the total rewards per block, at times almost exceeded the block reward of 2 ETH. This have resulted in situations where at times of low tx fees, POW miners decide to point their rigs away from ETH as they will always prefer to mine coins that are the most profitable at any point in time, reducing the security of the ETH network till transaction activity picks up again. By increasing the block rewards back to the original 5 ETH when the network first started, the voliatility will be reduced in terms of the percentage of tx fees that make up the mining rewards per block while increasing the total rewards per block, making it more financially attractive to POW miners to mine ETH barring any gigantic ETH price drops. The increase in block rewards will also allow smaller POW miners ample opporturnity to build up their stores of ETH so that when the time comes to fully transition to ETH 2.0, they may be more willing to become validators as they already have earned the requite amount of ETH needed to do so as opposed to having to spend tens of thousands of dollars to purchase the required ETH directly, increasing the number of validators in the network and therefore strengthening network security.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, the ultimate end goal for this EIP is to give POW miners more incentive to switch to POS once ETH 2.0 is fully implemented since the transition will take a few years to complete and during that time, they will be incentivised to hold on to the tokens instead of selling it straight away in order to prepare to be a validator for ETH 2.0, reducing the selling pressure on ETH and increasing it&#x27;s value in the long run. A side effect of miners staying on Ethereum is that network security will be assured during the transition period.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;Adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 5_000_000_000_000_000_000 if block.number &amp;gt;= FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(5E18 wei, or 5,000,000,000,000,000,000 wei, or 5 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A 5 ETH base reward was chosen as a middle ground between wanting to prevent too high of an inflation rate (10.4% per annum for the first year at 5 ETH per block) and converting as many POW miners as possible into POS validators by making it easier to amass the required ETH needed through POW mining.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known backward compatibility issues with the introduction of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are no known security issues presented by this change.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for BN256 HashToCurve Algorithms</title>
        <published>2020-10-23T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dr. Christopher Gorman</name><uri>https://github.com/chgormanMH</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3068/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/pre-compile-for-bls/3973" />
        

        <id>https://wg-eips.ritovision.com/3068/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3068"
            label="EIP-3068" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3068/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP defines a hash-to-curve precompile for use in BN256
and would allow for cheaper BLS signature verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There is currently no inexpensive way to perform BLS signature
verification for arbitrary messages.
This stems from the fact that there is no precompiled contract
in the EVM for a hash-to-curve algorithm for the BN256 elliptic curve.
The gas cost of calling a deterministic hash-to-curve algorithm
written in Solidity is approximately that of one pairing check,
although the latter requires an order of magnitude
more computation.
This EIP remedies this by implementing a hash-to-curve algorithm
for the BN256 G1 curve, which would reduce the cost of
signature verification to essentially that of the pairing check
precompiled contract.
We also include a hash-to-curve algorithm for the BN256 G2 group.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The precompiled contracts in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; and
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;
increased usage of cryptographic operations in the EVM
by reducing the gas costs.
In particular, the cost reduction from
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;
helps increase the use of SNARKs in Ethereum
via an elliptic curve pairing check;
however, a hash-to-curve algorithm enabling arbitrary
BLS signature verification on BN256 in the EVM was noticeably missing.
There is interest in having a precompiled contract which would allow
for signature verification, as noted
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;pre-compile-for-bls&#x2F;3973&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;At this time, we are able to perform addition, scalar multiplication,
and pairing checks in BN256.
Reducing these costs in
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;
made &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;PhilippSchindler&#x2F;ethdkg&quot;&gt;ETHDKG&lt;&#x2F;a&gt;,
a distributed key generation protocol in Ethereum,
less expensive.
ETHDKG by itself is useful; however, what it is lacking is
the ability to verify arbitrary BLS signatures.
Creating group signatures by aggregating partial signatures
is one goal of a DKG protocol.
The DKG enables the computation of partial signatures to be
combined into a group signature offline, but there is no
easy way to verify partial signatures or group signatures
in the EVM.&lt;&#x2F;p&gt;
&lt;p&gt;In order to perform BLS signature validation, a hash-to-curve
algorithm is required.
While the MapToGroup method initially discussed in the original BLS
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;weilsigs.pdf&quot;&gt;paper&lt;&#x2F;a&gt;
works in practice, the nondeterministic nature of the algorithm
leaves something to be desired as we would like to bound
the overall computational cost in the EVM.
A deterministic method for mapping to BN curves is given
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;latincrypt12.pdf&quot;&gt;here&lt;&#x2F;a&gt;;
in the paper, Fouque and Tibouchi proved their mapping
was indifferentiable from a random oracle.
This gives us the desired algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Here is the pseudocode for the &lt;code&gt;HashToG1&lt;&#x2F;code&gt; function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HashToG1(msg)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement0 = HashToBase(msg, 0x00, 0x01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement1 = HashToBase(msg, 0x02, 0x03)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    curveElement0 = BaseToG1(fieldElement0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    curveElement1 = BaseToG1(fieldElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    g1Element = ECAdd(curveElement0, curveElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return g1Element&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the pseudocode for &lt;code&gt;HashToBase&lt;&#x2F;code&gt;;
&lt;code&gt;msg&lt;&#x2F;code&gt; is the byte slice to be hashed while &lt;code&gt;dsp1&lt;&#x2F;code&gt; and &lt;code&gt;dsp2&lt;&#x2F;code&gt;
are domain separation parameters.
&lt;code&gt;fieldPrime&lt;&#x2F;code&gt; is the prime of the underlying field.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HashToBase(msg, dsp1, dsp2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashResult0 = uint256(Keccak256(dsp1||msg))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    hashResult1 = uint256(Keccak256(dsp2||msg))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant = 2^256 mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement0 = hashResult0*constant          mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement1 = hashResult1                   mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement  = fieldElement0 + fieldElement1 mod fieldPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return fieldElement&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the pseudocode for &lt;code&gt;BaseToG1&lt;&#x2F;code&gt;.
All of these operations are performed in the finite field.
&lt;code&gt;inverse&lt;&#x2F;code&gt; computes the multiplicative inverse in the underlying
finite field; we have the convention &lt;code&gt;inverse(0) == 0&lt;&#x2F;code&gt;.
&lt;code&gt;is_square(a)&lt;&#x2F;code&gt; computes the Legendre symbol of the element,
returning 1 if &lt;code&gt;a&lt;&#x2F;code&gt; is a square, -1 if &lt;code&gt;a&lt;&#x2F;code&gt; is not a square,
and 0 if &lt;code&gt;a&lt;&#x2F;code&gt; is 0.
&lt;code&gt;sqrt&lt;&#x2F;code&gt; computes the square root of the element in the finite
field; a square root is assumed to exist.
&lt;code&gt;sign0&lt;&#x2F;code&gt; returns the sign of the finite field element.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function BaseToG1(t)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # All operations are done in the finite field GF(fieldPrime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Here, the elliptic curve satisfies the equation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #       y^2 == g(x) == x^3 + curveB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant1 = (-1 + sqrt(-3))&#x2F;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant2 = -3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant3 = 1&#x2F;3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant4 = g(1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s = (constant4 + t^2)^3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    alpha = inverse(t^2*(constant4 + t^2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x1 = constant1 - constant2*t^4*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x2 = -1 - x1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x3 = 1 - constant3*s*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a1 = x1^3 + curveB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a2 = x2^3 + curveB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue1 = is_square(a1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue2 = is_square(a2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index = (residue1 - 1)*(residue2 - 3)&#x2F;4 + 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef1 = ConstantTimeEquality(1, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef2 = ConstantTimeEquality(2, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef3 = ConstantTimeEquality(3, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x = coef1*x1 + coef2*x2 + coef3*x3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y = sign0(t)*sqrt(x^3 + curveB)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (x, y)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function sign0(t)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if t &amp;lt;= (fieldPrime-1)&#x2F;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return fieldPrime-1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function ConstantTimeEquality(a, b)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # This function operates in constant time&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if a == b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In &lt;code&gt;HashToG2&lt;&#x2F;code&gt;, we first map to the underlying twist curve
and then clear the cofactor to map to G2.
Here is the pseudocode for &lt;code&gt;HashToG2&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function HashToG2(msg)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement00 = HashToBase(msg, 0x04, 0x05)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement01 = HashToBase(msg, 0x06, 0x07)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement10 = HashToBase(msg, 0x08, 0x09)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement11 = HashToBase(msg, 0x0a, 0x0b)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement0 = (fieldElement00, fieldElement01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fieldElement1 = (fieldElement10, fieldElement11)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    twistElement0 = BaseToTwist(fieldElement0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    twistElement1 = BaseToTwist(fieldElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    twistElement = ECAdd(twistElement0, twistElement1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    g2Element = ClearCofactor(twistElement)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return g2Element&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function ClearCofactor(twistElement)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return ECMul(twistElement, cofactor)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Here is the pseudocode for &lt;code&gt;BaseToTwist&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function BaseToTwist(t)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # All operations are done in the finite field GF(fieldPrime^2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    # Here, the twist curve satisfies the equation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    #       y^2 == g&amp;#39;(x) == x^3 + curveBPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant1 = (-1 + sqrt(-3))&#x2F;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant2 = -3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant3 = 1&#x2F;3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    constant4 = g&amp;#39;(1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s = (constant4 + t^2)^3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    alpha = inverse(t^2*(constant4 + t^2))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x1 = constant1 - constant2*t^4*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x2 = -1 - x1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x3 = 1 - constant3*s*alpha&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a1 = x1^3 + curveBPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a2 = x2^3 + curveBPrime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue1 = is_square(a1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    residue2 = is_square(a2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index = (residue1 - 1)*(residue2 - 3)&#x2F;4 + 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef1 = ConstantTimeEquality(1, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef2 = ConstantTimeEquality(2, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    coef3 = ConstantTimeEquality(3, index)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    x = coef1*x1 + coef2*x2 + coef3*x3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    y = sign0(t)*sqrt(x^3 + curveBPrime)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return (x, y)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;end function&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The BaseToG1 algorithm is based on the original Fouque and Tibouchi
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;latincrypt12.pdf&quot;&gt;paper&lt;&#x2F;a&gt;
with modifications based on Wahby and Boneh&#x27;s
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2019-403_BLS12_H2C.pdf&quot;&gt;paper&lt;&#x2F;a&gt;.
There is freedom in choosing the HashToBase function
and this could easily be changed.
Within HashToBase, the particular hashing algorithm
(Keccak256 in our case) could also be modified.
It may be desired to change the call to &lt;code&gt;sign0&lt;&#x2F;code&gt;
at the end of BaseToG1 and BaseToTwist with &lt;code&gt;is_square&lt;&#x2F;code&gt;,
as this would result in the same deterministic map to curve from the
Fouque and Tibouchi
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;latincrypt12.pdf&quot;&gt;paper&lt;&#x2F;a&gt;
and ensure HashToG1 is indifferentiable from a random oracle;
they proved this result in their paper.
It may be possible to show that switching the &lt;code&gt;is_square&lt;&#x2F;code&gt;
call with &lt;code&gt;sign0&lt;&#x2F;code&gt; does not affect indifferentiability,
although this has not been proven.&lt;&#x2F;p&gt;
&lt;p&gt;The HashToG2 algorithm follows from the Wahby and Boneh
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2019-403_BLS12_H2C.pdf&quot;&gt;paper&lt;&#x2F;a&gt;.
Algorithms for computing &lt;code&gt;inverse&lt;&#x2F;code&gt;, &lt;code&gt;is_square&lt;&#x2F;code&gt;, and &lt;code&gt;sqrt&lt;&#x2F;code&gt;
in finite field GF(fieldPrime^2) can be found
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2012-685_Square_Root_Even_Ext.pdf&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We now discuss the potential gas cost for the HashToG1
and HashToG2 operations.
On a local machine, ECMul was clocked at 68 microseconds
per operation.
The same machine clocked HashToG1 at 94 microseconds per operation
when hashing 32 bytes into G1 and 105 microseconds per operation
when hashing 1024 bytes into G1.
Given that it currently costs 6000 gas for ECMul, this gives us
an estimated gas cost for HashToG1 at &lt;code&gt;8500 + len(bytes)&lt;&#x2F;code&gt;.
Similarly, HashToG2 was clocked at 886 microseconds per operation
when hashing 32 bytes into G2 and 912 microseconds per operation when
hashing 1024 bytes into G2.
This allows us to estimate the gas cost at &lt;code&gt;80000 + 3*len(bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Due to recent &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2015-1027_exTNFS.pdf&quot;&gt;work&lt;&#x2F;a&gt;, the
128-bit security promised by the BN256 elliptic curve no longer applies;
this was mentioned in the Cloudflare BN256
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;cloudflare&#x2F;bn256&quot;&gt;library&lt;&#x2F;a&gt;.
There has been some discussion on the exact security decrease
from this advancement; see these
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2016-1102_Assessing_NFS_Advances.pdf&quot;&gt;two&lt;&#x2F;a&gt;
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;2017-334.pdf&quot;&gt;papers&lt;&#x2F;a&gt;
for different estimates.
The more conservative estimate puts the security of BN256 at
100-bits.
While this is likely still out of reach for many adversaries,
it should give us pause.
This reduced security was noted in the recent MadNet
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3068&#x2F;.&#x2F;assets&#x2F;madnet.pdf&quot;&gt;whitepaper&lt;&#x2F;a&gt;,
and this security concern was partially mitigated by
requiring Secp256k1 signatures of the partial group signatures
in order for those partial signatures to be valid.
Full disclosure: the author of this EIP works for MadHive,
assisted in the development of MadNet, and
helped write the MadNet whitepaper.&lt;&#x2F;p&gt;
&lt;p&gt;The security concerns of the BN256 elliptic curve
affect any operation using pairing check because it is
related to the elliptic curve pairing;
they are independent of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Crosschain Identifier Specification</title>
        <published>2020-10-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Weijia Zhang</name><uri>https://github.com/weijia31415</uri>
	</author>
	
	<author>
		<name>Peter Robinson</name><uri>https://github.com/drinkcoffee</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3220/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3220-crosschain-id-specification/5446" />
        

        <id>https://wg-eips.ritovision.com/3220/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3220"
            label="EIP-3220" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3220/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A self-verifying unique blockchain identifier that deals with forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The crosschain-id is a 32 byte hex string and with some bytes extracted from blockchain hash and some manually defined to characterize a blockchain.
We also propose a registration and lookup service to retrieve blockchain metadata from the crosschain-id.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the success of Bitcoin and Ethereum, various blockchains such as EOS, Ripple, Litecoin, Besu, Wanchain and the like have been developed and are growing at a fast pace.  There are also other private and consortium blockchains such as Hyperledger Fabric, Hyperledger Besu, Stellar, Corda, Quorum that only allow nodes with permitted identities to join the blockchain network.  The growth of public and private blockchains imposes challenges for inter-chain interoperability, particularly when these chains are heterogeneous and incompatible. Enterprise Ethereum Alliance formed Crosschain Interoperability Task Force (CITF) to look into common crosschain problems and solutions. CITF team noticed that there is a lack of unique identifier to charaterise and describe a blockchain. Several proprosals were discussed in EEA Crosschain Interoperability Task Force meetings and discussions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; provides a unique identifier to a blockchain to provide simple relay attack protection.  This specification defines an integer for Chainid for a blockchain and sign the chainid into a transaction data and hence present attackers to send same transaction to different blockchains. This specification will require blockchains to define a chainid and register the chainid in a public repository.&lt;&#x2F;p&gt;
&lt;p&gt;The challenge of using an integer for chainid is that it is not broad enough to cover all blockchains and it does not prevent different blockchains using the same chainid.  Also, it does not address the issue for two forked blockchains having the same chainid.&lt;&#x2F;p&gt;
&lt;p&gt;Hence there is need for a more robust blockchain identifier that will overcome these drawbacks, especially for crosschain operations where multiple chains are involved. A blockchain identifier (crosschain id) should be unique and satisfy the following requirements:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;should provide identification, description, and discovery of blockchains.&lt;&#x2F;li&gt;
&lt;li&gt;should provide unique identification of each blockchain in the crosschain service ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide descriptions for a blockchain identities such as chainId, name, type, consensus scheme etc.&lt;&#x2F;li&gt;
&lt;li&gt;should provide discovery mechanism for supported blockchains and also for new blockchains in the ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism for a joining blockchain to register to the ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism for a blockchain to edit properties or unregister from the crosschain ecosystem.&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism to get some critical information of the blockchain&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism to differentiate an original blockchain and a forked blockchain&lt;&#x2F;li&gt;
&lt;li&gt;should provide a mechanism to verify a chainid without external registration service&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definition-of-a-32-byte-crosschain-id&quot;&gt;Definition of a 32 byte crosschain id&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Size(bytes)&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Truncated Block Hash&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;This is the block hash of the genesis block or the block hash of the block immediate prior to the fork for a fork of a blockchain. The 16 bytes is the 16 least significant bytes, assuming network byte order.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Native Chain ID&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;This is the &lt;strong&gt;Chain Id&lt;&#x2F;strong&gt; value that should be used with the blockchain when signing transactions. For blockchains that do not have a concept of &lt;strong&gt;Chain Id&lt;&#x2F;strong&gt;, this value is zero.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Chain Type&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Reserve 0x00 as undefined chaintype. 0x01 as mainnet type. 0x1[0-A]: testnet, 0x2[0-A]: private development network&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Governance Identifier&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;For new blockchains, a governance_identifier can be specified to identify an original &lt;strong&gt;owner&lt;&#x2F;strong&gt; of a blockchain, to help settle forked &#x2F; main chain disputes. For all existing blockchains and for blockchains that do not have the concept of an &lt;strong&gt;owner&lt;&#x2F;strong&gt;, this field is zero.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Reserved&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Reserved for future use. Use 000000 for now.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Checksum&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Used to verify the integrity of the identifier. This integrity check is targeted at detecting Crosschain Identifiers mis-typed by human users. The value is calculated as the truncated SHA256 message digest of the rest of the identifier, using the least significant byte, assuming network byte order. Note that this checksum byte only detects integrity with a probability of one in 256. This probability is adequate for the intended usage of detecting typographical errors by people manually entering the Crosschain Identifier.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We have considered various alternative specifications such as using a random unique hex string to represent a blockchain.  The drawback of this method is that the random id can not be used to verify a blockchain&#x27;s intrinsic identity such as the blockhash of the genesis block.  A second alternative is simply using a genesis blockhash to represent a blockchain id for crosschain operations.  The drawback of this is that this id does not have information about the property of the blockchain and it has problem when a blockchain is forked into two blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Crosschainid can be backward compatible with EIP-155.  The crosschain id contains an 8 byte segment to record the &lt;code&gt;Native Chain ID&lt;&#x2F;code&gt;.
For Ethereum chains, that can be used for a value intended to be used with EIP-155.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Collision of crosschain id:  Two blockchains can contain the same crosschain id and hence making the mistakenly transfer assets to a wrong blockchain.&lt;br &#x2F;&gt;
This security concern is addressed by comparing the hash of the crosschain id with the hash of the genesis block.  If it matches, then the crosschain id is verified.  If not, the crosschain id can be compared with the forked blockhash.  If none of the blockhash match the crosschain id hash, then the crosschain id cannot be verified.&lt;&#x2F;p&gt;
&lt;p&gt;Preventing relay attack: Although crosschain id by itself is different from chainid and it is not signed into blockchain transaction, the crosschain id can still be used for presenting relay attack. An application that handles crosschain transaction can verified the crosschain id with its blockhash and decide whether the transaction is valid or not. Any transaction with a non-verifiable crosschain id should be rejected.&lt;&#x2F;p&gt;
&lt;p&gt;The crosschain-id are not required to be signed into blockchaid tx.
For blockchains that do not cryptographically sign crosschain id into the blocks, the crosschain id cannot be verified with the blocks itself and have to be verified with external smart contract address and offchain utilities implemented based on the crosschain id specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>AUTH and AUTHCALL opcodes</title>
        <published>2020-10-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/micahzoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3074/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3074-sponsored-transaction-precompile/4880" />
        

        <id>https://wg-eips.ritovision.com/3074/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:3074"
            label="EIP-3074" />
        

        
        

        
        <summary type="html">Allow externally owned accounts to delegate control to a contract.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3074/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces two EVM instructions &lt;code&gt;AUTH&lt;&#x2F;code&gt; and &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;. The first sets a context variable &lt;code&gt;authorized&lt;&#x2F;code&gt; based on an ECDSA signature. The second sends a call as the &lt;code&gt;authorized&lt;&#x2F;code&gt; account. This essentially delegates control of the externally owned account (EOA) to a smart contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Adding more functionality to EOAs has been a long-standing feature request. The requests have spanned from implementing batching capabilities, allowing for gas sponsoring, expirations, scripting, and beyond. These changes often mean increased complexity and rigidity of the protocol. In some cases, it also means increased attack surfaces.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP takes a different approach. Instead of enshrining these capabilities in the protocol as transaction validity requirements, it allows users to &lt;em&gt;delegate&lt;&#x2F;em&gt; control of their EOA to a contract. This gives developers a flexible framework for developing novel transaction schemes for EOAs. A motivating use case of this EIP is that it allows any EOA to act like a smart contract wallet &lt;em&gt;without&lt;&#x2F;em&gt; deploying a contract.&lt;&#x2F;p&gt;
&lt;p&gt;Although this EIP provides great benefit to individual users, the leading motivation for this EIP is &quot;sponsored transactions&quot;. This is where the fee for a transaction is provided by a different account than the one that originates the call.&lt;&#x2F;p&gt;
&lt;p&gt;With the extraordinary growth of tokens on Ethereum, it has become common for EOAs to hold valuable assets without holding any ether at all. Today, these assets must be converted to ether before they can be used to pay gas fees. However, without ether to pay for the conversion, it&#x27;s impossible to convert them. Sponsored transactions break the circular dependency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;top - N&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - the &lt;code&gt;N&lt;&#x2F;code&gt;th most recently pushed value on the EVM stack, where &lt;code&gt;top - 0&lt;&#x2F;code&gt; is the most recent.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;||&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; - byte concatenation operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;invalid execution&lt;&#x2F;strong&gt; - execution that is invalid and must exit the current execution frame immediately, consuming all remaining gas (in the same way as a stack underflow or invalid jump).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;MAGIC&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x04&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;&lt;code&gt;MAGIC&lt;&#x2F;code&gt; is used for &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;&quot;&gt;EIP-3074&lt;&#x2F;a&gt; signatures to prevent signature collisions with other signing formats.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;context-variables&quot;&gt;Context Variables&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Variable&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: left&quot;&gt;Initial Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;authorized&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;address&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: left&quot;&gt;unset&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The context variable &lt;code&gt;authorized&lt;&#x2F;code&gt; shall indicate the active account for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; instructions in the current frame of execution. If set, &lt;code&gt;authorized&lt;&#x2F;code&gt; shall only contain an account which has given the contract authorization to act on its behalf. An unset value shall indicate that no such account is set and that there is not yet an active account for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; instructions in the current frame of execution.&lt;&#x2F;p&gt;
&lt;p&gt;The variable has the same scope as the program counter -- &lt;code&gt;authorized&lt;&#x2F;code&gt; persists throughout a single frame of execution of the contract, but is not passed through any calls (including &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;). If the same contract is being executed in separate execution frames (ex. a &lt;code&gt;CALL&lt;&#x2F;code&gt; to self), both frames shall have independent values for &lt;code&gt;authorized&lt;&#x2F;code&gt;. Initially in each frame of execution, &lt;code&gt;authorized&lt;&#x2F;code&gt; is always unset, even if a previous execution frame for the same contract has a value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;auth-0xf6&quot;&gt;&lt;code&gt;AUTH&lt;&#x2F;code&gt; (&lt;code&gt;0xf6&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;AUTH&lt;&#x2F;code&gt; shall be created at &lt;code&gt;0xf6&lt;&#x2F;code&gt;. It shall take three stack element inputs (the last two describing a memory range), and it shall return one stack element.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;input&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;stack&quot;&gt;Stack&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;authority&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;offset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;length&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;memory&quot;&gt;Memory&lt;&#x2F;h5&gt;
&lt;p&gt;The final two stack arguments (&lt;code&gt;offset&lt;&#x2F;code&gt; and &lt;code&gt;length&lt;&#x2F;code&gt;) describe a range of memory. The format of the contents of that range is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;memory[offset    : offset+1 ]&lt;&#x2F;code&gt; - &lt;code&gt;yParity&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory[offset+1  : offset+33]&lt;&#x2F;code&gt; - &lt;code&gt;r&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory[offset+33 : offset+65]&lt;&#x2F;code&gt; - &lt;code&gt;s&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;memory[offset+65 : offset+97]&lt;&#x2F;code&gt; - &lt;code&gt;commit&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;output&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;stack-1&quot;&gt;Stack&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;success&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h5 id=&quot;memory-1&quot;&gt;Memory&lt;&#x2F;h5&gt;
&lt;p&gt;Memory is not modified by this instruction.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;length&lt;&#x2F;code&gt; is greater than 97, the extra bytes are ignored for signature verification (they still incur a gas cost as defined later). Bytes outside the range (in the event &lt;code&gt;length&lt;&#x2F;code&gt; is less than 97) are treated as if they had been zeroes.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;authority&lt;&#x2F;code&gt; is the address of the account which generated the signature. If &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; of &lt;code&gt;authority&lt;&#x2F;code&gt; is not zero, consider the operation unsuccessful and unset &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The arguments (&lt;code&gt;yParity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;) are interpreted as an ECDSA signature on the secp256k1 curve over the message &lt;code&gt;keccak256(MAGIC || chainId || nonce || invokerAddress || commit)&lt;&#x2F;code&gt;, where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chainId&lt;&#x2F;code&gt; is the current chain&#x27;s &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; unique identifier padded to 32 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt; is the signer&#x27;s current nonce, left-padded to 32 bytes.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;invokerAddress&lt;&#x2F;code&gt; is the address of the contract executing &lt;code&gt;AUTH&lt;&#x2F;code&gt; (or the active state address in the context of &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; or &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), left-padded with zeroes to a total of 32 bytes (ex. &lt;code&gt;0x000000000000000000000000AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;commit&lt;&#x2F;code&gt;, one of the arguments passed into &lt;code&gt;AUTH&lt;&#x2F;code&gt;, is a 32-byte value that can be used to commit to specific additional validity conditions in the invoker&#x27;s pre-processing logic.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Signature validity and signer recovery are handled analogously to transaction signatures, including the stricter &lt;code&gt;s&lt;&#x2F;code&gt; range for preventing ECDSA malleability. Note that &lt;code&gt;yParity&lt;&#x2F;code&gt; is expected to be &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the signature is valid and the signer address is equal to &lt;code&gt;authority&lt;&#x2F;code&gt;, the context variable &lt;code&gt;authorized&lt;&#x2F;code&gt; is set to the &lt;code&gt;authority&lt;&#x2F;code&gt;. In particular, this is also true if &lt;code&gt;authority == tx.origin&lt;&#x2F;code&gt;, which used to be handled separately in earlier versions of this EIP (see Security Considerations). If the signature is instead invalid or the signer address does not equal &lt;code&gt;authority&lt;&#x2F;code&gt;, &lt;code&gt;authorized&lt;&#x2F;code&gt; is reset to an unset value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AUTH&lt;&#x2F;code&gt; returns &lt;code&gt;1&lt;&#x2F;code&gt; if &lt;code&gt;authorized&lt;&#x2F;code&gt; is set, or &lt;code&gt;0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-cost&quot;&gt;Gas Cost&lt;&#x2F;h4&gt;
&lt;p&gt;The gas cost for &lt;code&gt;AUTH&lt;&#x2F;code&gt; is equal to the sum of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;fixed fee &lt;code&gt;3100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;memory expansion gas cost (&lt;code&gt;auth_memory_expansion_fee&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;100&lt;&#x2F;code&gt; if &lt;code&gt;authority&lt;&#x2F;code&gt; is warm, &lt;code&gt;2600&lt;&#x2F;code&gt; if it is cold (per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The fixed fee is equal to the cost for the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; precompile, plus a bit extra to cover a keccak256 hash and some additional logic.&lt;&#x2F;p&gt;
&lt;p&gt;The memory expansion gas cost (&lt;code&gt;auth_memory_expansion_fee&lt;&#x2F;code&gt;) shall be calculated in the same way as &lt;code&gt;RETURN&lt;&#x2F;code&gt;, where memory is expanded if the specified range is outside the current allocation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;authcall-0xf7&quot;&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf7&lt;&#x2F;code&gt;)&lt;&#x2F;h3&gt;
&lt;p&gt;A new opcode &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; shall be created at &lt;code&gt;0xf7&lt;&#x2F;code&gt;. It shall take seven stack elements and return one stack element. It matches the behavior of the existing &lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF1&lt;&#x2F;code&gt;) instruction, except where noted below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;input-1&quot;&gt;Input&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;addr&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 3&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;argsOffset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;argsLength&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 5&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;retOffset&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;retLength&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;output-1&quot;&gt;Output&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;top - 0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;success&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;behavior-1&quot;&gt;Behavior&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; is interpreted the same as &lt;code&gt;CALL&lt;&#x2F;code&gt;, except for (note: this list is also the order of precedence for the logical checks):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;authorized&lt;&#x2F;code&gt; is unset, execution is invalid (as defined above). Otherwise, the caller address for the call is set to &lt;code&gt;authorized&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The gas cost, including how much gas is available for the subcall, is specified in the Gas Cost section.&lt;&#x2F;li&gt;
&lt;li&gt;If the &lt;code&gt;gas&lt;&#x2F;code&gt; operand is equal to &lt;code&gt;0&lt;&#x2F;code&gt;, the instruction will send all available gas as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the gas available for the subcall would be less than &lt;code&gt;gas&lt;&#x2F;code&gt;, execution is invalid.&lt;&#x2F;li&gt;
&lt;li&gt;There is no gas stipend, even for non-zero &lt;code&gt;value&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; is deducted from the balance of &lt;code&gt;authorized&lt;&#x2F;code&gt;. If &lt;code&gt;value&lt;&#x2F;code&gt; is higher than the balance of &lt;code&gt;authorized&lt;&#x2F;code&gt;, execution is invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; must increase the call depth by one. &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; must not increase the call depth by two as it would if it first called into the authorized account and then into the target.&lt;&#x2F;p&gt;
&lt;p&gt;The return data area accessed with &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3d&lt;&#x2F;code&gt;) and &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3e&lt;&#x2F;code&gt;) must be set in the same way as the &lt;code&gt;CALL&lt;&#x2F;code&gt; instruction.&lt;&#x2F;p&gt;
&lt;p&gt;Importantly, &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; does not reset &lt;code&gt;authorized&lt;&#x2F;code&gt;, but leaves it unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-cost-1&quot;&gt;Gas Cost&lt;&#x2F;h4&gt;
&lt;p&gt;The gas cost for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; shall be the &lt;strong&gt;sum&lt;&#x2F;strong&gt; of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;static gas cost (&lt;code&gt;warm_storage_read&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;memory expansion gas cost (&lt;code&gt;memory_expansion_fee&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;dynamic gas cost (&lt;code&gt;dynamic_gas&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;gas available for execution in the subcall (&lt;code&gt;subcall_gas&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The memory expansion gas cost (&lt;code&gt;memory_expansion_fee&lt;&#x2F;code&gt;) shall be calculated in the same way as &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The dynamic gas portion (&lt;code&gt;dynamic_gas&lt;&#x2F;code&gt;), and the gas available for execution in the subcall (&lt;code&gt;subcall_gas&lt;&#x2F;code&gt;) shall be calculated as:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dynamic_gas = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if addr not in accessed_addresses:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dynamic_gas += 2500         # cold_account_access - warm_storage_read&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if value &amp;gt; 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dynamic_gas += 6700         # NB: Not 9000, like in `CALL`&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if is_empty(addr):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dynamic_gas += 25000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;remaining_gas = available_gas - dynamic_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;all_but_one_64th = remaining_gas - (remaining_gas &#x2F;&#x2F; 64)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if gas == 0:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subcall_gas = all_but_one_64th&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;elif all_but_one_64th &amp;lt; gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    raise                       # Execution is invalid.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subcall_gas = gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As with &lt;code&gt;CALL&lt;&#x2F;code&gt;, the full gas cost is charged immediately, independently of actually executing the call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;signature-in-memory&quot;&gt;Signature in Memory&lt;&#x2F;h3&gt;
&lt;p&gt;The signature format (&lt;code&gt;yParity&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, and &lt;code&gt;s&lt;&#x2F;code&gt;) is fixed, so it might seem curious that &lt;code&gt;auth&lt;&#x2F;code&gt; accepts a dynamic memory range. The signature is placed in memory so that &lt;code&gt;auth&lt;&#x2F;code&gt; can be upgraded in the future to work with contract accounts (which might use non-ECDSA signatures) and not just EOAs.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signing-address-auth-argument&quot;&gt;Signing Address &lt;code&gt;auth&lt;&#x2F;code&gt; Argument&lt;&#x2F;h3&gt;
&lt;p&gt;Including &lt;code&gt;authority&lt;&#x2F;code&gt; (the signing address) as an argument to &lt;code&gt;auth&lt;&#x2F;code&gt; allows future upgrades to the instruction to work with contract accounts, and not just EOAs.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;authority&lt;&#x2F;code&gt; were not included and multiple signature schemes allowed, it would not be possible to compute the authorizing account&#x27;s address from just the signature alone.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reserving-one-sixty-fourth-of-available-gas&quot;&gt;Reserving One Sixty-Fourth of Available Gas&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; will not pass more than 63&#x2F;64th of the available gas for the reasons enumerated in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throwing-for-unset-authorized-during-authcall&quot;&gt;Throwing for Unset &lt;code&gt;authorized&lt;&#x2F;code&gt; During &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A well-behaved contract should never reach an &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; without having successfully set &lt;code&gt;authorized&lt;&#x2F;code&gt; beforehand. The safest behavior, therefore, is to exit the current frame of execution immediately. This is especially important in the context of transaction sponsoring &#x2F; relaying, which is expected to be one of the main use cases for this EIP. In a sponsored transaction, the inability to distinguish between a sponsee-attributable fault (like a failing sub-call) and a sponsor-attributable fault (like a failing &lt;code&gt;AUTH&lt;&#x2F;code&gt;) is especially dangerous and should be prevented because it charges unfair fees to the sponsee.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;another-sponsored-transaction-eip&quot;&gt;Another Sponsored Transaction EIP&lt;&#x2F;h3&gt;
&lt;p&gt;There are two general approaches to separating the &quot;fee payer&quot; from the &quot;action originator&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;The first is introducing a new transaction type. This requires significant changes to clients to support and is generally less upgradeable than other solutions (e.g. this EIP). This approach is also not immediately compatible with account abstraction (AA). These proposals require a &lt;em&gt;signed&lt;&#x2F;em&gt; transaction from the sponsor&#x27;s account, which is not possible from an AA contract, because it has no private key to sign with. The main advantage of new transaction types is that the validity requirements are enforced by the protocol, therefore invalid transactions do not pollute block space.&lt;&#x2F;p&gt;
&lt;p&gt;The other main approach is to introduce a new mechanism in the EVM to masquerade as other accounts. This EIP introduces &lt;code&gt;AUTH&lt;&#x2F;code&gt; and &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; to make calls as EOAs. There are many different permutations of this mechanism. An alternative mechanism would be to add an opcode that can make arbitrary calls based on a similar address creation scheme as &lt;code&gt;CREATE2&lt;&#x2F;code&gt;. Although this mechanism would not benefit users today, it would immediately allow for those accounts to send and receive ether -- making it feel like a more first-class primitive.&lt;&#x2F;p&gt;
&lt;p&gt;Besides better compatibility with AA, introducing a new mechanism into the EVM is a much less intrusive change than a new transaction type. This approach requires no changes in existing wallets, and little change in other tooling.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;&#x27;s single deviation from &lt;code&gt;CALL&lt;&#x2F;code&gt; is to set &lt;code&gt;CALLER&lt;&#x2F;code&gt;. It implements the minimal functionality to enable sender abstraction for sponsored transactions. This single mindedness makes &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; significantly more composable with existing Ethereum features.&lt;&#x2F;p&gt;
&lt;p&gt;More logic can be implemented around the &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; instruction, giving more control to invokers and sponsors without sacrificing security or user experience for sponsees.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-to-sign&quot;&gt;What to Sign?&lt;&#x2F;h3&gt;
&lt;p&gt;As originally written, this proposal specified a precompile with storage to track nonces. Since a precompile with storage is unprecedented, a revision moved replay protection into the invoker contract, necessitating a certain level of user trust in the invoker. Expanding on this idea of trusted invokers, the other signed fields were eventually eliminated, one by one, until only &lt;code&gt;invoker&lt;&#x2F;code&gt; and &lt;code&gt;commit&lt;&#x2F;code&gt; remained. To appease concerns about cross-chain replay attacks and irrevocable signatures, the &lt;code&gt;chainId&lt;&#x2F;code&gt; and &lt;code&gt;nonce&lt;&#x2F;code&gt; fields returned to the signed message.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;invoker&lt;&#x2F;code&gt; binds a particular signed message to a single invoker. If invoker was not part of the message, any invoker could reuse the signature to completely compromise the EOA. This allows users to trust that their message will be validated as they expect, particularly the values committed to in &lt;code&gt;commit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;understanding-commit&quot;&gt;Understanding &lt;code&gt;commit&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Earlier iterations of this EIP included mechanisms for replay protection, and also signed over value, gas, and other arguments to &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;. After further investigation, we revised this EIP to its current state: explicitly delegate these responsibilities to the invoker contract.&lt;&#x2F;p&gt;
&lt;p&gt;A user will specifically interact with an invoker they trust. Because they trust this contract to execute faithfully, they will &quot;commit&quot; to certain properties of a call they would like to make by computing a hash of the call values. They can be certain that the invoker will only allow the call to proceed if it is able to verify the values committed to (e.g. a nonce to protect against replay attacks). This certainty arises from the &lt;code&gt;commit&lt;&#x2F;code&gt; value that is signed over by the user. This is the hash of values which the invoker will validate. A safe invoker should accept the values from the user and compute the commit hash itself. This ensures that invoker operated on the same input that user authorized.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;.&#x2F;assets&#x2F;auth-msg.png&quot; alt=&quot;auth message format&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;commit&lt;&#x2F;code&gt; as a hash of values allows for invokers to implement arbitrary constraints. For example, they could allow accounts to have &lt;code&gt;N&lt;&#x2F;code&gt; parallel nonces. Or, they could allow a user to commit to multiple calls with a single signature. This would allow multi-tx flows, such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; &lt;code&gt;approve&lt;&#x2F;code&gt;-&lt;code&gt;transfer&lt;&#x2F;code&gt; actions, to be condensed into a single transaction with a single signature verification. A commitment to multiple calls would look something like the diagram below.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;.&#x2F;assets&#x2F;auth-msg-multi-call.png&quot; alt=&quot;multi-call auth message&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Another interesting use is to delegate control of the EOA to other key(s). This would mean the EOA signs a &lt;code&gt;commit&lt;&#x2F;code&gt; message with the address of the key(s) and an access policy, if applicable. When the delegate wants to make a call as the EOA it will construct a signature over the invoker-specified call format and relay it (with the actual call data) onto chain with the signature and commit that granted it access to the account. The invoker will then be able to determine that the EOA has allowed this alternative key to make calls on its behalf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;.&#x2F;assets&#x2F;auth-msg-delegate.png&quot; alt=&quot;delegate auth message&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;invoker-contracts&quot;&gt;Invoker Contracts&lt;&#x2F;h3&gt;
&lt;p&gt;The invoker contract is a trustless intermediary between the sponsor and sponsee. A sponsee signs over &lt;code&gt;invoker&lt;&#x2F;code&gt; to require the transaction to be processed only by a contract they trust. This allows them to interact with sponsors without needing to trust them.&lt;&#x2F;p&gt;
&lt;p&gt;Choosing an invoker is similar to choosing a smart contract wallet implementation. It&#x27;s important to choose one that has been thoroughly reviewed, tested, and accepted by the community as secure. We expect a few invoker designs to be utilized by most major transaction relay providers, with a few outliers that offer more novel mechanisms.&lt;&#x2F;p&gt;
&lt;p&gt;An important note is that invoker contracts &lt;strong&gt;MUST NOT&lt;&#x2F;strong&gt; be upgradeable. If an invoker can be redeployed to the same address with different code, it would be possible to redeploy the invoker with code that does not properly verify &lt;code&gt;commit&lt;&#x2F;code&gt; and any account that signed a message over that invoker would be compromised. Although this sounds scary, it is no different than using a smart contract wallet via &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;. If the wallet is redeployed with different logic, all wallets using its code could be compromised.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;on-call-depth&quot;&gt;On Call Depth&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM limits the maximum number of nested calls, and naively allowing a sponsor to manipulate the call depth before reaching the invoker would introduce a griefing attack against the sponsee. That said, with the 63&#x2F;64th gas rule, and the cost of &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;, the stack is effectively limited to a much smaller depth than the hard maximum by the &lt;code&gt;gas&lt;&#x2F;code&gt; parameter.&lt;&#x2F;p&gt;
&lt;p&gt;It is, therefore, sufficient for the invoker to guarantee a minimum amount of gas, because there is no way to reach the hard maximum call depth with any reasonable (i.e. less than billions) amount of gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;source-of-value&quot;&gt;Source of &lt;code&gt;value&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;In previous iterations of this EIP, it was thought that deducting value from an EOA mid-execution was problematic. This was due to an invariant of pending transactions which allows tx pools to statically determine the validity of a given transaction.&lt;&#x2F;p&gt;
&lt;p&gt;However, after further investigation we found that breaking the invariant is safe. This is mostly due to the fact that the worst case is similar in both instances.&lt;&#x2F;p&gt;
&lt;p&gt;Currently an attacker can queue many transactions in the tx pool, across many accounts, and invalidate them all at once with a block where each of the queued accounts send a tx moving their entire balance. This attack will become easier and cheaper after this EIP, because it will no longer require direct access to the block builder and will not cost a full 21000 gas to originate each tx. However, the attack does not have a substantial impact on the network, so reducing the difficulty and cost is not of concern.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-tx-origin-as-signer&quot;&gt;Allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; as Signer&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing &lt;code&gt;authorized&lt;&#x2F;code&gt; to equal &lt;code&gt;tx.origin&lt;&#x2F;code&gt; enables simple transaction batching, where the sender of the outer transaction would be the signing account. The ERC-20 approve-then-transfer pattern, which currently requires two separate transactions, could be completed in a single transaction with this proposal.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AUTH&lt;&#x2F;code&gt; allows for signatures to be signed by &lt;code&gt;tx.origin&lt;&#x2F;code&gt;. For any such signatures, subsequent &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;s have &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt; in their first layer of execution. Without EIP-3074, this situation can only ever arise in the topmost execution layer of a transaction. This EIP breaks that invariant and so affects smart contracts containing &lt;code&gt;require(msg.sender == tx.origin)&lt;&#x2F;code&gt; checks. This check can be used for at least three purposes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Ensuring that &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA (given that &lt;code&gt;tx.origin&lt;&#x2F;code&gt; always has to be an EOA). This invariant does not depend on the execution layer depth and, therefore, is not affected.&lt;&#x2F;li&gt;
&lt;li&gt;Protecting against atomic sandwich attacks like flash loans, that rely on the ability to modify state before and after the execution of the target contract as part of the same atomic transaction. This protection would be broken by this EIP. However, relying on &lt;code&gt;tx.origin&lt;&#x2F;code&gt; in this way is considered bad practice, and can already be circumvented by miners conditionally including transactions in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Preventing reentrancy.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Examples of (1) and (2) can be found in contracts deployed on Ethereum mainnet, with (1) being more common (and unaffected by this proposal.) On the other hand, use case (3) is more severely affected by this proposal, but the authors of this EIP did not find any examples of this form of reentrancy protection, though the search was non-exhaustive.&lt;&#x2F;p&gt;
&lt;p&gt;This distribution of occurrences—many (1), some (2), and no (3)—is exactly what the authors of this EIP expect, because:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Determining if &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is an EOA without &lt;code&gt;tx.origin&lt;&#x2F;code&gt; is difficult (if not impossible.)&lt;&#x2F;li&gt;
&lt;li&gt;The only execution context which is safe from atomic sandwich attacks is the topmost context, and &lt;code&gt;tx.origin == msg.sender&lt;&#x2F;code&gt; is the only way to detect that context.&lt;&#x2F;li&gt;
&lt;li&gt;In contrast, there are many direct and flexible ways of preventing reentrancy (ex. using a storage variable.) Since &lt;code&gt;msg.sender == tx.origin&lt;&#x2F;code&gt; is only true in the topmost context, it would make an obscure tool for preventing reentrancy, rather than other more common approaches.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There are other approaches to mitigate this restriction which do not break the invariant:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a constant &lt;code&gt;ENTRY_POINT&lt;&#x2F;code&gt; address for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to the invoker address for &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt;s.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to a special address derived from any of the sender, invoker, and&#x2F;or signer addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Disallow &lt;code&gt;authorized == tx.origin&lt;&#x2F;code&gt;. This would make the simple batching use cases impossible, but could be relaxed in the future.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authcall-cheaper-than-call-when-sending-value&quot;&gt;&lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; cheaper than &lt;code&gt;CALL&lt;&#x2F;code&gt; when sending value&lt;&#x2F;h3&gt;
&lt;p&gt;Sending non-zero value with &lt;code&gt;CALL&lt;&#x2F;code&gt; increases its cost by 9,000. Of that, 6,700 covers the increased overhead of the balance transfer and 2,300 is used as a stipend into the subcall to seed its gas counter. &lt;code&gt;AUTHCALL&lt;&#x2F;code&gt; does not provide a stipend and thus only charges the base 6,700.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;in-protocol-revocation&quot;&gt;In-Protocol Revocation&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP has gone &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3074&#x2F;#what-to-sign&quot;&gt;back and forth&lt;&#x2F;a&gt; on how to deal with &lt;code&gt;AUTH&lt;&#x2F;code&gt; message revocation. Without revocation, this EIP is a supremely powerful and flexible primitive for developers. However, it does have risk for users who use insecure and&#x2F;or actively malicious invokers.&lt;&#x2F;p&gt;
&lt;p&gt;Much of the risk is due to the new ability for users to batch many operations in a single transaction. It becomes easier for an account to be drained. This is a risk that will continue to grow, regardless of the adoption of this EIP, due to overwhelming desire for the feature and attempts to support it at the protocol level and at the app level.&lt;&#x2F;p&gt;
&lt;p&gt;A new class of risk is introduced for insecure and buggy invokers. If an invoker has implemented replay protection, as per the authors&#x27; recommendation, this should substantially contain the blast radius. However, if the bug allows an adversary to circumvent the replay protection mechanism, it may give them full access to any EOA which has interacted with the vulnerable invoker.&lt;&#x2F;p&gt;
&lt;p&gt;Although this is a truly catastrophic event which is not expected to be possible via reputable wallets, it is a serious consideration. Without in-protocol revocation, users have no way to remove their account from the vulnerable invoker.&lt;&#x2F;p&gt;
&lt;p&gt;For this reason, &lt;code&gt;AUTH&lt;&#x2F;code&gt; requires the &lt;code&gt;nonce&lt;&#x2F;code&gt; in the message to be equal to the signer&#x27;s current nonce. This way, a single tx from the EOA will cause the nonce to increase, invalidating all outstanding authorizations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failing-on-extcodesize-check&quot;&gt;Failing on &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; check&lt;&#x2F;h3&gt;
&lt;p&gt;In &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt;, it was determined that the protocol should reject any transaction which originates from an account with code. Although this EIP focused on transaction origination, the authors of EIP-3074 feel the intention is clear: an account that has both code and a known private key should not be allowed to make arbitrary calls on behalf of said account. Therefore, the property is upheld in this EIP. For full rationale, please refer to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3607&#x2F;&quot;&gt;EIP-3607&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Although this EIP poses no issues for backwards compatibility, there are concerns that it limits future changes to accounts by further enshrining ECDSA signatures. For example, it might be desirable to eradicate the concept of EOAs altogether, and replace them with smart contract wallets that emulate the same behavior. This is fully compatible with the EIP as written, however, it gets tricky if users can then elect to &quot;upgrade&quot; their smart contract wallets to use other methods of authentication -- e.g. convert into a multi-sig. Without any changes, &lt;code&gt;AUTH&lt;&#x2F;code&gt; would not respect this new logic and continue allowing the old private key to perform actions on behalf of the account.&lt;&#x2F;p&gt;
&lt;p&gt;A solution to this would be at the same time that EOAs are removed, to modify the logic of &lt;code&gt;AUTH&lt;&#x2F;code&gt; to actually call into the account with some standard message and allow the account to determine if the signature &#x2F; witness is valid. Further research should be done to understand how invokers would need to change in this situation and how best to write them in a future-compatible manner.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;secure-invokers&quot;&gt;Secure Invokers&lt;&#x2F;h3&gt;
&lt;p&gt;The following is a non-exhaustive list of checks&#x2F;pitfalls&#x2F;conditions that invokers &lt;em&gt;should&lt;&#x2F;em&gt; be wary of:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Replay protection (ex. a nonce) should be implemented by the invoker, and included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without it, a malicious actor can reuse a signature, repeating its effects.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; should be included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without it, a malicious sponsor could cause unexpected effects in the callee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt; should be included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without it, a malicious sponsor could cause the callee to run out of gas and fail, griefing the sponsee.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;addr&lt;&#x2F;code&gt; and &lt;code&gt;calldata&lt;&#x2F;code&gt; should be included in &lt;code&gt;commit&lt;&#x2F;code&gt;. Without them, a malicious actor may call arbitrary functions in arbitrary contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A poorly implemented invoker can &lt;em&gt;allow a malicious actor to take near complete control over a signer&#x27;s EOA&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-tx-origin-as-signer-1&quot;&gt;Allowing &lt;code&gt;tx.origin&lt;&#x2F;code&gt; as Signer&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing &lt;code&gt;authorized&lt;&#x2F;code&gt; to equal &lt;code&gt;tx.origin&lt;&#x2F;code&gt; has the possibility to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Break atomic sandwich protections which rely on &lt;code&gt;tx.origin&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Break reentrancy guards of the style &lt;code&gt;require(tx.origin == msg.sender)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The authors of this EIP believe the risks of allowing &lt;code&gt;authorized&lt;&#x2F;code&gt; to equal &lt;code&gt;tx.origin&lt;&#x2F;code&gt; are acceptable for the reasons outlined in the Rationale section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sponsored-transaction-relayers&quot;&gt;Sponsored Transaction Relayers&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible for the &lt;code&gt;authorized&lt;&#x2F;code&gt; account to cause sponsored transaction relayers to spend gas without being reimbursed by either invalidating the authorization (i.e. increasing the account&#x27;s nonce) or by sweeping the relevant assets out of the account. Relayers should be designed with these cases in mind, possibly by requiring a bond to be deposited or by implementing a reputation system.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BW6-761 curve operations</title>
        <published>2020-10-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Youssef El Housni</name><uri>https://github.com/yelhousni</uri>
	</author>
	
	<author>
		<name>Michael Connor</name><uri>https://github.com/iAmMichaelConnor</uri>
	</author>
	
	<author>
		<name>Aurore Guillevic</name><email>aurore.guillevic@inria.fr</email>
	</author>
	
	<author>
		<name>hujw77</name><uri>https://github.com/hujw77</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3026/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3026-bw6-761-curve-operations/4790" />
        

        <id>https://wg-eips.ritovision.com/3026/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3026"
            label="EIP-3026" />
        

        
        

        
        <summary type="html">Precompiles for BW6-761 curve operations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3026/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This precompile adds operations for the BW6-761 curve (from the EY&#x2F;Inria &lt;strong&gt;Optimized and secure pairing-friendly elliptic curves suitable for one layer proof composition&lt;&#x2F;strong&gt; research paper) as a precompile in a set necessary to &lt;em&gt;efficiently&lt;&#x2F;em&gt; perform verification of one-layer composed zkSNARKs proofs.
If &lt;code&gt;block.number &amp;gt;= X&lt;&#x2F;code&gt; we introduce &lt;em&gt;seven&lt;&#x2F;em&gt; separate precompiles to perform the following operations (addresses to be determined):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BW6_G1_ADD - to perform point addition on a curve defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G1_MUL - to perform point multiplication on a curve defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G1_MULTIEXP - to perform multiexponentiation on a curve defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G2_ADD - to perform point addition on a curve twist defined the base a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G2_MUL - to perform point multiplication on a curve twist defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_G2_MULTIEXP - to perform multiexponentiation on a curve twist defined over a prime field&lt;&#x2F;li&gt;
&lt;li&gt;BW6_PAIRING - to perform a pairing operations between a set of &lt;em&gt;pairs&lt;&#x2F;em&gt; of (G1, G2) points&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The multiexponentiation operations are a generalization of point multiplication, but separate precompiles are prosposed because running a single MUL through MULTIEXP seems to be 20% more expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is based on and tends to replace matter-labs&#x27; proposal for significant performance reasons. In most applications, BW6-761 is used as an outer curve to BLS12-377 considered in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2539&#x2F;&quot;&gt;EIP-2539&lt;&#x2F;a&gt;.
The motivation of this precompile is to allow efficient one-layer composition of SNARK proofs. Currently this is done by Zexe using the BLS12-377&#x2F;CP6-782 pair of curves. This precompile proposes a replacement of CP6-782 by BW6-761, which allows much faster operations. For example, it was shown that verifying a Groth16 proof with BW6-761 is 30 times faster than with CP6-782.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-addresses-table&quot;&gt;Proposed addresses table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Precompile&lt;&#x2F;th&gt;&lt;th&gt;Address&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BW6_G1_ADD&lt;&#x2F;td&gt;&lt;td&gt;0x1e&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G1_MUL&lt;&#x2F;td&gt;&lt;td&gt;0x1f&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G1_MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x20&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G2_ADD&lt;&#x2F;td&gt;&lt;td&gt;0x21&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G2_MUL&lt;&#x2F;td&gt;&lt;td&gt;0x22&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_G2_MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x23&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BW6_PAIRING&lt;&#x2F;td&gt;&lt;td&gt;0x24&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Curve parameters:&lt;&#x2F;p&gt;
&lt;p&gt;The BW6-761 &lt;code&gt;y^2=x^3-1&lt;&#x2F;code&gt; curve is fully defined by the following set of parameters:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = 0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d00000000008b&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;A coefficient = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient = 0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d00000000008a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Main subgroup order = 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Extension tower:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp3 construction: (Fp3 = Fp[u]&#x2F;u^3+4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp cubic non-residue = 0x122e824fb83ce0ad187c94004faff3eb926186a81d14688528275ef8087be41707ba638e584e91903cebaff25b423048689c8ed12f9fd9071dcd3dc73ebff2e98a116c25667a8f8160cf8aeeaf0a437e6913e6870000082f49d000000000087&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist type: M&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;twist curve A coefficient c0 = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                          c1 = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;twist curve B coefficient c0 = 0x4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        c1 = 0x0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Generators:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x1075b020ea190c8b277ce98a477beaee6a0cfb7551b27f0ee05c54b85f56fc779017ffac15520ac11dbfcd294c2e746a17a54ce47729b905bd71fa0c9ea097103758f9a280ca27f6750dd0356133e82055928aca6af603f4088f3af66e5b43d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x58b84e0a6fc574e6fd637b45cc2a420f952589884c9ec61a7348d2a2e573a3265909f1af7e0dbac5b8fa1771b5b806cc685d31717a4c55be3fb90b6fc2cdd49f9df141b3053253b2b08119cad0fb93ad1cb2be0b20d2a1bafc8f2db4e95363&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x110133241d9b816c852a82e69d660f9d61053aac5a7115f4c06201013890f6d26b41c5dab3da268734ec3f1f09feb58c5bbcae9ac70e7c7963317a300e1b6bace6948cb3cd208d700e96efbc2ad54b06410cf4fe1bf995ba830c194cd025f1c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x17c3357761369f8179eb10e4b6d2dc26b7cf9acec2181c81a78e2753ffe3160a1d86c80b95a59c94c97eb733293fef64f293dbd2c712b88906c170ffa823003ea96fcd504affc758aa2d3a3c5a02a591ec0594f9eac689eb70a16728c73b61&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pairing parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e(P,Q)=(ML1(P,Q)*ML2(P,Q)^q)^FE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|loop_count_1| (first miller loop ML1 count) = 0x8508c00000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|loop_count_2| (second miller loop ML2 count) = 0x23ed1347970dec008a442f991fffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;loop_count_1 is negative = false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;loop_count_2 is negative = false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field elements encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;To encode points involved in the operation one has to encode elements of only the base field.&lt;&#x2F;p&gt;
&lt;p&gt;The base field element (Fp) is encoded as &lt;code&gt;96&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be less than the base field modulus.&lt;&#x2F;p&gt;
&lt;p&gt;If encodings do not follow this spec anywhere during parsing in the precompile, the precompile &lt;strong&gt;MUST&lt;&#x2F;strong&gt; revert with &quot;endoding error&quot;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-uncompressed-points&quot;&gt;Encoding of uncompressed points:&lt;&#x2F;h4&gt;
&lt;p&gt;Points in both G1 and G2 can be expressed as &lt;code&gt;(x, y)&lt;&#x2F;code&gt; affine coordinates, where &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; are elements of the base field.
Therefore, points in both G1 and G2 are encoded as the byte concatenation of the field element encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; affine coordinates. The total encoding length for a G1&#x2F;G2 point is thus &lt;code&gt;192&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-at-infinity-encoding&quot;&gt;Point at infinity encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;Also referred as the &quot;zero point&quot;. For BW6-761 (&lt;code&gt;y^2=x^3-1&lt;&#x2F;code&gt;) and its M-twisted curves (&lt;code&gt;y^3=x^3+4&lt;&#x2F;code&gt;), the point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (formal zeros in Fp) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, and so the encoding of &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; is used as a convention to encode the point at infinity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars-for-multiplication-and-multiexponentiation-operations&quot;&gt;Encoding of scalars for multiplication and multiexponentiation operations:&lt;&#x2F;h4&gt;
&lt;p&gt;For multiplication and multiexponentiation operations, a scalar is encoded as &lt;code&gt;64&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the main subgroup order for BW6-761 is actually only &lt;code&gt;377&lt;&#x2F;code&gt; bits (&lt;code&gt;48&lt;&#x2F;code&gt; bytes), but an encoding of &lt;code&gt;64&lt;&#x2F;code&gt; bytes has been chosen to have a &lt;code&gt;32&lt;&#x2F;code&gt;-byte-aligned ABI (representable as e.g. &lt;code&gt;bytes32[2]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[2]&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The corresponding integer &lt;strong&gt;MAY&lt;&#x2F;strong&gt; be greater than the main subgroup order.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-operations&quot;&gt;ABI for operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abi-for-g1-addition&quot;&gt;ABI for G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G1 addition call expects &lt;code&gt;384&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of two G1 points (point-encoded as &lt;code&gt;192&lt;&#x2F;code&gt; bytes each). Output is a point-encoding of the addition operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of the points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field element encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiplication&quot;&gt;ABI for G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiplication call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of the point-encoding of a G1 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and the encoding of a scalar value (&lt;code&gt;64&lt;&#x2F;code&gt; bytes). Output is a point-encoding of the multiplication operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field element encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Scalar encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiexponentiation&quot;&gt;ABI for G1 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiplication call expects &lt;code&gt;256*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices, each of them being a byte concatenation of the point-encoding of a G1 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and the encoding of a scalar value (&lt;code&gt;64&lt;&#x2F;code&gt; bytes). Output is an encoding of the multiexponentiation operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of the G1 points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field element encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Scalar encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-addition&quot;&gt;ABI for G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G2 addition call expects &lt;code&gt;384&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of two G2 points (point-encoded as &lt;code&gt;192&lt;&#x2F;code&gt; bytes each). Output is a point-encoding of the addition operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiplication&quot;&gt;ABI for G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiplication call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as the byte concatenation of the point-encoding of a G2 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and the encoding of a scalar value (&lt;code&gt;64&lt;&#x2F;code&gt; bytes). Output is an encoding of multiplication operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiexponentiation&quot;&gt;ABI for G2 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiplication call expects &lt;code&gt;240*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G2 point (&lt;code&gt;192&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;48&lt;&#x2F;code&gt; bytes). Output is an encoding of multiexponentiation operation result.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of G2 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-pairing&quot;&gt;ABI for pairing&lt;&#x2F;h4&gt;
&lt;p&gt;Pairing call expects &lt;code&gt;384*k&lt;&#x2F;code&gt; bytes as an input, that is interpreted as the byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices. Each slice has the following structure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;192&lt;&#x2F;code&gt; bytes G1 point encoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;192&lt;&#x2F;code&gt; bytes G2 point encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Output is &lt;code&gt;32&lt;&#x2F;code&gt; bytes representing a boolean:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt; if the pairing result is equal the to multiplicative identity in the pairing target field; and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of the G1 or G2 points being not on the curve&lt;&#x2F;li&gt;
&lt;li&gt;Any of the G1 or G2 points being not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;prevention-of-ddos-on-error-handling&quot;&gt;Prevention of DDoS on error handling&lt;&#x2F;h3&gt;
&lt;p&gt;This precompile performs extensive computations and in case of any errors during execution it &lt;strong&gt;MUST&lt;&#x2F;strong&gt; consume all gas from the gas schedule for the corresponding operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;g1-addition&quot;&gt;G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;180&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-multiplication&quot;&gt;G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;64000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-addition&quot;&gt;G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;180&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-multiplication&quot;&gt;G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;64000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-g2-multiexponentiation&quot;&gt;G1&#x2F;G2 Multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;Discounts table as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1266], [2, 733], [3, 561], [4, 474], [5, 422], [6, 387], [7, 362], [8, 344], [9, 329], [10, 318], [11, 308], [12, 300], [13, 296], [14, 289], [15, 283], [16, 279], [17, 275], [18, 272], [19, 269], [20, 266], [21, 265], [22, 260], [23, 259], [24, 256], [25, 255], [26, 254], [27, 252], [28, 251], [29, 250], [30, 249], [31, 249], [32, 220], [33, 228], [34, 225], [35, 223], [36, 219], [37, 216], [38, 214], [39, 212], [40, 209], [41, 209], [42, 205], [43, 203], [44, 202], [45, 200], [46, 198], [47, 196], [48, 199], [49, 195], [50, 192], [51, 192], [52, 191], [53, 190], [54, 187], [55, 186], [56, 185], [57, 184], [58, 184], [59, 181], [60, 181], [61, 181], [62, 180], [63, 178], [64, 179], [65, 176], [66, 177], [67, 176], [68, 175], [69, 174], [70, 173], [71, 171], [72, 171], [73, 170], [74, 170], [75, 169], [76, 168], [77, 168], [78, 167], [79, 167], [80, 166], [81, 165], [82, 167], [83, 166], [84, 166], [85, 165], [86, 165], [87, 164], [88, 164], [89, 163], [90, 163], [91, 162], [92, 162], [93, 160], [94, 163], [95, 159], [96, 162], [97, 159], [98, 160], [99, 159], [100, 159], [101, 158], [102, 158], [103, 158], [104, 158], [105, 157], [106, 157], [107, 156], [108, 155], [109, 155], [110, 156], [111, 155], [112, 155], [113, 154], [114, 155], [115, 154], [116, 153], [117, 153], [118, 153], [119, 152], [120, 152], [121, 152], [122, 152], [123, 151], [124, 151], [125, 151], [126, 151], [127, 151], [128, 150]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 150&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pairing-operation&quot;&gt;Pairing operation&lt;&#x2F;h4&gt;
&lt;p&gt;Base cost of the pairing operation is &lt;code&gt;120000*k + 320000&lt;&#x2F;code&gt; where &lt;code&gt;k&lt;&#x2F;code&gt; is a number of pairs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Gas costs are based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1962&#x2F;&quot;&gt;EIP-1962&lt;&#x2F;a&gt; estimation strategy (but do not fully include yet parsing of ABI, decoding and encoding of the result as a byte array).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-estimation-strategy&quot;&gt;Gas estimation strategy&lt;&#x2F;h3&gt;
&lt;p&gt;Gas cost is derived by taking the average timing of the same operations over different implementations and assuming a constant &lt;code&gt;30 MGas&#x2F;second&lt;&#x2F;code&gt;. Since the execution time is machine-specific, this constant is determined based on execution times of &lt;em&gt;ECRECOVER&lt;&#x2F;em&gt; and &lt;em&gt;BNPAIR&lt;&#x2F;em&gt; precompiles on my machine and their proposed gas price (&lt;code&gt;43.5 MGas&#x2F;s&lt;&#x2F;code&gt; for ECRECOVER and &lt;code&gt;16.5 MGas&#x2F;s&lt;&#x2F;code&gt; for BNPAIR). Following are the proposed methods to time the precompile operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;G1 addition: Average timing of 1000 random samples.&lt;&#x2F;li&gt;
&lt;li&gt;G1 multiplication: Average timing of 1000 samples of random worst-case of double-and-add algorithm (scalar of max bit length and max hamming weight and random base points in G1)&lt;&#x2F;li&gt;
&lt;li&gt;G2 addition: Average timing of 1000 random samples&lt;&#x2F;li&gt;
&lt;li&gt;G2 multiplication: Average timing of 1000 samples of random worst-case of double-and-add algorithm (scalar of max bit length and max hamming weight and random base points in G2)&lt;&#x2F;li&gt;
&lt;li&gt;G1 and G2 multiexponentiations: Expected to be performed by the Peppinger algorithm, with a table prepared for discount in case of &lt;code&gt;k &amp;lt;= 128&lt;&#x2F;code&gt; points in the multiexponentiation with a discount cup &lt;code&gt;max_discount&lt;&#x2F;code&gt; for &lt;code&gt;k &amp;gt; 128&lt;&#x2F;code&gt;. To avoid non-integer arithmetic call cost is calculated as &lt;code&gt;k * multiplication_cost * discount &#x2F; multiplier&lt;&#x2F;code&gt; where &lt;code&gt;multiplier = 1000&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt; is a number of (scalar, point) pairs for the call, &lt;code&gt;multiplication_cost&lt;&#x2F;code&gt; is a corresponding single multiplication call cost for G1&#x2F;G2.&lt;&#x2F;li&gt;
&lt;li&gt;Pairing: Average timing of 1000 random samples (random points in G1 and G2) for different number of pairs with linear lifting.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;multiexponentiation-as-a-separate-call&quot;&gt;Multiexponentiation as a separate call&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit separate multiexponentiation operation that allows one to save execution time (so gas) by both the algorithm used (namely Peppinger algorithm) and (usually forgotten) by the fact that &lt;code&gt;CALL&lt;&#x2F;code&gt; operation in Ethereum is expensive (at the time of writing), so one would have to pay non-negigible overhead if e.g. for multiexponentiation of &lt;code&gt;100&lt;&#x2F;code&gt; points would have to call the multiplication precompile &lt;code&gt;100&lt;&#x2F;code&gt; times and addition for &lt;code&gt;99&lt;&#x2F;code&gt; times (roughly &lt;code&gt;138600&lt;&#x2F;code&gt; would be saved).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;explicit-subgroup-checks&quot;&gt;Explicit subgroup checks&lt;&#x2F;h3&gt;
&lt;p&gt;G2 subgroup check has the same cost as G1 subgroup check. Endomorphisms can be leverages to optimize this operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility questions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the large test parameters space we first provide properties that various operations must satisfy. We use additive notation for point operations, capital letters (&lt;code&gt;P&lt;&#x2F;code&gt;, &lt;code&gt;Q&lt;&#x2F;code&gt;) for points, small letters (&lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;) for scalars. Generator for G1 is labeled as &lt;code&gt;G&lt;&#x2F;code&gt;, generator for G2 is labeled as &lt;code&gt;H&lt;&#x2F;code&gt;, otherwise we assume random point on a curve in a correct subgroup. &lt;code&gt;0&lt;&#x2F;code&gt; means either scalar zero or point of infinity. &lt;code&gt;1&lt;&#x2F;code&gt; means either scalar one or multiplicative identity. &lt;code&gt;group_order&lt;&#x2F;code&gt; is a main subgroup order. &lt;code&gt;e(P, Q)&lt;&#x2F;code&gt; means pairing operation where &lt;code&gt;P&lt;&#x2F;code&gt; is in G1, &lt;code&gt;Q&lt;&#x2F;code&gt; is in G2.&lt;&#x2F;p&gt;
&lt;p&gt;Requeired properties for basic ops (add&#x2F;multiply):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Commutativity: &lt;code&gt;P + Q = Q + P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Additive negation: &lt;code&gt;P + (-P) = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Doubling &lt;code&gt;P + P = 2*P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subgroup check: &lt;code&gt;group_order * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Trivial multiplication check: &lt;code&gt;1 * P = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by zero: &lt;code&gt;0 * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by the unnormalized scalar &lt;code&gt;(scalar + group_order) * P = scalar * P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Required properties for pairing operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Degeneracy &lt;code&gt;e(P, 0*Q) = e(0*P, Q) = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Bilinearity &lt;code&gt;e(a*P, b*Q) = e(a*b*P, Q) = e(P, a*b*Q)&lt;&#x2F;code&gt; (internal test, not visible through ABI)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a various choice of existing implementations:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Libraries:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Rust implementation (EY&#x2F;Zexe): github.com&#x2F;yelhousni&#x2F;zexe&#x2F;tree&#x2F;youssef&#x2F;BW6-761-Fq-ABLR-2ML-M&lt;&#x2F;li&gt;
&lt;li&gt;C++ implementation (EY&#x2F;libff): github.com&#x2F;EYBlockchain&#x2F;zk-swap-libff&lt;&#x2F;li&gt;
&lt;li&gt;Golang implementation (Consensys&#x2F;gurvy): github.com&#x2F;ConsenSys&#x2F;gurvy&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Stand-alone implementation:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Golang implementation with Intel assembly (Onur Kilic): github.com&#x2F;kilic&#x2F;bw6&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Precompiles:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;OpenEthereum (EY&#x2F;Parity): github.com&#x2F;EYBlockchain&#x2F;solidity-elliptic-curves&lt;&#x2F;li&gt;
&lt;li&gt;Frontier (Parity): github.com&#x2F;paritytech&#x2F;frontier&#x2F;pull&#x2F;1049&#x2F;files&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Scripts:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SageMath and Magma scripts: gitlab.inria.fr&#x2F;zk-curves&#x2F;bw6-761&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Strictly following the spec will eliminate security implications or consensus implications in a contrast to the previous BN254 precompile.&lt;&#x2F;p&gt;
&lt;p&gt;Important topic is a &quot;constant time&quot; property for performed operations. We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>IMPERSONATECALL Opcode</title>
        <published>2020-09-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sergio Demian Lerner</name><uri>https://github.com/SergioDemianLerner</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2997/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/impersonatecall-opcode/8020" />
        

        <id>https://wg-eips.ritovision.com/2997/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2997"
            label="EIP-2997" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2997/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new opcode, &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; at &lt;code&gt;0xf6&lt;&#x2F;code&gt;, which is similar in idea to &lt;code&gt;CALL (0xF1)&lt;&#x2F;code&gt;, except that it impersonates a sender, i.e. the callee sees a sender different from the real caller. The impersonated sender address is derived from the real caller address and a salt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal enables native multi-user wallets (wallets that serve multiple users) that can be commanded by EIP-712 based messages and therefore enable meta-transactions. Multi-user wallets also enable the aggregation of transfer operations in batches similar to rollups, but maintaining the same address space as normal onchain transactions, so the sender&#x27;s wallet does not need to be upgraded to support sinding ether or tokens to a user of a multi-user wallet.
Additionally, many times a sponsor company wants to deploy non-custodial smart wallets for all its users. The sponsor does not want to pay the deployment cost of each user contract in advance. Counterfactual contract creation enables this, yet it forces the sponsor to create the smart wallet (or a proxy contract to it) when the user wants to transfer ether or tokens out of his&#x2F;her account for the first time. This proposal avoids this extra cost, which is at least 42000 gas per user.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt;: &lt;code&gt;0xf6&lt;&#x2F;code&gt;, takes 7 operands:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;: the amount of gas the code may use in order to execute;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: the destination address whose code is to be executed;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_offset&lt;&#x2F;code&gt;: the offset into memory of the input;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_size&lt;&#x2F;code&gt;: the size of the input in bytes;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ret_offset&lt;&#x2F;code&gt;: the offset into memory of the output;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ret_size&lt;&#x2F;code&gt;: the size of the scratch pad for the output.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; is a &lt;code&gt;32&lt;&#x2F;code&gt; bytes value (a stack item).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;computation-of-impersonated-sender&quot;&gt;Computation of impersonated sender&lt;&#x2F;h3&gt;
&lt;p&gt;The impersonated sender address is computed as &lt;code&gt;keccak256( 0xff ++ address ++ salt ++ zeros32)[12:]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;0xff&lt;&#x2F;code&gt; is a single byte,&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is always &lt;code&gt;20&lt;&#x2F;code&gt; bytes, and represents the address of the real caller contract.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; is always &lt;code&gt;32&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The field zeros32 corresponds to 32 zero bytes.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This scheme emulates &lt;code&gt;CREATE2&lt;&#x2F;code&gt; address derivation, but it cannot practically collude with the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; address space.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;notes&quot;&gt;Notes&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The opcode behaves exactly as &lt;code&gt;CALL&lt;&#x2F;code&gt; in terms of gas consumption.&lt;&#x2F;li&gt;
&lt;li&gt;In the called context &lt;code&gt;CALLER (0x33)&lt;&#x2F;code&gt; returns the impersonated address.&lt;&#x2F;li&gt;
&lt;li&gt;If value transfer is non-zero in the call, the value is transferred from the impersonated account, and not from the real caller. This can be used to transfer ether out of an impersonated account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Even if &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; requires hashing 3 words, implying an additional cost of 180 gas, we think the benefit of accounting for hashing doesn&#x27;t not compensate increasing the complexity of the implementation.&lt;&#x2F;p&gt;
&lt;p&gt;We use the zeros32 field to base address derivation in a pre-image of similar size than CREATE2 and reuse the existing address derivation functions. We also avoid worrying about address collisions between EOA derivation (65 bytes pre-image), CREATE derivation (from 23 to 27 bytes pre-image, for a 32bit nonce) and CREATE2 derivation (85 bytes pre-image).&lt;&#x2F;p&gt;
&lt;p&gt;An option is to omit the zeros32 field: the resulting length of the Keccak pre-image for IMPERSONATECALL address is 53 bytes , which does not generate address collision.&lt;&#x2F;p&gt;
&lt;p&gt;While the same functionality could be provided in a pre-compiled contract, we believe using a new opcode is a cleaner solution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;clarifications&quot;&gt;Clarifications&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;This EIP makes address collisions possible, yet practically impossible.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;If a contract already exists with an impersonated address, the &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; is executed in the same way, and the existing code will not be executed. It should  be noted that &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) cannot be executed directly with &lt;code&gt;IMPERSONATECALL&lt;&#x2F;code&gt; as no opcode is executed in the context of the impersonated account.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backward-compatibility&quot;&gt;Backward Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The opcode number  &lt;code&gt;0xf6&lt;&#x2F;code&gt; is currently unused and results in an out-of-gas (OOG) exception.  Solidity uses the &lt;code&gt;INVALID (0xfe)&lt;&#x2F;code&gt; opcode (called &lt;code&gt;ABORT&lt;&#x2F;code&gt; by EIP-1803) to raise OOG exceptions, so the  &lt;code&gt;0xf6&lt;&#x2F;code&gt; opcode does not appear in normal Solidity programs. Programmers are already advised not to include this opcode in contracts written in EVM assembly.  Therefore is does not pose any backward compatibility risk.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;We present 4 examples of impersonated address derivation:&lt;&#x2F;p&gt;
&lt;p&gt;Example 0&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xFFC4F52F884A02BCD5716744CD622127366F2EDF&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 1&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x85F15E045E1244AC03289B48448249DC0A34AA30&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 2&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x000000000000000000000000feed000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x2DB27D1D6BE32C9ABFA484BA3D591101881D4B9F&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 3&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x00000000000000000000000000000000deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x00000000000000000000000000000000000000000000000000000000cafebabe&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x5004E448F43EFE3C7BF32F94B83B843D03901457&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The address derivation scheme prevents address collision with another deployed contract or an externally owned account, as the impersonated sender address is derived from the real caller address and a salt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>IS_STATIC opcode</title>
        <published>2020-09-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2970/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/is-static-opcode-useful-for-aa/4609" />
        

        <id>https://wg-eips.ritovision.com/2970/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2970"
            label="EIP-2970" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2970/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;IS_STATIC (0x4A)&lt;&#x2F;code&gt; opcode that pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the current context is static (ie. the execution is in a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; or a descendant thereof, so state-changing operations are not possible), and &lt;code&gt;0&lt;&#x2F;code&gt; if it is not.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The main intended use case is to allow account abstraction (EIP 2938) to be extended so that accounts can allow static calls from the outside (which are harmless to AA&#x27;s security model) but not state-changing calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;IS_STATIC (0x4A)&lt;&#x2F;code&gt; opcode that pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the current context is static (ie. the execution is in a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; or a descendant thereof, so state-changing operations are not possible), and &lt;code&gt;0&lt;&#x2F;code&gt; if it is not.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Determining staticness is already possibly using the following hacky technique: make a &lt;code&gt;CALL&lt;&#x2F;code&gt; with limited gas, and inside that &lt;code&gt;CALL&lt;&#x2F;code&gt; issue one &lt;code&gt;LOG&lt;&#x2F;code&gt; and exit. If the context is static, the &lt;code&gt;CALL&lt;&#x2F;code&gt; would fail and leave a 0 on the stack; if the context is non-static, the &lt;code&gt;CALL&lt;&#x2F;code&gt; would succeed. However, this technique is fragile against changes to gas costs, and is needlessly wasteful. Hence, the status quo neither allows a reasonably effective way of determining whether or not the context is static, nor provides any kind of invariant that executions that do not fail outright will execute the same way in a static and non-static context. This EIP provides a cleaner way of determining staticness.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Wrapped Legacy Transactions</title>
        <published>2020-09-12T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2972/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2972-wrapped-legacy-transactions/4604" />
        

        <id>https://wg-eips.ritovision.com/2972/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2972"
            label="EIP-2972" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2972/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Two new transaction types for wrapping legacy transactions with and without a chain ID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces two new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transactions that are signature compatible with legacy transactions and can be automatically upgraded by any client.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x00 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data]))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x01 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;We would like to eventually deprecate legacy transactions so we no longer have to retain code in the networking and signer layer that deals with them.
However, we also want to ensure that signatures for transactions that were generated prior to that deprecation are still valid and funds don&#x27;t end up stuck because of an inability to sign a new style transaction.
This EIP provides a mechanism for transmitting&#x2F;including transactions in a way that is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; compatible while still being signature compatible with legacy transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;yParity&lt;&#x2F;code&gt; is the parity (0 for even, 1 for odd) of the &lt;code&gt;y&lt;&#x2F;code&gt; value of the curve point for which &lt;code&gt;r&lt;&#x2F;code&gt; is the &lt;code&gt;x&lt;&#x2F;code&gt; value in the secp256k1 signing process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transactions&quot;&gt;Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;0x00 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data]))&lt;&#x2F;code&gt; will be a valid transaction where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the RLP encoded transaction portion is signed&#x2F;processed&#x2F;handled exactly the same as legacy transactions were signed&#x2F;processed&#x2F;handled, with the exception of the final encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block transaction root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;0x01 || ssz.serialize(yParity, r, s, rlp([nonce, gasPrice, gasLimit, to, value, data, chainId, 0, 0]))&lt;&#x2F;code&gt; will be a valid transaction where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the RLP encoded transaction portion is signed&#x2F;processed&#x2F;handled exactly the same as legacy transactions were signed&#x2F;processed&#x2F;handled, with the exception of the final encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block transaction root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The SSZ schema for both transaction types is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Transaction[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  yParity: boolean,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  r: bytes32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  s: bytes32,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  signedData: bytes,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note: &lt;code&gt;sszencode(yParity, r, s, rlp(...))&lt;&#x2F;code&gt; is the same as &lt;code&gt;yParity || r || s || 0x45000000 || rlp(...)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;rlp(nonce, gasPrice, gasLimit, to, value, data, v, r, s)&lt;&#x2F;code&gt; will no longer be a valid transaction in a block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;0 || ssz.serialize(status, cumulativeGasUsed, logsBloom, logs)&lt;&#x2F;code&gt; will be a valid receipt where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; will be generated&#x2F;processed&#x2F;handled exactly the same as legacy receipts were processed&#x2F;handled with the exception of its encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block receipt root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;1 || ssz.serialize(status, cumulativeGasUsed, logsBloom, logs)&lt;&#x2F;code&gt; will be a valid receipt where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; will be generated&#x2F;processed&#x2F;handled exactly the same as legacy receipts were processed&#x2F;handled with the exception of its encoding&lt;&#x2F;li&gt;
&lt;li&gt;TODO: Hashing or Merkleizing for block receipt root&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The SSZ schema for both receipt types is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Log[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  address: bytes20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  topics: List[bytes32, 4],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data: List[uint8, 0xffffff],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Receipt[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  status: uint8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  cumulativeGasUsed: uint64,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logsBloom: BitVector[2048],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  logs: List[Log, 0xffffff],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;rlp(status, cumulativeGasUsed, logsBloom, logs)&lt;&#x2F;code&gt; will no longer be a valid receipt in a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;signature-doesn-t-include-transaction-type-as-first-signature-byte&quot;&gt;Signature doesn&#x27;t include transaction type as first signature byte&lt;&#x2F;h3&gt;
&lt;p&gt;These transaction types are explicitly designed to be signature compatible with legacy transactions, which means we cannot change the data being signed.
See Security Considerations section for more details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-transaction-types-instead-of-one&quot;&gt;Two transaction types instead of one&lt;&#x2F;h3&gt;
&lt;p&gt;With the introduction of typed transactions, we no longer need to do bit packing to avoid changing the shape of the signature.
Legacy transactions introduced chain ID in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; and wanted to avoid changing the transaction array length, so it bitpacked the chainID into the signature&#x27;s &lt;code&gt;v&lt;&#x2F;code&gt; value.
Since we no longer need to guarantee consistent payload lengths between transaction types, we have opted to have two transaction types with clear fields.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-separate-from-signed-data&quot;&gt;Signature separate from signed data&lt;&#x2F;h3&gt;
&lt;p&gt;When validating a signature, one must first separate out the signed data from the signature and then validate the signature against the signed data.
In the case of legacy transactions, this was a bit of a burden since you had to first RLP decode the transaction, then extract out the signature, then RLP encode a subset of the transaction.
EIP-155 made this process even worse by requiring the validator to further decode the &lt;code&gt;v&lt;&#x2F;code&gt; signature value to extract the chain ID (if present) and include that in the signed data payload.
By having the signed data encoded exactly as it is signed, we make it so one can verify the transaction&#x27;s signature without having to do any decoding before hand.
By having the signature SSZ encoded up front, we can easily extract the signature without even having to use a decoder.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ssz-for-serialization&quot;&gt;SSZ for serialization&lt;&#x2F;h3&gt;
&lt;p&gt;There is a weak consensus that RLP is not a particularly good encoding scheme for hashed data partially due to its inability to be streamed.
SSZ is almost certainly going to be included in Ethereum at some point in the future, so clients likely have access to an SSZ decoder.
For this particular case, manual decoding without a full SSZ decoder isn&#x27;t too complicated, though it does require doing a bit of &quot;pointer math&quot; since &lt;code&gt;logs&lt;&#x2F;code&gt; is an array of variable length items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;deprecating-legacy-transactions&quot;&gt;Deprecating legacy transactions&lt;&#x2F;h3&gt;
&lt;p&gt;By deprecating legacy transactions, we make it easier for clients as they can always deal with typed transactions in blocks.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;max-length-of-logs-and-logs-data&quot;&gt;Max length of logs and logs data&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;706&#x2F;&quot;&gt;EIP-706&lt;&#x2F;a&gt; limits devp2p messages to 24 bit length, which gives us a pragmatic cap at that for any single transaction at the moment.
This number seems to far exceed what is reasonable anytime in the near future, so feels like as reasonable of a cap as any.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new transactions are signature compatible with legacy transactions.
Legacy transactions can be decoded and then encoded as type 0 or type 1 transactions.
This EIP does not introduce any deprecation process for legacy encoded transactions, though the authors do encourage client developers to upgrade legacy encoded transactions to typed transactions as soon as it is reasonable.&lt;&#x2F;p&gt;
&lt;p&gt;The signature compatibility means that a client may see the same transaction encoded both ways.
In such a case the client can choose which to retain, but it is encouraged to retain the typed transaction rather than the legacy encoded transaction.
Since the two transactions would share a nonce, only one will ever be valid in a chain at a time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; strongly recommends including the transaction type as the first byte of the signed data, we cannot accomplish that in this case because we need to remain signature compatible with legacy transactions.
Luckily, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; also excludes transaction types &lt;code&gt;0xc0&lt;&#x2F;code&gt; to &lt;code&gt;0xfe&lt;&#x2F;code&gt; from valid transaction types, and the first byte of the signature in this case is in that range so we can be sure this will not conflict with any future transaction types.&lt;&#x2F;p&gt;
&lt;p&gt;A signature for these transaction types &lt;strong&gt;does&lt;&#x2F;strong&gt; collide with legacy transactions, but the transactions will be processed the same so it doesn&#x27;t matter if the transaction ends up included as a legacy transaction or a typed transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SET_INDESTRUCTIBLE opcode</title>
        <published>2020-09-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2937/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2937-set-indestructible/4571" />
        

        <id>https://wg-eips.ritovision.com/2937/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2937"
            label="EIP-2937" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2937/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add a &lt;code&gt;SET_INDESTRUCTIBLE (0xA8)&lt;&#x2F;code&gt; opcode that prevents the contract from calling &lt;code&gt;SELFDESTRUCT (0xFF)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The intended use case would be for contracts to make their first byte of code be the &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode if they wish to serve as libraries that guarantee to users that their code will exist unmodified forever. This is useful in account abstraction as well as other contexts.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike EIPs that disable the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode entirely, this EIP does not modify behavior of any existing contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a transaction-wide global variable &lt;code&gt;globals.indestructible: Set[Address]&lt;&#x2F;code&gt; (i.e. a variable that operates the same way as the selfdestructs set), initialized to the empty set.&lt;&#x2F;p&gt;
&lt;p&gt;Add a &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode at &lt;code&gt;0xA8&lt;&#x2F;code&gt;, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;, that adds the current &lt;code&gt;callee&lt;&#x2F;code&gt; to the &lt;code&gt;globals.indestructible&lt;&#x2F;code&gt; set. If in the current execution context the &lt;code&gt;callee&lt;&#x2F;code&gt; is in &lt;code&gt;globals.indestructible&lt;&#x2F;code&gt;, the &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode throws an exception.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Alternative proposals to this include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Simply banning &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; outright. This would be ideal, but has larger backwards compatibility issues.&lt;&#x2F;li&gt;
&lt;li&gt;Using a local variable instead of a global variable. This is problematic because it would be broken by &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This breaks forward compatibility with &lt;em&gt;some&lt;&#x2F;em&gt; forms of state rent, which would simply delete contracts that get too old without paying some maintenance fee. However, this is not the case with all state size control schemes; for example this is not an issue if we use &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ledgerwatch.github.io&#x2F;regenesis_plan.html&quot;&gt;ReGenesis&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is ever removed in the future, this EIP would simply become a no-op.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account Abstraction</title>
        <published>2020-09-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Ansgar Dietrichs</name><uri>https://github.com/adietrichs</uri>
	</author>
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Will Villanueva</name><uri>https://github.com/villanuevawill</uri>
	</author>
	
	<author>
		<name>Sam Wilson</name><uri>https://github.com/SamWilsn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2938/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2938-account-abstraction/4630" />
        

        <id>https://wg-eips.ritovision.com/2938/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2938"
            label="EIP-2938" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2938/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Account abstraction (AA) allows a contract to be the top-level account that pays fees and starts transaction execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;See also: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;implementing-account-abstraction-as-part-of-eth1-x&#x2F;4020&quot;&gt;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;implementing-account-abstraction-as-part-of-eth1-x&#x2F;4020&lt;&#x2F;a&gt; and the links therein for historical work and motivation.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Transaction validity, as of Muir Glacier, is defined rigidly by the protocol: ECDSA signature, a simple nonce, and account balance. Account abstraction extends the validity conditions of transactions with the execution of arbitrary EVM bytecode (with some limits on what state may be accessed.) To signal validity, we propose a new EVM opcode &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;, which also sets the gas price and gas limit the contract is willing to pay.&lt;&#x2F;p&gt;
&lt;p&gt;We split account abstraction into two tiers: &lt;strong&gt;single-tenant AA&lt;&#x2F;strong&gt;, which is intended to support wallets or other use cases with few participants, and &lt;strong&gt;multi-tenant AA&lt;&#x2F;strong&gt;, which is intended to support applications with many participants (eg. tornado.cash, Uniswap).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The existing limitations preclude innovation in a number of important areas, particularly:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Smart contract wallets that use signature verification other than ECDSA (eg. Schnorr, BLS, post-quantum...)&lt;&#x2F;li&gt;
&lt;li&gt;Smart contract wallets that include features such as multisig verification or social recovery, reducing the highly prevalent risk of funds being lost or stolen&lt;&#x2F;li&gt;
&lt;li&gt;Privacy-preserving systems like &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;tornado.cash&quot;&gt;tornado.cash&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Attempts to improve gas efficiency of DeFi protocols by preventing transactions that don&#x27;t satisfy high-level conditions (eg. existence of a matching order) from being included on chain&lt;&#x2F;li&gt;
&lt;li&gt;Users being able to pay for transaction fees in a token other than ETH (eg. by converting that token into the ETH needed for fees inside the transaction in real-time)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Most of the above use cases are currently possible using intermediaries, most notably the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.opengsn.org&#x2F;&quot;&gt;Gas Station Network&lt;&#x2F;a&gt; and application-specific alternatives. These implementations are (i) technically inefficient, due to the extra 21000 gas to pay for the relayer, (ii) economically inefficient, as relayers need to make a profit on top of the gas fees that they pay. Additionally, use of intermediary protocols means that these applications cannot simply rely on base Ethereum infrastructure and need to rely on extra protocols that have smaller userbases and higher risk of no longer being available at some future date.&lt;&#x2F;p&gt;
&lt;p&gt;Out of the five use cases above, single-tenant AA approximately supports (1) and (2), and multi-tenant AA approximately supports (3) and (4). We discuss the differences between the two tiers in the specification and rationale sections below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;single-tenant&quot;&gt;Single Tenant&lt;&#x2F;h3&gt;
&lt;p&gt;After &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, the following changes will be recognized by the protocol.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;2&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;&lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h4&gt;
&lt;p&gt;A new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with type &lt;code&gt;AA_TX_TYPE&lt;&#x2F;code&gt; is introduced. Transactions of this type are referred to as &quot;AA transactions&quot;. Their payload should be interpreted as &lt;code&gt;rlp([nonce, target, data])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The base gas cost of this transaction is set to &lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt; instead of 21000 to reflect the lack of &quot;intrinsic&quot; ECDSA and signature.&lt;&#x2F;p&gt;
&lt;p&gt;Nonces are processed analogously to existing transactions (check &lt;code&gt;tx.nonce == tx.target.nonce&lt;&#x2F;code&gt;, transaction is invalid if this fails, otherwise proceed and immediately set &lt;code&gt;tx.nonce += 1&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Note that this transaction type has no intrinsic gas limit; when beginning execution, the gas limit is simply set to the remaining gas in the block (ie. &lt;code&gt;block.gas_limit&lt;&#x2F;code&gt; minus gas spent on previous transactions), and the &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; opcode (see below) can adjust the gas limit downwards.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;transaction-wide-global-variables&quot;&gt;Transaction-wide global variables&lt;&#x2F;h4&gt;
&lt;p&gt;Introduce some new transaction-wide global variables. These variables work similarly (in particular, have similar reversion logic) to the SSTORE refunds counter.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Variable&lt;&#x2F;th&gt;&lt;th&gt;Type&lt;&#x2F;th&gt;&lt;th&gt;Initial value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;globals.transaction_fee_paid&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;bool&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;False if type(tx) == AA_TX_TYPE else True&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;globals.gas_price&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0 if type(tx) == AA_TX_TYPE else tx.gas_price&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;globals.gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;int&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0 if type(tx) == AA_TX_TYPE else tx.gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;nonce-0x48-opcode&quot;&gt;&lt;code&gt;NONCE (0x48)&lt;&#x2F;code&gt; Opcode&lt;&#x2F;h4&gt;
&lt;p&gt;A new opcode &lt;code&gt;NONCE (0x48)&lt;&#x2F;code&gt; is introduced, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;, which pushes the &lt;code&gt;nonce&lt;&#x2F;code&gt; of the callee onto the stack.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;paygas-0x49-opcode&quot;&gt;&lt;code&gt;PAYGAS (0x49)&lt;&#x2F;code&gt; Opcode&lt;&#x2F;h4&gt;
&lt;p&gt;A new opcode &lt;code&gt;PAYGAS (0x49)&lt;&#x2F;code&gt; is introduced, with gas cost &lt;code&gt;G_base&lt;&#x2F;code&gt;. It takes two arguments off the stack: (top) &lt;code&gt;version_number&lt;&#x2F;code&gt;, (second from top) &lt;code&gt;memory_start&lt;&#x2F;code&gt;. In the initial implementation, it will &lt;code&gt;assert version_number == 0&lt;&#x2F;code&gt; and read:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas_price = bytes_to_int(vm.memory[memory_start: memory_start + 32])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;gas_limit = bytes_to_int(vm.memory[memory_start + 32: memory_start + 64])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Both reads use similar mechanics to MLOAD and CALL, so memory expands if needed.&lt;&#x2F;p&gt;
&lt;p&gt;Future hard forks may add support for different version numbers, in which case the opcode may take different-sized memory slices and interpret them differently. Two particular potential use cases are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;@vbuterin&#x2F;BkSQmQTS8&quot;&gt;EIP 1559&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;another-simple-gas-fee-model-the-escalator-algorithm-from-the-agoric-papers&#x2F;6399&quot;&gt;the escalator mechanism&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode works as follows. If all three of the following conditions (in addition to the version number check above) are satisfied:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The account&#x27;s balance is &lt;code&gt;&amp;gt;= gas_price * gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;globals.transaction_fee_paid == False&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;We are in a top-level AA execution frame (ie. if the currently running EVM execution exits or reverts, the EVM execution of the entire transaction is finished)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Then do the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subtract &lt;code&gt;gas_price * gas_limit&lt;&#x2F;code&gt; from the contract&#x27;s balance&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;globals.transaction_fee_paid&lt;&#x2F;code&gt; to &lt;code&gt;True&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;globals.gas_price&lt;&#x2F;code&gt; to &lt;code&gt;gas_price&lt;&#x2F;code&gt;, and &lt;code&gt;globals.gas_limit&lt;&#x2F;code&gt; to &lt;code&gt;gas_limit&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Set the remaining gas in the current execution context to equal &lt;code&gt;gas_limit&lt;&#x2F;code&gt; minus the gas that was already consumed&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If any of the above three conditions are not satisfied, throw an exception.&lt;&#x2F;p&gt;
&lt;p&gt;At the end of execution of an AA transaction, it is mandatory that &lt;code&gt;globals.transaction_fee_paid == True&lt;&#x2F;code&gt;; if it is not, then the transaction is invalid. At the end of execution, the contract is refunded &lt;code&gt;globals.gas_price * remaining_gas&lt;&#x2F;code&gt; for any remaining gas, and &lt;code&gt;(globals.gas_limit - remaining_gas) * globals.gas_price&lt;&#x2F;code&gt; is transferred to the miner.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;PAYGAS&lt;&#x2F;code&gt; also serves as an EVM execution &lt;em&gt;checkpoint&lt;&#x2F;em&gt;: if the top-level execution frame reverts after &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; has been called, then the execution only reverts up to the point right after &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; was called, and exits there. In that case, the contract receives no refund, and &lt;code&gt;globals.gas_limit * globals.gas_price&lt;&#x2F;code&gt; is transferred to the miner.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;replay-protection&quot;&gt;Replay Protection&lt;&#x2F;h4&gt;
&lt;p&gt;One of the two following approaches must be implemented to safeguard against replay attacks.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;require-set-indestructible&quot;&gt;Require &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;Require that contracts targeted by AA transactions begin with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2937&#x2F;&quot;&gt;EIP-2937&lt;&#x2F;a&gt;&#x27;s &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode. AA transactions targeting contracts that do not begin with &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; are invalid, and cannot be included in blocks.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt; would need to be modified to include this opcode.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;preserve-nonce-on-selfdestruct&quot;&gt;Preserve Nonce on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;h5&gt;
&lt;p&gt;The other option is to preserve contract nonces across &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; invocations, instead of setting the nonce to zero.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;miscellaneous&quot;&gt;Miscellaneous&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;CALLER (0x33)&lt;&#x2F;code&gt; is invoked in the first frame of
execution of a call initiated by an AA transaction, then it must return &lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;ORIGIN (0x32)&lt;&#x2F;code&gt; is invoked in any frame of execution of an AA
transaction it must return &lt;code&gt;AA_ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;GASPRICE (0x3A)&lt;&#x2F;code&gt; opcode now pushes the value &lt;code&gt;globals.gas_price&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note that the new definition of &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; does not lead to any changes in behavior in non-AA transactions, because &lt;code&gt;globals.gas_price&lt;&#x2F;code&gt; is initialized to &lt;code&gt;tx.gas_price&lt;&#x2F;code&gt; and cannot be changed as &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; cannot be called.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mining-and-rebroadcasting-strategies&quot;&gt;Mining and Rebroadcasting Strategies&lt;&#x2F;h4&gt;
&lt;p&gt;Much of the complexity in account abstraction originates from the strategies used by miners and validating nodes to determine whether or not to accept and rebroadcast transactions. Miners need to determine if a transaction will actually pay the fee if they include it after only a small amount of processing to avoid &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackingdistributed.com&#x2F;2016&#x2F;06&#x2F;28&#x2F;ethereum-soft-fork-dos-vector&#x2F;&quot;&gt;DoS attacks&lt;&#x2F;a&gt;. Validating nodes need to perform an essentially identical verification to determine whether or not to rebroadcast the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;By keeping the consensus changes minimal, this EIP allows for gradual introduction of AA mempool support by miners and validating nodes. Initial support would be focused on enabling simple, single-tenant use cases, while later steps would additionally allow for more complex, multi-tenant use cases. Earlier stages are deliberately more fully fleshed-out than later stages, as there is still more time before later stages need to be implemented.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;transactions-with-fixed-nonces&quot;&gt;Transactions with Fixed Nonces&lt;&#x2F;h5&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VERIFICATION_GAS_MULTIPLIER&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;6&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;= VERIFICATION_GAS_MULTIPLIER * AA_BASE_GAS_COST = 90000&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;if(msg.sender != shr(-1, 12)) { LOG1(msg.sender, msg.value); return }&lt;&#x2F;code&gt;; compilation to EVM TBD&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When a node receives an AA transaction, they process it (i.e. attempt to execute it against the current chain head&#x27;s post-state) to determine its validity, continuing to execute until one of several events happens:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the code of the &lt;code&gt;target&lt;&#x2F;code&gt; is NOT prefixed with &lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt;, exit with failure&lt;&#x2F;li&gt;
&lt;li&gt;If the execution hits any of the following, exit with failure:
&lt;ul&gt;
&lt;li&gt;An environment opcode (&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;, &lt;code&gt;COINBASE&lt;&#x2F;code&gt;, &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt;, &lt;code&gt;NUMBER&lt;&#x2F;code&gt;, &lt;code&gt;DIFFICULTY&lt;&#x2F;code&gt;, &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt; (of any account, including the &lt;code&gt;target&lt;&#x2F;code&gt; itself)&lt;&#x2F;li&gt;
&lt;li&gt;An external call&#x2F;create that changes the &lt;code&gt;callee&lt;&#x2F;code&gt; to anything but the &lt;code&gt;target&lt;&#x2F;code&gt; or a precompile (&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;An external state access that reads code (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, but also &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;), unless the address of the code that is read is the &lt;code&gt;target&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If the execution consumes more gas than &lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt; (specified above), or more gas than is available in the block, exit with failure&lt;&#x2F;li&gt;
&lt;li&gt;If the execution reaches &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;, then exit with success or failure depending on whether or not the balance is sufficient (e.g. &lt;code&gt;balance &amp;gt;= gas_price * gas_limit&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Nodes do not keep transactions with nonces higher than the current valid nonce in the mempool. If the mempool already contains a transaction with a currently valid nonce, another incoming transaction to the same contract and with the same nonce either replaces the existing one (if its gas price is sufficiently higher) or is dropped. Thus, the mempool keeps only at most one pending transaction per account.&lt;&#x2F;p&gt;
&lt;p&gt;While processing a new block, take note of which accounts were the &lt;code&gt;target&lt;&#x2F;code&gt; of an AA transaction (each block currently has &lt;code&gt;12500000&lt;&#x2F;code&gt; gas and an AA transaction costs &lt;code&gt;&amp;gt;= 15000&lt;&#x2F;code&gt; so there would be at most &lt;code&gt;12500000 &#x2F;&#x2F; 15000 = 833&lt;&#x2F;code&gt; targeted accounts). Drop all pending transactions targeting those accounts. All other transactions remain in the mempool.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;single-tenant-1&quot;&gt;Single Tenant+&lt;&#x2F;h3&gt;
&lt;p&gt;If the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2937&quot;&gt;indestructible contracts EIP&lt;&#x2F;a&gt; is added, Single Tenant AA can be adapted to allow for &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; during transaction verification: during execution of a new AA transaction, external state access that reads code (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;) of any contract whose first byte is the &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode is no longer banned. However, calls to anything but the &lt;code&gt;target&lt;&#x2F;code&gt; or a precompile that change the &lt;code&gt;callee&lt;&#x2F;code&gt; (i.e., calls other than &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;) are still not permitted.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2975&quot;&gt;IS_STATIC EIP&lt;&#x2F;a&gt; is added, the list of allowed prefixes can be extended to allow a prefix that enables incoming static calls but not state-changing calls.&lt;&#x2F;p&gt;
&lt;p&gt;The list of allowed prefixes can also be extended to enable other benign use cases (eg. logging incoming payments).&lt;&#x2F;p&gt;
&lt;p&gt;External calls &lt;em&gt;into&lt;&#x2F;em&gt; AA accounts can be allowed as follows. We can add an opcode &lt;code&gt;RESERVE_GAS&lt;&#x2F;code&gt;, which takes as argument a value &lt;code&gt;N&lt;&#x2F;code&gt; and has simple behavior: immediately burn &lt;code&gt;N&lt;&#x2F;code&gt; gas and add &lt;code&gt;N&lt;&#x2F;code&gt; gas to the refund. We then add an allowed &lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt; that reserves &lt;code&gt;&amp;gt;= AA_BASE_GAS_COST * 2&lt;&#x2F;code&gt; gas. This ensures that at least &lt;code&gt;AA_BASE_GAS_COST&lt;&#x2F;code&gt; gas must be spent (as refunds can refund max 50% of total consumption) in order to call into an account and invalidate transactions targeting that account in the mempool, preserving that invariant.&lt;&#x2F;p&gt;
&lt;p&gt;Note that accounts may also opt to set a higher &lt;code&gt;RESERVE_GAS&lt;&#x2F;code&gt; value in order to safely have a higher &lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt;; the goal would be to preserve a &lt;code&gt;VERIFICATION_GAS_MULTIPLIER&lt;&#x2F;code&gt;-to-1 ratio between the minimum gas cost to edit an account (ie. half its &lt;code&gt;RESERVE_GAS&lt;&#x2F;code&gt;) and the &lt;code&gt;VERIFICATION_GAS_CAP&lt;&#x2F;code&gt; that is permitted that account. This would also preserve invariants around maximum reverification gas consumption that are implied by the previous section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-tenant-beyond&quot;&gt;Multi-Tenant &amp;amp; Beyond&lt;&#x2F;h3&gt;
&lt;p&gt;In a later stage, we can add support for multiple pending transactions per account in the mempool. The main challenge here is that a single transaction can potentially cause state changes that invalidate all other transactions to that same account. Additionally, if we naively prioritize transactions by gasprice, there is an attack vector where the user willing to pay the highest gasprice publishes many (mutually exclusive) versions of their transaction with small alterations, thereby pushing everyone else&#x27;s transactions out of the mempool.&lt;&#x2F;p&gt;
&lt;p&gt;Here is a sketch of a strategy for mitigating this problem. We would require incoming transactions to contain an &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;02930.md&quot;&gt;EIP-2930&lt;&#x2F;a&gt;-style access list detailing the storage slots that the transaction reads or modifies, and make it binding; that is, accesses outside the access list would be invalid. A transaction would only be included in the mempool if its access list is disjoint from the access lists of other transactions in the mempool (or if its gasprice is higher). An alternative way to think about this is to have per-storage-slot mempools instead of just per-account mempools, except a transaction could be part of multiple per-storage-slot mempools (if desired it could be capped to eg. 5 storage slots).&lt;&#x2F;p&gt;
&lt;p&gt;Note also that multi-tenant AA will almost certainly require allowing miners to edit the nonces of incoming transactions to put them into sequence, with the result that the final hash of a transaction is unpredictable at publication time. Clients will need to explicitly work around this.&lt;&#x2F;p&gt;
&lt;p&gt;More research is required to refine these ideas, and this is left for later work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The core problem in an account abstraction setup is always that miners and network nodes need to be able to verify that a transaction that they attempt to include, or rebroadcast, will actually pay a fee. Currently, this is fairly simple, because a transaction is guaranteed to be includable and pay a fee as long as the signature and nonce are valid and the balance and gasprice are sufficient. These checks can be done quickly.&lt;&#x2F;p&gt;
&lt;p&gt;In an account abstraction setup, the goal is to allow accounts to specify EVM code that can establish more flexible conditions for a transaction&#x27;s validity, but with the requirement that this EVM code can be quickly verified, with the same safety properties as the existing setup.&lt;&#x2F;p&gt;
&lt;p&gt;In a normal transaction, the top-level call goes from the &lt;code&gt;tx.sender&lt;&#x2F;code&gt; to &lt;code&gt;tx.to&lt;&#x2F;code&gt; and carries with it &lt;code&gt;tx.value&lt;&#x2F;code&gt;. In an AA transaction, the top-level call goes from the &lt;em&gt;entry point address&lt;&#x2F;em&gt; (&lt;code&gt;0xFFFF...FF&lt;&#x2F;code&gt;) to the &lt;code&gt;tx.target&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The top-level code execution is expected to be split into two phases: the shorter &lt;strong&gt;verification phase&lt;&#x2F;strong&gt; (before &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;) and the longer &lt;strong&gt;execution phase&lt;&#x2F;strong&gt; (after &lt;code&gt;PAYGAS&lt;&#x2F;code&gt;). If execution throws an exception during the verification phase, the transaction is invalid, much like a transaction with an invalid signature in the current system. If execution throws an exception after the verification phase, the transaction pays fees, and so the miner can still include it.&lt;&#x2F;p&gt;
&lt;p&gt;The transition between different stages of AA is entirely done through changes in miner strategy. The first stage supports &lt;strong&gt;single-tenant AA&lt;&#x2F;strong&gt;, where the only use cases that can be easily implemented are where the &lt;code&gt;tx.target&lt;&#x2F;code&gt; is a contract representing a user account (that is, a smart contract wallet, eg. multisig). Later stages improve support for eg. logs and libraries, and also move toward supporting &lt;strong&gt;multi-tenant AA&lt;&#x2F;strong&gt;, where the goal is to try to support cases where the &lt;code&gt;tx.target&lt;&#x2F;code&gt; represents an &lt;em&gt;application&lt;&#x2F;em&gt; that processes incoming activity from multiple users.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonces-still-enshrined-in-single-tenant-aa&quot;&gt;Nonces still enshrined in single-tenant AA&lt;&#x2F;h3&gt;
&lt;p&gt;Nonces are still enforced in single-tenant AA to ensure that single-target AA does not break the invariant that each transaction (and hence each transaction hash) can only be included in the chain once. While there is some limited value in allowing arbitrary-order transaction inclusion in single-tenant AA, there is not enough value to justify breaking that invariant.&lt;&#x2F;p&gt;
&lt;p&gt;Note that nonces in AA accounts do end up having a dual-purpose: they are both there for replay protection and for contract address generation when using the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode. This does mean that a single transaction could increment the nonce by more than 1. This is deemed acceptable, as the other mechanics introduced by AA already break the ability to easily verify that a chain longer than one transaction can be processed. However, we strongly recommend that AA contracts use &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instead of &lt;code&gt;CREATE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In multi-tenant AA, as mentioned above, nonces are expected to become malleable and applications that use multi-tenant AA systems would need to manage this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonces-are-exposed-to-the-evm&quot;&gt;Nonces are exposed to the EVM&lt;&#x2F;h3&gt;
&lt;p&gt;This is done to allow signature checking done in validation code to validate the nonce.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;replay-protection-1&quot;&gt;Replay Protection&lt;&#x2F;h3&gt;
&lt;p&gt;One of the above two approaches (requiring &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; or modifying &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; behavior) must be implemented so that nonces cannot be reused. It must be a consensus change, and not simply part of &lt;code&gt;AA_PREFIX&lt;&#x2F;code&gt;, so that transaction hash uniqueness is maintained.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;miners-refuse-transactions-that-access-external-data-or-the-target-s-own-balance-before-paygas&quot;&gt;Miners refuse transactions that access external data or the target&#x27;s own balance, before PAYGAS&lt;&#x2F;h3&gt;
&lt;p&gt;An important property of traditional transactions is that activity happening as part of transactions that originate outside of some given account X cannot make transactions whose sender is X invalid. The only state change that an outside transaction can impose on X is increasing its balance, which cannot invalidate a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing AA contracts to access external data (both other accounts and environment variables such as GASPRICE, DIFFICULTY, etc.) before they call &lt;code&gt;PAYGAS&lt;&#x2F;code&gt; (ie. during the verification phase) breaks this invariant. For example, imagine someone sends many thousands of AA transactions that perform an external call &lt;code&gt;if FOO.get_number() != 5: throw()&lt;&#x2F;code&gt;. &lt;code&gt;FOO.number&lt;&#x2F;code&gt; might be set to &lt;code&gt;5&lt;&#x2F;code&gt; when those transactions are all sent, but a single transaction to &lt;code&gt;FOO&lt;&#x2F;code&gt; could set the &lt;code&gt;number&lt;&#x2F;code&gt; to something else, invalidating &lt;em&gt;all of the thousands of AA transactions&lt;&#x2F;em&gt; that depend on it. This would be a serious DoS vector.&lt;&#x2F;p&gt;
&lt;p&gt;The one allowed exception is contracts that are indestructible (that is, whose first byte is the &lt;code&gt;SET_INDESTRUCTIBLE&lt;&#x2F;code&gt; opcode defined in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;hackmd.io&#x2F;@HWeNw8hNRimMm2m2GH56Cw&#x2F;SyNT3Cdmw&quot;&gt;this EIP&lt;&#x2F;a&gt;). This is a safe exception, because the data that is being read cannot be changed.&lt;&#x2F;p&gt;
&lt;p&gt;Disallowing reading &lt;code&gt;BALANCE&lt;&#x2F;code&gt; blocks a milder attack vector: an attacker could force a transaction to be reprocessed at a mere cost of 6700 gas (not 15000 or 21000), in the worst case more than doubling the number of transactions that would need to be reprocessed.&lt;&#x2F;p&gt;
&lt;p&gt;In the long term, AA could be expanded to allow reading external data, though protections such as mandatory access lists would be required.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;aa-transactions-must-call-contracts-with-prefix&quot;&gt;AA transactions must call contracts with prefix&lt;&#x2F;h3&gt;
&lt;p&gt;The prelude is used to ensure that &lt;em&gt;only&lt;&#x2F;em&gt; AA transactions can call the contract. This is another measure taken to ensure the invariant described above. If this check did not occur, it would be possible for a transaction originating outside some AA account X to call into X and make a storage change, forcing transactions targeting that account to be reprocessed at the cost of a mere 5000 gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multi-tenant-aa&quot;&gt;Multi-tenant AA&lt;&#x2F;h3&gt;
&lt;p&gt;Multi-tenant AA extends single-tenant AA by &lt;strong&gt;better handling cases where distinct and uncoordinated users attempt to send transactions for&#x2F;to the same account and those transactions may interfere with each other&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;We can understand the value of multi-tenant AA by examining two example use cases: (i) &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;tornado.cash&quot;&gt;tornado.cash&lt;&#x2F;a&gt; and (ii) &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;uniswap.exchange&quot;&gt;Uniswap&lt;&#x2F;a&gt;. In both of these cases, there is a single central contract that represents the application, and not any specific user. Nevertheless, there is important value in using abstraction to do application-specific validation of transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tornado-cash&quot;&gt;Tornado Cash&lt;&#x2F;h4&gt;
&lt;p&gt;The tornado.cash workflow is as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A user sends a transaction to the TC contract, depositing some standard quantity of coins (eg. 1 ETH). A record of their deposit, containing the hash of a secret known by the user, is added to a Merkle tree whose root is stored in the TC contract.&lt;&#x2F;li&gt;
&lt;li&gt;When that user later wants to withdraw, they generate and send a ZK-SNARK proving that they know a secret whose hash is in a leaf somewhere in the deposit tree (without revealing where). The TC contract verifies the ZK-SNARK, and also verifies that a nullifier value (also derivable from the secret) has not yet been spent. The contract sends 1 ETH to the user&#x27;s desired address, and saves a record that the user&#x27;s nullifier has been spent.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The privacy provided by TC arises because when a user makes a withdrawal, they can prove that it came from &lt;em&gt;some&lt;&#x2F;em&gt; unique deposit, but no one other than the user knows which deposit it came from. However, implementing TC naively has a fatal flaw: the user usually does not yet have ETH in their withdrawal address, and if the user uses their deposit address to pay for gas, that creates an on-chain link between their deposit address and their withdrawal address.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, this is solved via relayers; a third-party relayer verifies the ZK-SNARK and unspent status of the nullifier, publishes the transaction using their own ETH to pay for gas, and collects the fee back from the user from the TC contract.&lt;&#x2F;p&gt;
&lt;p&gt;AA allows this without relayers: the user could simply send an AA transaction targeting the TC contract, the ZK-SNARK verification and the nullifier checking can be done in the verification step, and PAYGAS can be called directly after that. This allows the withdrawer to pay for gas directly out of the coins going to their withdrawal address, avoiding the need for relayers or for an on-chain link to their deposit address.&lt;&#x2F;p&gt;
&lt;p&gt;Note that fully implementing this functionality requires AA to be structured in a way that supports multiple users sending withdrawals at the same time (requiring nonces would make this difficult), and that allows a single account to support both AA transactions (the withdrawals) and externally-initiated calls (the deposits).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;uniswap&quot;&gt;Uniswap&lt;&#x2F;h4&gt;
&lt;p&gt;A new version of Uniswap could be built that allows transactions to be sent that directly target the Uniswap contract. Users could deposit tokens into Uniswap ahead of time, and Uniswap would store their balances as well as a public key that transactions spending those balances could be verified against. An AA-initiated Uniswap trade would only be able to spend these internal balances.&lt;&#x2F;p&gt;
&lt;p&gt;This would be useless for normal traders, as normal traders have their coins outside the Uniswap contract, but it would be a powerful boon to arbitrageurs. Arbitrageurs would deposit their coins into Uniswap, and they would be able to send transactions that perform arbitrage every time external market conditions change, and logic such as price limits could be enforced during the verification step. Hence, transactions that do not get in (eg. because some other arbitrageur made the trade first) would not be included on-chain, allowing arbitrageurs to not pay gas, and reducing the number of &quot;junk&quot; transactions that get included on-chain. This could significantly increase both de-facto blockchain scalability as well as market efficiency, as arbitrageurs would be able to much more finely correct for cross-exchange discrepancies between prices.&lt;&#x2F;p&gt;
&lt;p&gt;Note that here also, Uniswap would need to support both AA transactions and externally-initiated calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This AA implementation preserves the existing transaction type. The use of &lt;code&gt;assert origin == caller&lt;&#x2F;code&gt; to verify that an account is an EOA remains sound, but is not extensible to AA accounts; AA transactions will always have &lt;code&gt;origin == AA_ENTRY_POINT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Badly-designed single-tenant AA contracts will break the transaction non-malleability invariant. That is, it is possible to take an AA transaction in-flight, modify it, and have the modified version still be valid; AA account contracts can be designed in such a way as to make that not possible, but it is their responsibility. Multi-tenant AA will break the transaction non-malleability invariant much more thoroughly, making the transaction hash unpredictable even for legitimate applications that use the multi-tenant AA features (though the invariant will not further break for applications that existed before then).&lt;&#x2F;p&gt;
&lt;p&gt;AA contracts may not have replay protection unless they build it in explicitly; this can be done with the &lt;code&gt;CHAINID (0x46)&lt;&#x2F;code&gt; opcode introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP 1344&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;See: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;tests&#x2F;tree&#x2F;account-abstraction&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;tests&#x2F;tree&#x2F;account-abstraction&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;See: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;go-ethereum&#x2F;tree&#x2F;account-abstraction&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;quilt&#x2F;go-ethereum&#x2F;tree&#x2F;account-abstraction&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;dos-vectors-in-account-abstraction-aa-or-validation-generalization-a-case-study-in-geth&#x2F;7937&quot;&gt;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;dos-vectors-in-account-abstraction-aa-or-validation-generalization-a-case-study-in-geth&#x2F;7937&lt;&#x2F;a&gt; for an analysis of DoS issues.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;re-validation&quot;&gt;Re-validation&lt;&#x2F;h3&gt;
&lt;p&gt;When a transaction enters the mempool, the client is able to quickly ascertain whether the transaction is valid. Once it determines this, it can be confident that the transaction will continue to be valid unless a transaction from the same account invalidates it.&lt;&#x2F;p&gt;
&lt;p&gt;There are, however, cases where an attacker can publish a transaction that invalidates existing transactions and requires the network to perform more recomputation than the computation in the transaction itself. The EIP maintains the invariant that recomputation is bounded to a theoretical maximum of six times the block gas limit in a single block; this is somewhat more expensive than before, but not that much more expensive.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;peer-denial-of-service&quot;&gt;Peer denial-of-service&lt;&#x2F;h4&gt;
&lt;p&gt;Denial-of-Service attacks are difficult to defend against, due to the difficulty in identifying sybils within a peer list. At any moment, one may decide (or be bribed) to initiate an attack. This is not a problem that Account Abstraction introduces. It can be accomplished against existing clients today by inundating a target with transactions whose signatures are invalid. However, due to the increased allotment of validation work allowed by AA, it&#x27;s important to bound the amount of computation an adversary can force a client to expend with invalid transactions. For this reason, it&#x27;s best for the miner to follow the recommended mining strategies.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Serve historical block hashes from state</title>
        <published>2020-09-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Tomasz Stanczak</name><uri>https://github.com/tkstanczak</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Gajinder Singh</name><uri>https://github.com/g11tech</uri>
	</author>
	
	<author>
		<name>Tanishq Jasoria</name><uri>https://github.com/tanishqjasoria</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Sina Mahmoodi</name><uri>https://github.com/s1na</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2935/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2935-save-historical-block-hashes-in-state/4565" />
        

        <id>https://wg-eips.ritovision.com/2935/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2935"
            label="EIP-2935" />
        

        
        

        
        <summary type="html">Store and serve last 8191 block hashes as storage slots of a system contract to allow for stateless execution</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2935/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Store last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; historical block hashes in the storage of a system contract as part of the block processing logic. Furthermore this EIP has no impact on &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; resolution mechanism (and hence its range&#x2F;costs etc).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EVM implicitly assumes the client has the recent block (hashes) at hand. This assumption is not future-proof given the prospect of stateless clients. Including the block hashes in the state will allow bundling these hashes in the witness provided to a stateless client. This is already possible in the MPT and will become more efficient post-Verkle.&lt;&#x2F;p&gt;
&lt;p&gt;Extending the range of blocks which &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; can serve (&lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;) would have been a semantics change. Using extending that via this contract storage would allow a soft-transition. Rollups can benefit from the longer history window through directly querying this contract.&lt;&#x2F;p&gt;
&lt;p&gt;A side benefit of this approach could be that it allows building&#x2F;validating proofs related to last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; ancestors directly against the current state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;8191&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This EIP specifies for storing last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; block hashes in a ring buffer storage of &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; length. Note that &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;BLOCKHASH_SERVE_WINDOW&lt;&#x2F;code&gt; (which remains unchanged).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-processing&quot;&gt;Block processing&lt;&#x2F;h3&gt;
&lt;p&gt;At the start of processing any block where this EIP is active (ie. before processing any transactions), call to &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; as &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; with the 32-byte input of &lt;code&gt;block.parent.hash&lt;&#x2F;code&gt;, a gas limit of &lt;code&gt;30_000_000&lt;&#x2F;code&gt;, and &lt;code&gt;0&lt;&#x2F;code&gt; value. This will trigger the &lt;code&gt;set()&lt;&#x2F;code&gt; routine of the history contract. This is a system operation following the same convention as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and therefore:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the call must execute to completion&lt;&#x2F;li&gt;
&lt;li&gt;the call does not count against the block&#x27;s gas limit&lt;&#x2F;li&gt;
&lt;li&gt;the call does not follow the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; burn semantics - no value should be transferred as part of the call&lt;&#x2F;li&gt;
&lt;li&gt;if no code exists at &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt;, the call must fail silently&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note: Alternatively clients can choose to directly write to the storage of the contract but EVM calling the contract remains preferred. Refer to the rationale for more info.&lt;&#x2F;p&gt;
&lt;p&gt;Note that, it will take &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; blocks after the EIP&#x27;s activation to completely fill up the ring buffer. The contract will only contain the parent hash of the fork block and no hashes prior to that.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;evm-changes&quot;&gt;EVM Changes&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; opcode semantics remains the same as before.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-hash-history-contract&quot;&gt;Block hash history contract&lt;&#x2F;h3&gt;
&lt;p&gt;The history contract has two operations: &lt;code&gt;get&lt;&#x2F;code&gt; and &lt;code&gt;set&lt;&#x2F;code&gt;. The &lt;code&gt;set&lt;&#x2F;code&gt; operation is invoked only when the &lt;code&gt;caller&lt;&#x2F;code&gt; is equal to the &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;. Otherwise the &lt;code&gt;get&lt;&#x2F;code&gt; operation is performed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;get&quot;&gt;&lt;code&gt;get&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;It is used from the EVM for looking up block hashes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Callers provide the block number they are querying in a big-endian encoding.&lt;&#x2F;li&gt;
&lt;li&gt;If calldata is not 32 bytes, revert.&lt;&#x2F;li&gt;
&lt;li&gt;For any request outside the range of [block.number-&lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt;, block.number-1], revert.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;set&quot;&gt;&lt;code&gt;set&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Caller provides &lt;code&gt;block.parent.hash&lt;&#x2F;code&gt; as calldata to the contract.&lt;&#x2F;li&gt;
&lt;li&gt;Set the storage value at &lt;code&gt;block.number-1 % HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; to be &lt;code&gt;calldata[0:32]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;bytecode&quot;&gt;Bytecode&lt;&#x2F;h4&gt;
&lt;p&gt;Exact evm assembly that can be used for the history contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&#x2F;&#x2F; https:&#x2F;&#x2F;github.com&#x2F;lightclient&#x2F;sys-asm&#x2F;blob&#x2F;f1c13e285b6aeef2b19793995e00861bf0f32c9a&#x2F;src&#x2F;execution_hash&#x2F;main.eas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;caller&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push20 0xfffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x46&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push2 0x1fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dup2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push2 0x1fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;swap1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;revert&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push2 0x1fff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;push1 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;deployment&quot;&gt;Deployment&lt;&#x2F;h4&gt;
&lt;p&gt;A special synthetic address is generated by working backwards from the desired deployment transaction:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x3d090&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;gasPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xe8d4a51000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxPriorityFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;maxFeePerGas&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; null&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;input&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x60538060095f395ff33373fffffffffffffffffffffffffffffffffffffffe14604657602036036042575f35600143038111604257611fff81430311604257611fff9006545f5260205ff35b5f5ffd5b5f35611fff60014303065500&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;v&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x1b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;r&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x539&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;s&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xaa12693182426612186309f02cfe8a80a0000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x67139a552b0d3fffc30c0fa7d0c20d42144138c8fe07fc5691f09c1cce632e15&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note, the input in the transaction has a simple constructor prefixing the desired runtime code.&lt;&#x2F;p&gt;
&lt;p&gt;The sender of the transaction can be calculated as &lt;code&gt;0x3462413Af4609098e1E27A490f554f260213D685&lt;&#x2F;code&gt;. The address of the first contract deployed from the account is &lt;code&gt;rlp([sender, 0])&lt;&#x2F;code&gt; which equals &lt;code&gt;0x0000F90827F1C53a10cb7A02335B175320002935&lt;&#x2F;code&gt;. This is how &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; is determined. Although this style of contract creation is not tied to any specific initcode like create2 is, the synthetic address is cryptographically bound to the input data of the transaction (e.g. the initcode).&lt;&#x2F;p&gt;
&lt;p&gt;Some activation scenarios:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For the fork to be activated at genesis, no history is written to the genesis state, and at the start of block &lt;code&gt;1&lt;&#x2F;code&gt;, genesis hash will be written as a normal operation to slot &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;for activation at block &lt;code&gt;1&lt;&#x2F;code&gt;, only genesis hash will be written at slot &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;for activation at block &lt;code&gt;32&lt;&#x2F;code&gt;, block &lt;code&gt;31&lt;&#x2F;code&gt;&#x27;s hash will be written to slot &lt;code&gt;31&lt;&#x2F;code&gt;. Every other slot will be &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;eip-161-handling&quot;&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; handling&lt;&#x2F;h3&gt;
&lt;p&gt;The bytecode above will be deployed à la &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt;. As such the account at &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; will have code and a nonce of 1, and will be exempt from EIP-161 cleanup.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The system update at the beginning of the block, i.e. &lt;code&gt;process_block_hash_history&lt;&#x2F;code&gt; (or via system call to the contract with &lt;code&gt;SYSTEM_ADDRESS&lt;&#x2F;code&gt; caller), will not warm the &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; account or its storage slots as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; rules. As such the first call to the contract will pay for warming up the account and storage slots it accesses.To clarify further any contract call to the &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; will follow normal EVM execution semantics.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; semantics doesn&#x27;t change, this EIP has no impact on &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; mechanism and costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Very similar ideas were proposed before. This EIP is a simplification, removing two sources of needless complexity:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Having a tree-like structure with multiple layers as opposed to a single list&lt;&#x2F;li&gt;
&lt;li&gt;Writing the EIP in EVM code&lt;&#x2F;li&gt;
&lt;li&gt;Serial unbounded storage of hashes for a deep access to the history&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;However after weighing pros and cons, we decided to go with just a limited ring buffer to only serve the requisite &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and beacon state accumulators allow (albeit a bit more complex) proof against any ancestor since merge.&lt;&#x2F;p&gt;
&lt;p&gt;Second concern was how to best transition the BLOCKHASH resolution logic post fork by:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Either waiting for  &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; blocks for the entire relevant history to persist&lt;&#x2F;li&gt;
&lt;li&gt;Storing of all last &lt;code&gt;HISTORY_SERVE_WINDOW&lt;&#x2F;code&gt; block hashes on the fork block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We choose to go with the former. It simplifies the logic greatly. It will take roughly a day to bootstrap the contract. Given that this is a new way of accessing history and no contract depends on it, it is deemed a favorable tradeoff.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;inserting-the-parent-block-hash&quot;&gt;Inserting the parent block hash&lt;&#x2F;h3&gt;
&lt;p&gt;Clients have generally two options for inserting the parent block hash into state:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Performing a system call to &lt;code&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;code&gt; and letting that handle the storing in state.&lt;&#x2F;li&gt;
&lt;li&gt;Avoid EVM processing and directly write to the state trie.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The latter option is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_block_hash_history&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; State&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FORK_TIMESTAMP&lt;&#x2F;span&gt;&lt;span&gt; should&lt;&#x2F;span&gt;&lt;span&gt; be&lt;&#x2F;span&gt;&lt;span&gt; defined&lt;&#x2F;span&gt;&lt;span&gt; outside&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; the&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; EIP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;insert_slot&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;HISTORY_STORAGE_ADDRESS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HISTORY_SERVE_WINDOW&lt;&#x2F;span&gt;&lt;span&gt; ,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;hash&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The first option is recommended until the Verkle fork, to stay consistent with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4788&#x2F;&quot;&gt;EIP-4788&lt;&#x2F;a&gt; and to issues for misconfigured networks where this EIP is activated but history contract hasn&#x27;t been deployed. The recommendation may be reconsidered at the Verkle fork if filtering the system contract code chunks is deemed too complex.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-ring-buffers&quot;&gt;Size of ring buffers&lt;&#x2F;h3&gt;
&lt;p&gt;The ring buffer data structure is sized to hold 8191 hashes. In other system contracts a prime ring buffer size is chosen in because using a prime as the modulus ensures that no value is overwritten until the entire ring buffer has been saturated and thereafter, each value will be updated once per iteration, regardless of if some slot are missing or the slot time changes. However, in this EIP the block number is the value in the modulo operation and it only ever increases by 1 each iteration. Which means we can be confident that the ring buffer will always remain saturated.&lt;&#x2F;p&gt;
&lt;p&gt;For consistency with other system contracts, we have decided to retain the buffer size of 8191. Given the current mainnet values, 8191 roots provides about a day of coverage. This also gives users plenty of time to make a transaction with a verification against a specific hash and get the transaction included on-chain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces backwards incompatible changes to the block validation rule set. But neither of these changes break anything related to current user activity and experience.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;3810d22f84f206866f66f4f6bf856187c2893ab1&#x2F;tests&#x2F;prague&#x2F;eip2935_historical_block_hashes_from_state&quot;&gt;EIP-2935 Execution Spec Tests&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Having contracts (system or otherwise) with hot update paths (branches) poses a risk of &quot;branch&quot; poisoning attacks where attacker could sprinkle trivial amounts of eth around these hot paths (branches). But it has been deemed that cost of attack would escalate significantly to cause any meaningful slow down of state root updates.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTCLEAR Opcode For SELFDESTRUCTed contracts</title>
        <published>2020-09-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2936/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2936-extclear-for-selfdestruct/4569" />
        

        <id>https://wg-eips.ritovision.com/2936/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2936"
            label="EIP-2936" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2936/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Enable new opcode to clear storage for &lt;code&gt;SELFDESTRUCTED&lt;&#x2F;code&gt;ed contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Changes &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) to not clear any storage and adds a new &lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt; (&lt;code&gt;0x5c&lt;&#x2F;code&gt;) opcode that will clear a specific storage slot for a contract that has previously been self destructed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xFF&lt;&#x2F;code&gt;) is unnecessarily complex because it clears an unbounded amount of contract storage.
It is computationally expensive for nodes to track all of the storage used in every contract in case the contract &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;s.
Further, contracts can be re-initialized using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; (&lt;code&gt;0xF5&lt;&#x2F;code&gt;), and then &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) prior storage.
Therefore, several ethereum clients do not clear storage at all, and just check if the contract was initiated since &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x55&lt;&#x2F;code&gt;) during &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.
&lt;code&gt;CREATE2&lt;&#x2F;code&gt; was not intended to complicate &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, and this change reverts that complexity.
Also, bugs in this implementation could split the network.&lt;&#x2F;p&gt;
&lt;p&gt;Instead this defers the time of storage cleanup, and leaves the storage in-place, which reduces the complexity of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This empowers the &lt;code&gt;CREATE2&lt;&#x2F;code&gt; reincarnation proxy pattern by retaining storage during upgrade, which would otherwise have to be reset again.
An atomic reincarnation upgrade could clear a subset of storage during the upgrade, while the contract is destroyed, before reinstating it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After &lt;code&gt;FORK_BLOCK_NUM&lt;&#x2F;code&gt;, a new opcode, &lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt;, is enabled at &lt;code&gt;0x5C&lt;&#x2F;code&gt; to clear storage for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;ed contracts.
&lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;does not push any words onto the stack&lt;&#x2F;li&gt;
&lt;li&gt;pops two words off the stack: the destroyed contract address and a storage address&lt;&#x2F;li&gt;
&lt;li&gt;if the contract exists, charge the same gas cost as &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x3F&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;otherwise, if the storage is zero, charge the same gas as &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; plus &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;otherwise, the destroyed contract&#x27;s slot is reset to 0, charging the same gas as &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; when resetting storage, while also refunding the amount specified in &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is modified to not clear contract storage.
This change also works retroactively: all prior destroyed contracts can be cleaned up.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;0x5C&lt;&#x2F;code&gt; is available in the same range as &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A reincarnation upgrade mechanism that expects all internal storage to be cleared might break, but such an upgrade mechanism would allow adaptation to this new behavior.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation is required on all major clients to add the opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;A reincarnated contract that does not expect its state to be cleared by malicious actors SHOULD reinitialize itself to avoid antagonistic &lt;code&gt;EXTCLEAR&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas cost increases for state access opcodes</title>
        <published>2020-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2929/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2929-gas-cost-increases-for-state-access-opcodes/4558" />
        

        <id>https://wg-eips.ritovision.com/2929/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2929"
            label="EIP-2929" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2929/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Increases gas cost for &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, &lt;code&gt;EXT*&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; when used for the first time in a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Increase the gas cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) to 2100, and the &lt;code&gt;*CALL&lt;&#x2F;code&gt; opcode family (&lt;code&gt;0xf1&lt;&#x2F;code&gt;, &lt;code&gt;f2&lt;&#x2F;code&gt;, &lt;code&gt;f4&lt;&#x2F;code&gt;, &lt;code&gt;fA&lt;&#x2F;code&gt;), &lt;code&gt;BALANCE&lt;&#x2F;code&gt; &lt;code&gt;0x31&lt;&#x2F;code&gt; and the &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcode family (&lt;code&gt;0x3b&lt;&#x2F;code&gt;, &lt;code&gt;0x3c&lt;&#x2F;code&gt;, &lt;code&gt;0x3f&lt;&#x2F;code&gt;) to 2600. Exempts (i) precompiles, and (ii) addresses and storage slots that have already been accessed in the same transaction, which get a decreased gas cost. Additionally reforms &lt;code&gt;SSTORE&lt;&#x2F;code&gt; metering and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; to ensure &quot;de-facto storage loads&quot; inherent in those opcodes are priced correctly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Generally, the main function of gas costs of opcodes is to be an estimate of the time needed to process that opcode, the goal being for the gas limit to correspond to a limit on the time needed to process a block. However, storage-accessing opcodes (&lt;code&gt;SLOAD&lt;&#x2F;code&gt;, as well as the &lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;BALANCE&lt;&#x2F;code&gt; and &lt;code&gt;EXT*&lt;&#x2F;code&gt; opcodes) have historically been underpriced. In the 2016 Shanghai DoS attacks, once the most serious client bugs were fixed, one of the more durably successful strategies used by the attacker was to simply send transactions that access or call a large number of accounts.&lt;&#x2F;p&gt;
&lt;p&gt;Gas costs were increased to mitigate this, but recent numbers suggest they were not increased enough. Quoting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1909.07220.pdf&quot;&gt;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1909.07220.pdf&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Although by itself, this issue might seem benign, &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; forces the  client to search the contract ondisk, resulting in IO heavy transactions.  While replaying the Ethereum history on our hardware, the malicious transactions took around 20 to 80 seconds to execute, compared to a few milliseconds for the average transactions&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This proposed EIP increases the costs of these opcodes by a factor of ~3, reducing the worst-case processing time to ~7-27 seconds. Improvements in database layout that involve redesigning the client to read storage directly instead of hopping through the Merkle tree would decrease this further, though these technologies may take a long time to fully roll out, and even with such technologies the IO overhead of accessing storage would remain substantial.&lt;&#x2F;p&gt;
&lt;p&gt;A secondary benefit of this EIP is that it also performs most of the work needed to make &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;protocol-changes-to-bound-witness-size&#x2F;3885&quot;&gt;stateless witness sizes&lt;&#x2F;a&gt; in Ethereum acceptable. Assuming &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;binary-trie-format&#x2F;7621&quot;&gt;a switch to binary tries&lt;&#x2F;a&gt;, the theoretical maximum witness size not including code size (hence &quot;most of the work&quot; and not &quot;all&quot;) would decrease from &lt;code&gt;(12500000 gas limit) &#x2F; (700 gas per BALANCE) * (800 witness bytes per BALANCE) ~= 14.3M bytes&lt;&#x2F;code&gt; to &lt;code&gt;12500000 &#x2F; 2600 * 800 ~= 3.85M bytes&lt;&#x2F;code&gt;. Pricing for code access could be changed when code merklization is implemented.&lt;&#x2F;p&gt;
&lt;p&gt;In the further future, there are similar benefits in the case of SNARK&#x2F;STARK witnesses. Recent numbers from Starkware suggest that they are able to prove 10000 Rescue hashes per second on a consumer desktop; assuming 25 hashes per Merkle branch, and a block full of state accesses, at present this would imply a witness would take &lt;code&gt;12500000 &#x2F; 700 * 25 &#x2F; 10000 ~= 44.64&lt;&#x2F;code&gt; seconds to generate, but after this EIP that would reduce to &lt;code&gt;12500000 &#x2F; 2500 * 25 &#x2F; 10000 ~= 12.5&lt;&#x2F;code&gt; seconds, meaning that a single desktop computer would be able to generate witnesses on time under any conditions. Future gains in STARK proving could be spent on either (i) using a more expensive but robust hash function or (ii) reducing proving times further, reducing the delay and hence improving user experience of stateless clients that rely on such witnesses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12244000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2600&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;100&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the following changes apply.&lt;&#x2F;p&gt;
&lt;p&gt;When executing a transaction, maintain a set &lt;code&gt;accessed_addresses: Set[Address]&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys: Set[Tuple[Address, Bytes32]]&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;p&gt;The sets are transaction-context-wide, implemented identically to other transaction-scoped constructs such as the self-destruct-list and global &lt;code&gt;refund&lt;&#x2F;code&gt; counter. In particular, if a scope reverts, the access lists should be in the state they were in before that scope was entered.&lt;&#x2F;p&gt;
&lt;p&gt;When a transaction execution begins,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; is initialized to empty, and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; is initialized to include
&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;tx.sender&lt;&#x2F;code&gt;, &lt;code&gt;tx.to&lt;&#x2F;code&gt; (or the address being created if it is a contract creation transaction)&lt;&#x2F;li&gt;
&lt;li&gt;and the set of all precompiles.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;storage-read-changes&quot;&gt;Storage read changes&lt;&#x2F;h3&gt;
&lt;p&gt;When an address is either the target of a (&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3B&lt;&#x2F;code&gt;), &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3C&lt;&#x2F;code&gt;), &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x3F&lt;&#x2F;code&gt;) or &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;)) opcode or the target of a (&lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF1&lt;&#x2F;code&gt;), &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xF2&lt;&#x2F;code&gt;), &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (&lt;code&gt;0xF4&lt;&#x2F;code&gt;), &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xFA&lt;&#x2F;code&gt;)) opcode, the gas costs are computed as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the target is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; gas, and add the address to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In all cases, the gas cost is charged and the map is updated at the time that the opcode is being called.
When a &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode is called, immediately (ie. before checks are done to determine whether or not the address is unclaimed) add the address being created to &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt;, but gas costs of &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are unchanged.
Clarification: If a &lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; operation fails later on, e.g during the execution of &lt;code&gt;initcode&lt;&#x2F;code&gt; or has insufficient gas to store the code in the state, the &lt;code&gt;address&lt;&#x2F;code&gt; of the contract itself remains in &lt;code&gt;access_addresses&lt;&#x2F;code&gt; (but any additions made within the inner scope are reverted).&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, if the &lt;code&gt;(address, storage_key)&lt;&#x2F;code&gt; pair (where &lt;code&gt;address&lt;&#x2F;code&gt; is the address of the contract whose storage is being read) is not yet in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;, charge &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; gas and add the pair to &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;. If the pair is already in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;, charge &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;Note: For call-variants, the &lt;code&gt;100&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;2600&lt;&#x2F;code&gt; cost is applied immediately (exactly like how &lt;code&gt;700&lt;&#x2F;code&gt; was charged before this EIP), i.e: before calculating the &lt;code&gt;63&#x2F;64ths&lt;&#x2F;code&gt; available for entering the call.&lt;&#x2F;p&gt;
&lt;p&gt;Note 2: There is currently no way to perform a &#x27;cold sload read&#x2F;write&#x27; on a &#x27;cold account&#x27;, simply because in order to read&#x2F;write a &lt;code&gt;slot&lt;&#x2F;code&gt;, the execution must already be inside the &lt;code&gt;account&lt;&#x2F;code&gt;. Therefore, the behaviour of cold  storage reads&#x2F;writes on cold accounts is undefined as of this EIP. Any future EIP which
proposes to add &#x27;remote read&#x2F;write&#x27; would need to define the pricing behaviour of that change.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sstore-changes&quot;&gt;SSTORE changes&lt;&#x2F;h3&gt;
&lt;p&gt;When calling &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, check if the &lt;code&gt;(address, storage_key)&lt;&#x2F;code&gt; pair is in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;. If it is not, charge an additional &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt; gas, and add the pair to &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt;. Additionally, modify the parameters defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt; as follows:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;Old value&lt;&#x2F;th&gt;&lt;th&gt;New value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;800&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;= WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5000&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;5000 - COLD_SLOAD_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The other parameters defined in EIP 2200 are unchanged.
Note: The constant &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is used in several places in EIP 2200, e.g &lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt;. Implementations that are using composite definitions have to ensure to update those definitions too.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfdestruct-changes&quot;&gt;SELFDESTRUCT changes&lt;&#x2F;h3&gt;
&lt;p&gt;If the ETH recipient of a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; is not in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; (regardless of whether or not the amount sent is nonzero), charge an additional &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; on top of the existing gas costs, and add the ETH recipient to the set.&lt;&#x2F;p&gt;
&lt;p&gt;Note: &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; does not charge a &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; in case the recipient is already warm, which differs from how the other call-variants work. The reasoning behind this is to keep the changes small, a &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; already costs &lt;code&gt;5K&lt;&#x2F;code&gt; and is a no-op if invoked more than once.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcode-costs-vs-charging-per-byte-of-witness-data&quot;&gt;Opcode costs vs charging per byte of witness data&lt;&#x2F;h3&gt;
&lt;p&gt;The natural alternative path to changing gas costs to reflect witness sizes is to charge per byte of witness data. However, that would take a longer time to implement, hampering the goal of providing short-term security relief. Furthermore, following that path faithfully would lead to extremely high gas costs to transactions that touch contract code, as one would need to charge for all 24576 contract code bytes; this would be an unacceptably high burden on developers. It is better to wait for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;ewasm&#x2F;evm-bytecode-merklization-2a8366ab0c90&quot;&gt;code merklization&lt;&#x2F;a&gt; to start trying to properly account for gas costs of accessing individual chunks of code; from a short-term DoS prevention standpoint, accessing 24 kB from disk is not much more expensive than accessing 32 bytes from disk, so worrying about code size is not necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;adding-the-accessed-addresses-accessed-storage-keys-sets&quot;&gt;Adding the accessed_addresses &#x2F; accessed_storage_keys sets&lt;&#x2F;h3&gt;
&lt;p&gt;The sets of already-accessed accounts and storage slots are added to avoid needlessly charging for things that can be cached (and in all performant implementations already are cached). Additionally, it removes the current undesirable status quo where it is needlessly unaffordable to do self-calls or call precompiles, and enables contract breakage mitigations that involve pre-fetching some storage key allowing a future execution to still take the expected amount of gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sstore-gas-cost-change&quot;&gt;SSTORE gas cost change&lt;&#x2F;h3&gt;
&lt;p&gt;The change to SSTORE is needed to avoid the possibility of a DoS attack that &quot;pokes&quot; a randomly chosen zero storage slot, changing it from 0 to 0 at a cost of 800 gas but requiring a de-facto storage load. The &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; reduction ensures that the total cost of SSTORE (which now requires paying the &lt;code&gt;COLD_SLOAD_COST&lt;&#x2F;code&gt;) remains unchanged. Additionally, note that applications that do &lt;code&gt;SLOAD&lt;&#x2F;code&gt; followed by &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (eg. &lt;code&gt;storage_variable += x&lt;&#x2F;code&gt;) &lt;em&gt;would actually get cheaper&lt;&#x2F;em&gt;!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;change-sstore-accounting-only-minimally&quot;&gt;Change SSTORE accounting only minimally&lt;&#x2F;h3&gt;
&lt;p&gt;The SSTORE gas costs continue to use Wei Tang&#x27;s original&#x2F;current&#x2F;new approach, instead of being redesigned to use a dirty map, because Wei Tang&#x27;s approach correctly accounts for the actual costs of changing storage, which only care about current vs final value and not intermediate values.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-would-gas-consumption-of-average-applications-increase-under-this-proposal&quot;&gt;How would gas consumption of average applications increase under this proposal?&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rough-analysis-from-witness-sizes&quot;&gt;Rough analysis from witness sizes&lt;&#x2F;h4&gt;
&lt;p&gt;We can look at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;data-from-the-ethereum-stateless-prototype-8c69479c8abc&quot;&gt;Alexey Akhunov&#x27;s earlier work&lt;&#x2F;a&gt; for data on average-case blocks. In summary, average blocks have witness sizes of ~1000 kB, of which ~750 kB is Merkle proofs and not code. Assuming a conservative 2000 bytes per Merkle branch this implies ~375 accesses per block (SLOADs have a similar gas-increase-to-bytes ratio so there&#x27;s no need to analyze them separately).&lt;&#x2F;p&gt;
&lt;p&gt;Data on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;tx&quot;&gt;txs per day&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;chart&#x2F;blocks&quot;&gt;blocks per day&lt;&#x2F;a&gt; from Etherscan gives ~160 transactions per block (reference date: Jul 1), implying a large portion of those accesses are just the &lt;code&gt;tx.sender&lt;&#x2F;code&gt; and &lt;code&gt;tx.to&lt;&#x2F;code&gt; which are excluded from gas cost increases, though likely less than 320 due to duplicate addresses.&lt;&#x2F;p&gt;
&lt;p&gt;Hence, this implies ~50-375 chargeable accesses per block, and each access suffers a gas cost increase of 1900; &lt;code&gt;50 * 1900 = 95000&lt;&#x2F;code&gt; and &lt;code&gt;375 * 1900 = 712500&lt;&#x2F;code&gt;, implying the gas limit would need to be raised by ~1-6% to compensate. However, this analysis may be complicated further in either direction by (i) accounts &#x2F; storage keys being accessed in multiple transactions, which would appear once in the witness but twice in gas cost increases, and (ii) accounts &#x2F; storage keys being accessed multiple times in the same transaction, which lead to gas cost &lt;em&gt;decreases&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;goerli-analysis&quot;&gt;Goerli analysis&lt;&#x2F;h4&gt;
&lt;p&gt;A more precise analysis can be found by scanning Goerli transactions, as done by Martin Swende here: https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;gasreprice&lt;&#x2F;p&gt;
&lt;p&gt;The conclusion is that on average gas costs increase by ~2.36%. One major contributing factor to reducing gas costs is that a large number of contracts inefficiently read the same storage slot multiple times, which leads to this EIP giving a few transactions gas cost &lt;em&gt;savings&lt;&#x2F;em&gt; of over 10%.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These gas cost increases may potentially break contracts that depend on fixed gas costs; see the security considerations section for details and arguments for why we expect the total risks to be low and how if desired they can be reduced further.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Some test cases can be found here: https:&#x2F;&#x2F;gist.github.com&#x2F;holiman&#x2F;174548cad102096858583c6fbbb0649a&lt;&#x2F;p&gt;
&lt;p&gt;Ideally we would test the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SLOAD the same storage slot {1, 2, 3} times&lt;&#x2F;li&gt;
&lt;li&gt;CALL the same address {1, 2, 3} times&lt;&#x2F;li&gt;
&lt;li&gt;(SLOAD | CALL) in a sub-call, then revert, then (SLOAD | CALL) the same (storage slot | address) again&lt;&#x2F;li&gt;
&lt;li&gt;Sub-call, SLOAD, sub-call again, revert the inner sub-call, SLOAD the same storage slot&lt;&#x2F;li&gt;
&lt;li&gt;SSTORE the same storage slot {1, 2, 3} times, using all combinations of zero&#x2F;nonzero for original value and the value being set&lt;&#x2F;li&gt;
&lt;li&gt;SSTORE then SLOAD the same storage slot&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;OP_1&lt;&#x2F;code&gt; then &lt;code&gt;OP_2&lt;&#x2F;code&gt; to the same address where &lt;code&gt;OP_1&lt;&#x2F;code&gt; and &lt;code&gt;OP_2&lt;&#x2F;code&gt; are all combinations of (&lt;code&gt;*CALL&lt;&#x2F;code&gt;, &lt;code&gt;EXT*&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Try to &lt;code&gt;CALL&lt;&#x2F;code&gt; an address but with all possible failure modes (not enough gas, not enough ETH...), then (&lt;code&gt;CALL&lt;&#x2F;code&gt; | &lt;code&gt;EXT*&lt;&#x2F;code&gt;) that address again successfully&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A WIP early-draft implementation for Geth can be found here: https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;go-ethereum&#x2F;tree&#x2F;access_lists&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As with any gas cost increasing EIP, there are three possible cases where it could cause applications to break:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Fixed gas limits to sub-calls in contracts&lt;&#x2F;li&gt;
&lt;li&gt;Applications relying on contract calls that consume close to the full gas limit&lt;&#x2F;li&gt;
&lt;li&gt;The 2300 base limit given to the callee by ETH-transferring calls&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These risks have been studied before in the context of an earlier gas cost increase, EIP-1884. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;eip-1884-security&quot;&gt;Martin Swende&#x27;s earlier report&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;ritzdorf&#x2F;1c6bd72955391e831f8a397d3152b4e0&#x2F;&quot;&gt;Hubert Ritzdorf&#x27;s analysis&lt;&#x2F;a&gt; focusing on (1) and (3). (2) has received less analysis, though one can argue that it is very unlikely both because applications tend to very rarely use close to the entire gas limit in a transaction, and because gas limits were very recently raised from 10 million to 12.5 million. EIP-1884 in practice &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.coindesk.com&#x2F;ethereums-istanbul-upgrade-will-break-680-smart-contracts-on-aragon&quot;&gt;did lead to a small number of contracts breaking&lt;&#x2F;a&gt; for this reason.&lt;&#x2F;p&gt;
&lt;p&gt;There are two ways to look at these risks. First, we can note that as of today developers have had years of warning; gas cost increases on storage-accessing opcodes have been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;protocol-changes-to-bound-witness-size&#x2F;3885&quot;&gt;discussed for a long time&lt;&#x2F;a&gt;, with multiple statements made including to major dapp developers around the likelihood of such changes. EIP-1884 itself provided an important wake-up call. Hence, we can argue that risks this time will be significantly lower than EIP-1884.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-breakage-mitigations&quot;&gt;Contract breakage mitigations&lt;&#x2F;h3&gt;
&lt;p&gt;A second way to look at the risks is to explore mitigations. First of all, the existence of an &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; map (present in this EIP, absent in EIP-1884) already makes some cases recoverable: in any case where a contract A needs to send funds to some address B, where that address accepts funds from any source but leaves a storage-dependent log, one can recover by first sending a separate call to B to pull it into the cache, and then call A, knowing that the execution of B triggered by A will only charge 100 gas per SLOAD. This fact does not fix all situations, but it does reduce risks significantly.&lt;&#x2F;p&gt;
&lt;p&gt;But there are ways to further expand the usability of this pattern. One possibility is to add a &lt;code&gt;POKE&lt;&#x2F;code&gt; precompile, which would take an address and a storage key as input and allow transactions that attempt to &quot;rescue&quot; stuck contracts by pre-poking all of the storage slots that they will access. This works even if the address only accepts transactions from the contract, and works in many other contexts with present gas limits. The only case where this will not work would be the case where a transaction call &lt;em&gt;must&lt;&#x2F;em&gt; go from an EOA straight into a specific contract that then sub-calls another contract.&lt;&#x2F;p&gt;
&lt;p&gt;Another option is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, which would have a similar effect to &lt;code&gt;POKE&lt;&#x2F;code&gt; but is more general: it also works for the EOA -&amp;gt; contract -&amp;gt; contract case, and generally should work for all known cases of breakage due to gas cost increases. This option is more complex, though it is arguably a stepping stone toward access lists being used for other use cases (regenesis, account abstraction, SSA all demand access lists).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Binary trie structure</title>
        <published>2020-09-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3102/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/binary-trie-format/7621" />
        

        <id>https://wg-eips.ritovision.com/3102/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:3102"
            label="EIP-3102" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3102/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Change the storage structure from hexary to binary, merge the account and storage tries, and use blake2b.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal presents a binary structure and merkelization rule for the account and storage tries, which are merged into a single “state” trie. RLP and most of the MPT’s optimizations are dropped to simplify the design. Keccak256 is replaced with blake2b.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current design of the Merkle Patricia Trie (MPT) uses an hexary trie. Hexary Merkle trees are more shallow than their binary counterparts, which means less hashing.
Over the course of the 5 years of Ethereum’s existence, it has become apparent that disk accesses are a greater bottleneck than hashing. Clients are therefore moving away from a storage model in which all internal nodes are stored, in favor of a flat (key, value) storage model first used by turbo-geth, in which the intermediate nodes are recalculated only when needed.&lt;&#x2F;p&gt;
&lt;p&gt;There is a push for making Ethereum easier to use in a stateless fashion. Binary tries make for smaller (~4x) proofs than hexary tries, making it the design of choice for a stateless-friendly Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;For that same reason, the account and storage tries are merged in order to have a single proof for all changes.&lt;&#x2F;p&gt;
&lt;p&gt;The MPT design is also rife with uncanny optimizations for size, that have a limited effect - at the cost of prohibitive complexity. For example, nesting for children whose RLP is less than 32 bytes saves an estimated 1MB of disk space. A paltry compared to the 300GB required by a fast sync at the time of this writing. These optimizations are a significant source of errors, and therefore a consensus-breaking risk.
The reliance on RLP has also been criticized for its complexity, while the overhead of a general-purpose encoding scheme isn’t warranted for the rigid structure of a Merkle trie.&lt;&#x2F;p&gt;
&lt;p&gt;The desire to switch the storage model from an hexary trie to a binary trie provides an opportunity to adopt a simpler trie architecture that pushes optimizations from the protocol level down to that of the client implementors.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;conventions&quot;&gt;Conventions&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: center&quot;&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;u256(x)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Big endian, 32-byte representation of number &lt;em&gt;x&lt;&#x2F;em&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;`&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;++&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Bit-wise concatenation operator&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;0b0101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The binary string &lt;code&gt;0101&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;hash()&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The usual hashing function&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;empty_hash&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The empty hash: &lt;code&gt;hash(&quot;&quot;)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;length(x)&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The byte length of object &lt;code&gt;x&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center&quot;&gt;&lt;code&gt;d[a..b]&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;The big-endian bit sequence taken from byte sequence &lt;code&gt;d&lt;&#x2F;code&gt;, starting at bit index &lt;code&gt;a&lt;&#x2F;code&gt;, up to and including the bit at index &lt;code&gt;b&lt;&#x2F;code&gt;.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;notable-changes-from-the-hexary-structure&quot;&gt;Notable changes from the hexary structure&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Account and storage tries are merged, with key length between 32 and 64 bytes;&lt;&#x2F;li&gt;
&lt;li&gt;RLP is no longer used;&lt;&#x2F;li&gt;
&lt;li&gt;The &quot;leaf marker&quot; bit used in the hex prefix is also dropped. Leaves are identified as nodes with no children;&lt;&#x2F;li&gt;
&lt;li&gt;Serialized nodes are hashed, no matter how small the byte length of the serialized nodes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;the-trie&quot;&gt;The trie&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h4&gt;
&lt;p&gt;The trie structure is made up of &lt;em&gt;nodes&lt;&#x2F;em&gt;. A node &lt;code&gt;N ≡ (N_l,N_r,N_p,N_v)&lt;&#x2F;code&gt; has the following 4 components:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;N_l&lt;&#x2F;code&gt; is the hash to the node&#x27;s &lt;em&gt;left child&lt;&#x2F;em&gt;. If the node does not have a left child, then &lt;code&gt;N_l&lt;&#x2F;code&gt; is the empty hash &lt;code&gt;empty_hash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;N_r&lt;&#x2F;code&gt; is the hash to the node&#x27;s &lt;em&gt;right child&lt;&#x2F;em&gt;. If the node does not have a right child, then &lt;code&gt;N_r&lt;&#x2F;code&gt; is the empty hash &lt;code&gt;empty_hash&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;the optional &lt;code&gt;N_p&lt;&#x2F;code&gt; is the node&#x27;s &lt;em&gt;prefix&lt;&#x2F;em&gt; : every key into the subtrie rooted at &lt;code&gt;N&lt;&#x2F;code&gt; is prefixed by this bit string;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;N_v&lt;&#x2F;code&gt; is the &lt;em&gt;value&lt;&#x2F;em&gt; stored at this node. The value is &lt;strong&gt;only present in leaf nodes&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Nodes with &lt;code&gt;empty_hash&lt;&#x2F;code&gt; as both children are called &lt;em&gt;leaf nodes&lt;&#x2F;em&gt;, and the remaining nodes are known as &lt;em&gt;internal nodes&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;accessing-account-s-balance-nonce-code-storage-root-and-storage-slots&quot;&gt;Accessing account&#x27;s balance, nonce, code, storage root and storage slots&lt;&#x2F;h4&gt;
&lt;p&gt;Assuming an account &lt;code&gt;A ≡ (A_b, A_n, A_c, A_s)&lt;&#x2F;code&gt; at address &lt;code&gt;A_a&lt;&#x2F;code&gt;, the following elements can be found at the following addresses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The account balance &lt;code&gt;A_b&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b00&lt;&#x2F;code&gt; and is of type &lt;code&gt;uint256&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;The account nonce &lt;code&gt;A_n&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b01&lt;&#x2F;code&gt; and is of type &lt;code&gt;uint64&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;The code &lt;code&gt;A_c&lt;&#x2F;code&gt; is an arbitrary-length byte sequence that can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b10&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;The root of the storage trie &lt;code&gt;A_s&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b11&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;The storage slot number &lt;code&gt;k&lt;&#x2F;code&gt; can be found at key &lt;code&gt;hash(A_a)[0..253] ++ 0b11 ++ hash(k)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2926&#x2F;&quot;&gt;EIP-2926&lt;&#x2F;a&gt; has been rolled out, &lt;code&gt;A_c&lt;&#x2F;code&gt; will represent the root of the code merkelization tree. The key accessing code chunk number &lt;code&gt;c&lt;&#x2F;code&gt; is &lt;code&gt;hash(A_a)[0..253] ++ 0b10 ++ u256(c)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In the unlikely future case that extra items are to be added to the trie at account level, a third bit can be reserved for future use.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;node-merkelization-rule&quot;&gt;Node merkelization rule&lt;&#x2F;h3&gt;
&lt;p&gt;Leaves and nodes that have no prefix are hashed according to the rule below:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;internal_hash = hash(left_child_hash || right_child_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf_hash = hash(hash(key) || hash(leaf_value))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If a prefix is present, the length of the path from the root to the prefixed node is further concatenated with the output of the prefix-less rule, and hashed again:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;internal_hash_with_prefix = hash(u256(path_length_u256 - 1) || internal_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf_hash_with_prefix = hash(u256(path_length_u256 - 1) || leaf_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;blake2b&quot;&gt;blake2b&lt;&#x2F;h3&gt;
&lt;p&gt;BLAKE2 offers better performance, which is key to compensate for the loss of performance associated to a ~4x increase in the number of nodes.&lt;&#x2F;p&gt;
&lt;p&gt;BLAKE3 offers even better performance. No official golang release exists at the time of the writing of this document. This presents a security risk, and therefore BLAKE2 is considered instead.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merging-of-the-account-and-storage-tries&quot;&gt;Merging of the account and storage tries&lt;&#x2F;h3&gt;
&lt;p&gt;The trend in clients is to store the keys and values in a &quot;flat&quot; database. Having the key of any storage slot prefixed with the address key of the account it belongs to helps grouping all of an account&#x27;s data on disk, as well as simplifying the witness structure.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;prefixes-and-extension-nodes&quot;&gt;Prefixes and extension nodes&lt;&#x2F;h3&gt;
&lt;p&gt;An alternative proposal has been made, which provides optimal witnesses. The trade-off is that extension nodes must be removed.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;node_hash = hash(left_child_hash || right_child_hash)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;leaf_hash = hash(0 || leaf_value)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The removal of extension nodes induces 40x higher hashing costs (on the order of 25ms for a trie with only 1k leaves) and as a result they have been kept.&lt;&#x2F;p&gt;
&lt;p&gt;An attempt to keep extension nodes for witness and not the merkelization rule can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;m5VMkX8FRvi0Q_OOR7TF4A&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Getting rid of complex methods like RLP, the hex prefix and children nesting is already offering great simplification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2x32-byte-inputs&quot;&gt;2x32-byte inputs&lt;&#x2F;h3&gt;
&lt;p&gt;It has been requested to keep each node hash calculation as a function that takes two 256-bit integer as an input and outputs one 256-bit integer. This property is expected to play nice with circuit constructions and is therefore expected to greatly help with future zero-knowledge applications.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;binary-tries&quot;&gt;Binary tries&lt;&#x2F;h3&gt;
&lt;p&gt;Binary tries have been chosen primarily because they reduce the witness size. In general, in an &lt;code&gt;N&lt;&#x2F;code&gt;-element tree with each element having &lt;code&gt;k&lt;&#x2F;code&gt; children, the average length of a branch is roughly &lt;code&gt;32 * (k-1) * log(N) &#x2F; log(k)&lt;&#x2F;code&gt; plus a few percent for overhead. 32 is the length of a hash; the &lt;code&gt;k-1&lt;&#x2F;code&gt; refers to the fact that a Merkle proof needs to provide all &lt;code&gt;k-1&lt;&#x2F;code&gt; sister nodes at each level, and &lt;code&gt;log(N) &#x2F; log(k)&lt;&#x2F;code&gt; is an approximation of the number of levels in the tree (eg. a tree where each node has 5 children, with 625 nodes total, would have depth 4, as &lt;code&gt;625 = 5**4&lt;&#x2F;code&gt; and so &lt;code&gt;log(625) &#x2F; log(5) = 4&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For any &lt;code&gt;N&lt;&#x2F;code&gt;, the expression is minimized at &lt;code&gt;k = 2&lt;&#x2F;code&gt;. Here&#x27;s a table of branch lengths for different &lt;code&gt;k&lt;&#x2F;code&gt; values assuming &lt;code&gt;N = 2**24&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;k&lt;&#x2F;code&gt; (children per node)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (chunks)&lt;&#x2F;th&gt;&lt;th&gt;Branch length (bytes)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1 * 24 = 24&lt;&#x2F;td&gt;&lt;td&gt;768&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;3 * 12 = 36&lt;&#x2F;td&gt;&lt;td&gt;1152&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;7 * 8 = 56&lt;&#x2F;td&gt;&lt;td&gt;1792&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;15 * 6 = 90&lt;&#x2F;td&gt;&lt;td&gt;2880&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Actual branch lengths will be slightly larger than this due to uneven distribution and overhead, but the pattern of &lt;code&gt;k=2&lt;&#x2F;code&gt; being by far the best remains.&lt;&#x2F;p&gt;
&lt;p&gt;The ethereum tree was originally hexary because this would reduce the number of database reads (eg. 6 instead of 24 in the above example). It is now understood that this reasoning was flawed, because nodes can still &quot;pretend&quot; that a binary tree is a hexary (or even 256-ary) tree at the database layer (eg. see https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;optimizing-sparse-merkle-trees&#x2F;3751), and thereby get the best-of-both-worlds of having the low proof sizes of the tree being binary from a hash-structure perspective and at the same time a much more efficient representation in the database.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, binary trees are expected to be widely used in Eth2, so this path improves forward-compatibility and reduces long-run total complexity for the protocol.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;path-length-instead-of-bit-prefix&quot;&gt;Path length instead of bit prefix&lt;&#x2F;h3&gt;
&lt;p&gt;In order to remove the complexity associated with byte manipulation, only the bit-length of the extension is used to merkelize a node with a prefix.&lt;&#x2F;p&gt;
&lt;p&gt;Storing the length of the path from the root node instead of that from the parent node has the nice property that siblings need not be hashed when deleting a leaf.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3102&#x2F;.&#x2F;assets&#x2F;sibling.svg&quot; alt=&quot;Sibling deletion diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;On the left, a trie with the prefix length, and on the right, a trie with the full path length. Each both have values &lt;code&gt;10000100&lt;&#x2F;code&gt; and &lt;code&gt;10000000&lt;&#x2F;code&gt;. After deleting &lt;code&gt;10000100&lt;&#x2F;code&gt;,the sibling node has to be updated in the left tree, while it need not be in the case on the right.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;value-hashing&quot;&gt;Value hashing&lt;&#x2F;h3&gt;
&lt;p&gt;Except for the code, all values in the trie are less than 32 bytes. EIP-2926 introduces code chunks, with &lt;code&gt;CHUNK_SIZE = 32 bytes&lt;&#x2F;code&gt;. The hashing of the leaf&#x27;s value could therefore be saved. The authors of the EIP are however considering a future increase of &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt;, making &lt;code&gt;hash(value)&lt;&#x2F;code&gt; the future-proof choice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A hard fork is required in order for blocks to have a trie root using a different structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;As of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gballet&#x2F;multiproof-rs&#x2F;commit&#x2F;6d22b1aef9548581826b3c04b3e00d6cc709388c&quot;&gt;commit 0db87e187dc0bfb96046a47e3d6768c93a2e3331&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gballet&#x2F;multiproof-rs&quot;&gt;multiproof-rs&lt;&#x2F;a&gt; implements this merkelization rule in the &lt;code&gt;hash_m5()&lt;&#x2F;code&gt; function, found in file &lt;code&gt;src&#x2F;binary_tree.rs&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;An implementation of this structure for go-ethereum is available &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gballet&#x2F;go-ethereum&#x2F;tree&#x2F;rebased-binary-trie-m5-full-path&quot;&gt;in this branch&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Issues could arise when performing the transition. In particular, a heavy conversion process could incentivize clients to wait the transition out. This could lead to a lowered network security at the time of the transition. A transition process has been proposed with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2584&#x2F;&quot;&gt;EIP-2584&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Optional access lists</title>
        <published>2020-08-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Martin Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2930/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2930-optional-access-lists/4561" />
        

        <id>https://wg-eips.ritovision.com/2930/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2930"
            label="EIP-2930" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2930/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a transaction type which contains an access list, a list of addresses and storage keys that the transaction plans to access. Accesses outside the list are possible, but become more expensive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, with the format &lt;code&gt;0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, signatureYParity, signatureR, signatureS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;accessList&lt;&#x2F;code&gt; specifies a list of addresses and storage keys; these addresses and storage keys are added into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets (introduced in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;). A gas cost is charged, though at a discount relative to the cost of accessing outside the list.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP serves two functions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Mitigates contract breakage risks introduced by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;, as transactions could pre-specify and pre-pay for the accounts and storage slots that the transaction plans to access; as a result, in the actual execution, the SLOAD and EXT* opcodes would only cost 100 gas: low enough that it would not only prevent breakage due to that EIP but also &quot;unstuck&quot; any contracts that became stuck due to EIP 1884.&lt;&#x2F;li&gt;
&lt;li&gt;Introduces the access list format and the logic for handling the format. This logic can later be repurposed for many other purposes, including block-wide witnesses, use in ReGenesis, moving toward static state access over time, and more.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;code&gt;1&lt;&#x2F;code&gt;.  See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ChainId&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The transaction only valid on networks with this &lt;code&gt;chainID&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;YParity&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The parity (0 for even, 1 for odd) of the y-value of a secp256k1 signature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Constant&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;12244000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1900&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;2400&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList, signatureYParity, signatureR, signatureS])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signatureYParity, signatureR, signatureS&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, accessList]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;For the transaction to be valid, &lt;code&gt;accessList&lt;&#x2F;code&gt; must be of type &lt;code&gt;[[{20 bytes}, [{32 bytes}...]]...]&lt;&#x2F;code&gt;, where &lt;code&gt;...&lt;&#x2F;code&gt; means &quot;zero or more of the thing to the left&quot;. For example, the following is a valid access list (all hex strings would in reality be in byte representation):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;0x0000000000000000000000000000000000000000000000000000000000000003&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &amp;quot;0x0000000000000000000000000000000000000000000000000000000000000007&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &amp;quot;0xbb9bc244d798123fde783fcc1c72d3bb8c189413&amp;quot;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;At the beginning of execution (ie. at the same time as the &lt;code&gt;21000 + 4 * zeroes + 16 * nonzeroes&lt;&#x2F;code&gt; start gas is charged according to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt; rules), we charge additional gas for the access list: &lt;code&gt;ACCESS_LIST_ADDRESS_COST&lt;&#x2F;code&gt; gas per address and &lt;code&gt;ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;code&gt; gas per storage key. For example, the above example would be charged &lt;code&gt;ACCESS_LIST_ADDRESS_COST * 2 + ACCESS_LIST_STORAGE_KEY_COST * 2&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;Note that non-unique addresses and storage keys are not disallowed, though they will be charged for multiple times, and aside from the higher gas cost there is no other difference in execution flow or outcome from multiple-inclusion of a value as opposed to the recommended single-inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;The address and storage keys would be immediately loaded into the &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; and &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; global sets; this can be done using the following logic (which doubles as a specification-in-code of validation of the RLP-decoded access list)&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; process_access_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Set&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Pair&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Bytes32&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_addresses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    accessed_storage_keys&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; item&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;item&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;item&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate and add the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; item&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCESS_LIST_ADDRESS_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Validate and add the storage keys&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;item&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; item&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas_cost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ACCESS_LIST_STORAGE_KEY_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_addresses&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        accessed_storage_keys&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gas_cost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The access list is NOT charged per-byte fees like tx data is; the per-item costs described above are meant to cover the bandwidth costs of the access list data in addition to the costs of accessing those accounts and storage keys when evaluating the transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;charging-less-for-accesses-in-the-access-list&quot;&gt;Charging less for accesses in the access list&lt;&#x2F;h3&gt;
&lt;p&gt;This is done to encourage transactions to use the access list as much as possible, and because processing transactions is easier when their storage reads are predictable (because clients can pre-load the data from databases and&#x2F;or ask for witnesses at the time the transaction is received, or at least load the data in parallel).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;allowing-duplicates&quot;&gt;Allowing duplicates&lt;&#x2F;h3&gt;
&lt;p&gt;This is done because it maximizes simplicity, avoiding questions of what to prevent duplication against: just between two addresses&#x2F;keys in the access list, between the access list and the tx sender&#x2F;recipient&#x2F;newly created contract, other restrictions? Because gas is charged per item, there is no gain and only cost in including a value in the access list twice, so this should not lead to extra chain bloat in practice.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;signature-signs-over-the-transaction-type-as-well-as-the-transaction-data&quot;&gt;Signature signs over the transaction type as well as the transaction data&lt;&#x2F;h3&gt;
&lt;p&gt;This is done to ensure that the transaction cannot be &quot;re-interpreted&quot; as a transaction of a different type.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP does make it more gas-expensive to perform &quot;unexpected&quot; SLOADs and account accesses. Because gas is prepaid and so does not affect fixed-gas local calls, it does not break contracts in the way that previous gas cost increases would risk. However, it does make applications that heavily rely on storage access much less economically viable.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;access-list-generation&quot;&gt;Access list generation&lt;&#x2F;h3&gt;
&lt;p&gt;Access lists are difficult to construct in real-time in many situations, and this is exacerbated in environments where there is a high time lag between transaction generation and signing or simplicity of the transaction generator is highly valued (eg. either or both may apply in hardware wallets).&lt;&#x2F;p&gt;
&lt;p&gt;However, this EIP proposes only a 10% initial discount to access lists, so there is almost no cost to not bothering with access list generation and only making a simple transaction. The cost of accessing state outside the access list is expected to be ramped up in future hard forks over time as tools are developed and access list generation becomes more mature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-size-bloating&quot;&gt;Transaction size bloating&lt;&#x2F;h3&gt;
&lt;p&gt;Average block size will increase as a result of access lists being used. However, the per-byte cost of access lists is &lt;code&gt;1900 &#x2F; 32 = 59.375&lt;&#x2F;code&gt; for storage keys and &lt;code&gt;2400 &#x2F; 20 = 120&lt;&#x2F;code&gt; for addresses, making it much more expensive than calldata; hence, worst-case block size will not increase. Additionally, increases in average block size will be partially compensated for by the ability to pre-fetch storage at time of receiving a transaction and&#x2F;or load storage in parallel upon receiving a block.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Chunk-Based Code Merkleization</title>
        <published>2020-08-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Sina Mahmoodi</name><uri>https://github.com/s1na</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	<author>
		<name>Jochem Brouwer</name><uri>https://github.com/jochem-brouwer</uri>
	</author>
	
	<author>
		<name>Ignacio Hagopian</name><uri>https://github.com/jsign</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2926/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2926-chunk-based-code-merkleization/4555" />
        

        <id>https://wg-eips.ritovision.com/2926/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:2926"
            label="EIP-2926" />
        

        
        

        
        <summary type="html">Introduce code-chunking in an MPT context.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2926/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Code merkleization, along with binarification of the trie and gas cost bump of state-accessing opcodes, are considered as the main levers for decreasing block witness sizes in stateless or partial-stateless Eth1x roadmaps. Here we specify a fixed-sized chunk approach to code merkleization and outline how the transition of existing contracts to this model would look like.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Bytecode is currently the second contributor to block witness size, after the proof hashes. Transitioning the trie from hexary to binary reduces the hash section of the witness by 3x, thereby making code the first contributor. By breaking contract code into chunks and committing to those chunks in a merkle tree, stateless clients would only need the chunks that were touched during a given transaction to execute it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;What follows is structured to have two sections:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;How a given contract code is split into chunks and then merkleized&lt;&#x2F;li&gt;
&lt;li&gt;How to merkleize all existing contract codes during a hardfork&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;constants-and-definitions&quot;&gt;Constants and Definitions&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt;: 31 (bytes)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERSION_KEY&lt;&#x2F;code&gt;: &lt;code&gt;max(u256)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VERSION&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EMPTY_CODE_ROOT&lt;&#x2F;code&gt;: &lt;code&gt;0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt; (==&lt;code&gt;keccak256(&#x27;&#x27;)&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;HF_TIMESTAMP&lt;&#x2F;code&gt;: to be defined&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ITERATOR_STRIDE&lt;&#x2F;code&gt;: &lt;code&gt;TBC&lt;&#x2F;code&gt; but based on verkle numbers, first devnets should use &lt;code&gt;50_000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BE(x, N)&lt;&#x2F;code&gt;: casts &lt;code&gt;x&lt;&#x2F;code&gt; to an unsigned integer of &lt;code&gt;N&lt;&#x2F;code&gt; bytes and returns its big-endian representation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;code-merkleization&quot;&gt;Code merkleization&lt;&#x2F;h3&gt;
&lt;p&gt;For an account record &lt;code&gt;A&lt;&#x2F;code&gt; with code &lt;code&gt;C&lt;&#x2F;code&gt;, two extra optional fields are added: &lt;code&gt;A.codeSize&lt;&#x2F;code&gt; and &lt;code&gt;A.codeRoot&lt;&#x2F;code&gt;. &lt;code&gt;A.codeHash&lt;&#x2F;code&gt; is retained to serve &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;C&lt;&#x2F;code&gt; is empty, i.e. in the case of an EoA, &lt;code&gt;A.codeRoot&lt;&#x2F;code&gt; and &lt;code&gt;A.codeSize&lt;&#x2F;code&gt; are omitted from the account&#x27;s RLP. This is intended to limit the size overhead of this change.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;C&lt;&#x2F;code&gt; is not empty:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;A.codeSize = len(code)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;A.codeRoot&lt;&#x2F;code&gt; contains the root of &lt;code&gt;codeTrie&lt;&#x2F;code&gt;, a trie with the following leaves:
&lt;ul&gt;
&lt;li&gt;Key: &lt;code&gt;VERSION_KEY&lt;&#x2F;code&gt;, value: &lt;code&gt;BE(VERSION, 1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;A list of code &lt;code&gt;chunks = [(FIO_0, code_0), ..., (FIO_n, code_n)]&lt;&#x2F;code&gt; which are derived from &lt;code&gt;C&lt;&#x2F;code&gt; as follows:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;code_0 || ... || code_n == C&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;length(code_i) == CHUNK_SIZE&lt;&#x2F;code&gt; where &lt;code&gt;0 &amp;lt;= i &amp;lt; n&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;length(code_n) &amp;lt;= CHUNK_SIZE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FIO_i&lt;&#x2F;code&gt; is the offset of the first instruction within the chunk. It should only be greater than zero if the last instruction in &lt;code&gt;code_i-1&lt;&#x2F;code&gt; is a multi-byte instruction (like &lt;code&gt;PUSHN&lt;&#x2F;code&gt;) crossing the chunk boundary. It is set to &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt; in the case where all bytes of a chunk are data.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;i&lt;&#x2F;code&gt;th element of &lt;code&gt;chunks&lt;&#x2F;code&gt; is stored in &lt;code&gt;codeTrie&lt;&#x2F;code&gt; with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Key: &lt;code&gt;BE(i, 4)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Value: &lt;code&gt;BE(FIO_i, 1) || code_i&lt;&#x2F;code&gt;, where &lt;code&gt;||&lt;&#x2F;code&gt; stands for byte-wise concatenation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;contract-creation-gas-cost&quot;&gt;Contract creation gas cost&lt;&#x2F;h4&gt;
&lt;p&gt;As of now there is a charge of 200 gas per byte of the code stored in state by contract creation operations, be it initiated via &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, or an external transaction. This per byte cost is to be increased from &lt;code&gt;200&lt;&#x2F;code&gt; to &lt;code&gt;500&lt;&#x2F;code&gt; to account for the chunking and merkleization costs. This number is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4762&#x2F;&quot;&gt;EIP-4762&lt;&#x2F;a&gt; and is picked for forward-compatibility.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;updating-existing-code-transition-process&quot;&gt;Updating existing code (transition process)&lt;&#x2F;h3&gt;
&lt;p&gt;The transition process involves reading all contracts in the state and applying the above procedure to them. A process similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7612&#x2F;&quot;&gt;EIP-7612&lt;&#x2F;a&gt; is to be used, as the total code size at the time of this EIP edit is &amp;gt;10GB and can not be processed in a single block.&lt;&#x2F;p&gt;
&lt;p&gt;Note that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Because multiple accounts can share the same code hash, the whole account tree needs to be iterated over to convert each account. Only iterating over the bytecodes isn&#x27;t enough.&lt;&#x2F;li&gt;
&lt;li&gt;Nonetheless, the conversion process should take a few hours, instead of days for a full tree change.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At &lt;code&gt;HF_TIMESTAMP&lt;&#x2F;code&gt; the EIP gets activated:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;any contract creation and 7702 delegation updates must use the new format.
&lt;ul&gt;
&lt;li&gt;for 7702 accounts, the code size is set to &lt;code&gt;23&lt;&#x2F;code&gt;, and &lt;code&gt;CODESIZE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CODECOPY&lt;&#x2F;code&gt; are forwarded to the delegated account. &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; behave the same as they did before the activation of this EIP.&lt;&#x2F;li&gt;
&lt;li&gt;accounts are NOT converted in case of a balance or nonce update: accounts are converted by the iterator sweep or automatically at creation time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;at the end of block processing, and after all transactions have been executed but before recomputing the tree root hash, the client iterates over &lt;code&gt;ITERATOR_STRIDE&lt;&#x2F;code&gt; accounts in the tree, and for each account:
&lt;ul&gt;
&lt;li&gt;if the account has empty code, or is a contract using the new format, leave that account untouched,&lt;&#x2F;li&gt;
&lt;li&gt;if the account is a &quot;legacy&quot; contract, convert it and write it back to the tree&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The value for &lt;code&gt;ITERATOR_STRIDE&lt;&#x2F;code&gt; has been chosen to be safe while ensuring the transition process does not last too long. At the current state size and block time, this represents about 10000 blocks, which is about one and a half day.&lt;&#x2F;p&gt;
&lt;p&gt;Following the transition process described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;8032&#x2F;&quot;&gt;EIP-8032&lt;&#x2F;a&gt;, the transition process uses a system contract to store its progress pointers. The transition process has been designed in such a way that if both EIPs are activated at the same time, their transition process can be merged. Refer to that EIP for more details.&lt;&#x2F;p&gt;
&lt;p&gt;Note that for a bytecode used by multiple contracts, the chunking need happen only once. Such contract only need to update their code size and code root, which MAY be cached during the transition process.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;hexary-vs-binary-trie&quot;&gt;Hexary vs binary trie&lt;&#x2F;h3&gt;
&lt;p&gt;The trie format is chosen to be the same as that of the account trie. If a tree conversion happens at a later stage, the chunk tree will have to be converted as well, e.g. the way it is in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6800&#x2F;&quot;&gt;EIP-6800&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7864&#x2F;&quot;&gt;EIP-7864&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chunk-size&quot;&gt;Chunk size&lt;&#x2F;h3&gt;
&lt;p&gt;The current recommended chunk size of 31 bytes has been selected based on a few observations. Smaller chunks are more efficient (i.e. have higher chunk utilization), but incur a larger hash overhead (i.e. number of hashes as part of the proof) due to a higher trie depth. Larger chunks are less efficient, but incur less hash overhead. We plan to run a larger experiment comparing various chunk sizes to arrive at a final recommendation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;first-instruction-offset&quot;&gt;First instruction offset&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;firstInstructionOffset&lt;&#x2F;code&gt; field allows safe jumpdest analysis when a client doesn&#x27;t have all the chunks, e.g. a stateless clients receiving block witnesses.&lt;&#x2F;p&gt;
&lt;p&gt;Note: there could be an edge case when computing FIO for the chunks where the data bytes at the end of a bytecode (last chunk) resemble a multi-byte instruction. This case can be safely ignored.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-of-code-accessing-opcodes&quot;&gt;Gas cost of code-accessing opcodes&lt;&#x2F;h3&gt;
&lt;p&gt;Details of how the code is stored, is left to the client implementers. However, to reflect the removal of the max code limit and the fact that larger codes will be more expensive to load, reading a non-accessed chunk will incur a 200 warming cost, and chunks written beyond the 24kb limit will cost 500 gas instead of 200.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;different-chunking-logic&quot;&gt;Different chunking logic&lt;&#x2F;h3&gt;
&lt;p&gt;We have considered an alternative option to package chunks, where each chunk is prepended with its &lt;code&gt;chunkLength&lt;&#x2F;code&gt; and would only contain complete opcodes (i.e. any multi-byte opcode not fitting the &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt; would be deferred to the next chunk).&lt;&#x2F;p&gt;
&lt;p&gt;This approach has downsides compared to the one specified:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Requires a larger &lt;code&gt;CHUNK_SIZE&lt;&#x2F;code&gt; -- at least 33 bytes to accommodate the &lt;code&gt;PUSH32&lt;&#x2F;code&gt; instruction.&lt;&#x2F;li&gt;
&lt;li&gt;It is more wasteful. For example, &lt;code&gt;DUP1 PUSH32 &amp;lt;32-byte payload&amp;gt;&lt;&#x2F;code&gt; would be encoded as two chunks, the first chunk contains only &lt;code&gt;DUP1&lt;&#x2F;code&gt;, and the second contains only the &lt;code&gt;PUSH32&lt;&#x2F;code&gt; instruction with its payload.&lt;&#x2F;li&gt;
&lt;li&gt;Calculating the number of chunks is not trivial and would have to be stored explicitly in the metadata.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Additionally we have reviewed many other options (basic block based, Solidity subroutines (requires determining the control flow), EIP-2315 subroutines). This EIP however only focuses on the chunk-based option.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;From the perspective of contracts, the design aims to be transparent, with the exception of changes in gas costs.&lt;&#x2F;p&gt;
&lt;p&gt;Outside of the interface presented for contracts, this proposal introduces major changes to the way contract code is stored, and needs a substantial modification of the Ethereum state. Therefore it can only be introduced via a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;p&gt;Show the &lt;code&gt;codeRoot&lt;&#x2F;code&gt; for the following cases:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;code=&#x27;&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;code=&#x27;PUSH1(0) DUP1 REVERT&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;code=&#x27;PUSH32(-1)&#x27;&lt;&#x2F;code&gt; (data passing through a chunk boundary)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Rich Transactions</title>
        <published>2020-07-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2803/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/rich-transactions-via-evm-bytecode-execution-from-externally-owned-accounts/4025" />
        

        <id>https://wg-eips.ritovision.com/2803/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2803"
            label="EIP-2803" />
        

        
        

        
        <summary type="html">Support &#x27;rich transactions&#x27; by allowing transactions from externally owned accounts to execute bytecode directly.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2803/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;If a transaction has a &lt;code&gt;to&lt;&#x2F;code&gt; of address &lt;code&gt;x&lt;&#x2F;code&gt;, then the &lt;code&gt;data&lt;&#x2F;code&gt; of the transaction will be treated as EVM bytecode and it will be executed from the context of the &lt;code&gt;CALLER&lt;&#x2F;code&gt; of the transaction (aka: the transaction signer).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many Ethereum DApps presently require users to approve multiple transactions in order to produce one effect - for example, the common pattern of first approving a contract to spend a token, then calling that contract. This results in a poor user-experience, and complicates the experience of interacting with DApps.&lt;&#x2F;p&gt;
&lt;p&gt;Making it possible for externally owned accounts to execute EVM bytecode directly allows a single transaction to execute multiple contract calls, allowing DApps to provide a streamlined experience, where every interaction results in at most one transaction.&lt;&#x2F;p&gt;
&lt;p&gt;While this is in principle possible today using contract wallets, other UX issues, such as the need to fund a sending account with gas money, lack of support for contract wallets in browser integrations, and lack of a consistent API for contract wallets has led to poor adoption of these.This EIP is a way of enhancing the utility of existing EOAs, in the spirit of &quot;don&#x27;t let the perfect be the enemy of the good&quot;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new reserved address is specified at &lt;code&gt;x&lt;&#x2F;code&gt;, in the range used for precompiles. When a transaction is sent to this address from an externally owned account, the payload of the transaction is treated as EVM bytecode, and executed with the signer of the transaction as the current account. For clarity:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;ADDRESS&lt;&#x2F;code&gt; opcode returns the address of the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode returns the balance of the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Any &lt;code&gt;CALL&lt;&#x2F;code&gt; operations that send value take their value from the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt; will set the &lt;code&gt;CALLER&lt;&#x2F;code&gt; to the EOA (not &lt;code&gt;x&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; preserves the EOA as the owning account.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CALLER&lt;&#x2F;code&gt; and &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcodes both return the address of the EOA that signed the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;There is no code associated with the precompile address. &lt;code&gt;CODE*&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODE*&lt;&#x2F;code&gt; opcodes behave the same as they do for any empty address.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLDATA*&lt;&#x2F;code&gt; opcodes operate on the transaction payload as expected.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operate on the storage of the EOA. As a result, an EOA can have data in storage, that persists between transactions.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode does nothing.&lt;&#x2F;li&gt;
&lt;li&gt;All other opcodes behave as expected for a call to a contract address.&lt;&#x2F;li&gt;
&lt;li&gt;The transaction is invalid if there is any value attached.&lt;&#x2F;li&gt;
&lt;li&gt;A call to the precompile address from a contract has no special effect and is equivalent to a call to a nonexistent precompile or an empty address.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The intent of this EIP is for the new precompile to act in all ways possible like a &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; from an externally owned account. Some changes are required to reflect the fact that the code being executed is not stored on chain, and for special cases such as &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;, to prevent introducing new edge-cases such as the ability to zero-out an EOA&#x27;s nonce.&lt;&#x2F;p&gt;
&lt;p&gt;A precompile was used rather than a new EIP-2718 transaction type because a precompile allows us to have a rich transaction with any type of EIP-2718 transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new feature that will need to be implemented in a future hard fork. No backwards compatibility issues with existing code are expected.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts or DApps that assume that an EOA cannot atomically perform multiple operations may be affected by this change, as this now makes it possible for EOAs to execute multiple atomic operations together. The authors do not believe this is a significant use-case, as this &#x27;protection&#x27; is already trivially defeated by miners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce intrinsic transaction gas</title>
        <published>2020-07-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	<author>
		<name>Uri Klarman</name><uri>https://github.com/uriklarman</uri>
	</author>
	
	<author>
		<name>Ben Adams</name><uri>https://github.com/benaadams</uri>
	</author>
	
	<author>
		<name>Maria Inês Silva</name><uri>https://github.com/misilva73</uri>
	</author>
	
	<author>
		<name>Anders Elowsson</name><uri>https://github.com/anderselowsson</uri>
	</author>
	
	<author>
		<name>Anthony Sassano</name><uri>https://github.com/sassal</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2780/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2780-reduce-intrinsic-cost-of-transactions/4413" />
        

        <id>https://wg-eips.ritovision.com/2780/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="draft"
                label="Draft" />
            
        

        
        <category
            term="tag:eip:2780"
            label="EIP-2780" />
        

        
        

        
        <summary type="html">Reduce intrinsic transaction gas and charge 25k when a value transfer creates a new account</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2780/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the intrinsic cost &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; from &lt;code&gt;21,000&lt;&#x2F;code&gt; to &lt;code&gt;4,500&lt;&#x2F;code&gt; and define a consistent gas accounting model based on actual state operations. This more granular approach makes a simple ETH transfer &lt;code&gt;6,000&lt;&#x2F;code&gt; from additional costs related to the &lt;code&gt;to&lt;&#x2F;code&gt; account.&lt;&#x2F;p&gt;
&lt;p&gt;If a non-create transaction has &lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; and targets a non-existent account, charge &lt;code&gt;GAS_NEW_ACCOUNT = 25,000&lt;&#x2F;code&gt; to align with &lt;code&gt;CALL&lt;&#x2F;code&gt; account creation and price in state growth. When this surcharge applies, the recipient pays exactly one cold non-code touch; no code-load cost applies.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not change calldata or access-list metering. It also refines related gas schedule items used in derivation and execution accounting:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Split cold-account touches into &lt;code&gt;COLD_ACCOUNT_COST_CODE = 2,600&lt;&#x2F;code&gt; and &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Introduce &lt;code&gt;STATE_UPDATE = 1,000&lt;&#x2F;code&gt; as the price of a single account-leaf write.&lt;&#x2F;li&gt;
&lt;li&gt;Reprice value-moving calls as account-leaf writes, replacing &lt;code&gt;CALL_VALUE_COST = 9,000&lt;&#x2F;code&gt; with &lt;code&gt;CALL_VALUE_COST = 2 * STATE_UPDATE = 2,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Specify that a &lt;code&gt;PAY&lt;&#x2F;code&gt;-style value-move primitive, if present, does not warm its recipient and never loads code (charged at &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; if not already warmed).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Capacity impact (illustrative):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Result&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Change&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Max (minimal txs)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,333 tx &#x2F; block&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+367%&lt;&#x2F;td&gt;&lt;td&gt;4,500-gas minimal transactions per 60 M block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Max (ETH transfers)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10,000 tx &#x2F; block&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+250%&lt;&#x2F;td&gt;&lt;td&gt;6,000-gas ETH transfers per 60 M block&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Thoughput (minimal txs)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;~1,111 TPS&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+367%&lt;&#x2F;td&gt;&lt;td&gt;4,500-gas minimal transactions per 60 M block per 12sec&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Thoughput (ETH transfers)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;~833 TPS&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+250%&lt;&#x2F;td&gt;&lt;td&gt;6,000-gas ETH transfers per 60 M block per 12sec&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Equivalent gas-limit uplift&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ +20.8%&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;-&lt;&#x2F;td&gt;&lt;td&gt;Effective throughput gain for ave tx usage (e.g., 60 M =&amp;gt; ~72.5 M)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Monetary Context&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Money has three basic functions: a unit of account, a medium of exchange, and a store of value. ETH already meets the last two by design. It carries value without an issuer and settles with finality. Where it falls short is in everyday exchange - the friction of use rather than the nature of the asset.&lt;&#x2F;p&gt;
&lt;p&gt;ETH underpins most onchain liquidity. Pairs are denominated in it, and gas is paid in it - a de-facto tax base that anchors value. Bitcoin&#x27;s monetary role now runs mainly through exchange pairs, hence its drift in focus to store-of-value rather than medium-of-exchange. ETH still clears real activity onchain, yet outside NFTs few people think in ETH terms. In that niche ETH already functions as both unit and medium, but only for high-value items.&lt;&#x2F;p&gt;
&lt;p&gt;For ETH to operate fully as money, it must also handle small transactions. That was impractical when gas sat at 300 gwei, or even 90 gwei on quiet weekends. Post-4844, blobs absorb L2&#x27;s &quot;pay at any price&quot; data and higher gaslimits ease congestion; cost, not capacity, is the bottleneck.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-2780 lowers that fixed cost. By aligning the base gas with the real work of a transaction and by correcting &lt;code&gt;CALL&lt;&#x2F;code&gt; value pricing, it removes the legacy penalty on simple payments. Small transfers become viable again without subsidising calldata or storage. The same logic charges properly for new-account creation, so state growth remains priced in.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Unit of account:&lt;&#x2F;strong&gt; When transfers are cheap and regular, people price in ETH because they use it directly. This proposal turns that habit into equilibrium rather than idealism.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Medium of exchange:&lt;&#x2F;strong&gt; Reducing &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; eliminates the old friction that slowed native circulation. Settlement becomes frequent, not occasional.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Store of value:&lt;&#x2F;strong&gt; Honest pricing reinforces confidence that ETH&#x27;s cost structure is grounded in real computation, not arbitrary constants.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Velocity:&lt;&#x2F;strong&gt; Lower friction raises the rate of final settlement; more frequent, smaller clears in native ETH, without altering calldata or storage economics.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Monetary competition:&lt;&#x2F;strong&gt; Stablecoins and LSTs are welcome, but they compete for onchain &quot;moneyness&quot;. Making native ETH easy to spend keeps it central; not just the fuel, but the money of the system.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; This proposal doesn&#x27;t target ETH specifically, the lower base cost applies to every transaction type. However since &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; makes up nearly all of an ETH transfer&#x27;s gas, while it&#x27;s only a small fraction of contract calls, ETH loses the most friction and gains the most velocity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Specifics&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The legacy &lt;code&gt;21,000&lt;&#x2F;code&gt; base no longer matches the universal work path under warm&#x2F;cold accounting. Decomposed into signature recovery, one account-leaf write for the sender (nonce + balance coalesced), and one cold non-code touch (sender), the universal path totals &lt;code&gt;4,500&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;p&gt;State growth is underpriced for top-level value transfers that create accounts, while &lt;code&gt;CALL&lt;&#x2F;code&gt; pays explicit creation. Charging &lt;code&gt;25,000&lt;&#x2F;code&gt; when a transfer creates an account aligns entry points and internalizes state growth.&lt;&#x2F;p&gt;
&lt;p&gt;A lower base removes the distortion that over-incentivized batching solely to dodge &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;, without subsidizing calldata or storage. The refinement of value-transfer costs and cold-account pricing makes execution charges proportional to actual state work: account touches and leaf writes.&lt;&#x2F;p&gt;
&lt;p&gt;We intentionally do &lt;strong&gt;not&lt;&#x2F;strong&gt; charge per-byte gas for the transaction envelope (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;gas*&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;). Calldata pricing applies only to &lt;code&gt;tx.data&lt;&#x2F;code&gt;. A plain ETH payment has empty &lt;code&gt;tx.data&lt;&#x2F;code&gt;, so it pays zero calldata gas. Lowering &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; to the universal work path makes ETH payments cheaper without subsidizing arbitrary calldata.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;throughput-payload-and-basefee-dynamics&quot;&gt;Throughput, payload, and basefee dynamics&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP affects three independent levers:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Gas-limit equivalence:&lt;&#x2F;strong&gt; Reducing the base cost from &lt;code&gt;21,000&lt;&#x2F;code&gt; to &lt;code&gt;4,500&lt;&#x2F;code&gt; increases transaction capacity at a fixed block gaslimit by approximately +20.8%.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Payload-size bounds:&lt;&#x2F;strong&gt; Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7934&#x2F;&quot;&gt;EIP-7934&lt;&#x2F;a&gt; the execution payload cap is &lt;code&gt;MAX_RLP_BLOCK_SIZE = 10,485,760 - 2,097,152 = 8,388,608&lt;&#x2F;code&gt; bytes. Payload size, not gas, may become the dominant block-size constraint at high gaslimits.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Basefee market dynamics:&lt;&#x2F;strong&gt; Lower intrinsic gas reduces the average gas per tx, temporarily increasing utilisation and causing short-term downward adjustment in basefee. Over time, equilibrium restores as inclusion policies adapt.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These levers are independent; this proposal changes only intrinsic gas, not calldata metering or access-list pricing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;monetary-effects&quot;&gt;Monetary Effects&lt;&#x2F;h3&gt;
&lt;p&gt;Reducing ETH transfer cost from &lt;code&gt;21,000&lt;&#x2F;code&gt; =&amp;gt; &lt;code&gt;6,000&lt;&#x2F;code&gt; gas increases both transaction frequency and viable payment granularity. At a fixed basefee, smaller payments become economical, raising the &lt;strong&gt;velocity of money&lt;&#x2F;strong&gt; - how often ETH changes hands on L1.&lt;&#x2F;p&gt;
&lt;p&gt;Let $g$ be gas per transaction, $b$ the basefee (in gwei), and $r$ the user&#x27;s tolerated fee share of payment value.&lt;&#x2F;p&gt;
&lt;p&gt;$v_{\text{min}} = \frac{g \times b \times 10^{-9}}{r}$&lt;&#x2F;p&gt;
&lt;p&gt;Since $g$ drops from $21,000$ to $6,000$:&lt;&#x2F;p&gt;
&lt;p&gt;$\frac{v_{\text{min,new}}}{v_{\text{min,old}}} = \frac{6{,}000}{21{,}000} \approx 0.29$&lt;&#x2F;p&gt;
&lt;p&gt;The minimum economical L1 payment falls by about &lt;strong&gt;71 %&lt;&#x2F;strong&gt;, allowing more, smaller transfers to clear directly in ETH.&lt;&#x2F;p&gt;
&lt;p&gt;From the quantity relation $M V = P Q$, with $M$ and $P$ roughly constant over short periods:&lt;&#x2F;p&gt;
&lt;p&gt;$V_{\text{new}} &#x2F; V_{\text{old}} \approx Q_{\text{new}} &#x2F; Q_{\text{old}}$&lt;&#x2F;p&gt;
&lt;p&gt;Pure ETH-transfer capacity rises roughly &lt;strong&gt;3.5x&lt;&#x2F;strong&gt; (+250 %), and the lower $v_{\text{min}}$ further increases $Q$ as more small-value payments become viable.&lt;&#x2F;p&gt;
&lt;p&gt;Together these effects lift $V$, more frequent, smaller, native settlements without changing monetary supply.&lt;&#x2F;p&gt;
&lt;p&gt;ETH thus gains moneyness:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Medium of exchange:&lt;&#x2F;strong&gt; direct use becomes routine, not exceptional.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Unit of account:&lt;&#x2F;strong&gt; frequent native settlement encourages ETH-denominated pricing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Store of value:&lt;&#x2F;strong&gt; workload-based fees reinforce trust in cost realism.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Price volatility may still lead users to prefer stablecoins for predictability, but this change removes unnecessary friction, restoring ETH’s competitiveness wherever volatility is tolerable.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;25,000&lt;&#x2F;code&gt; surcharge for new-account creation continues to price state growth honestly while everyday transfers become cheaper and faster.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;equivalent-gas-limit-increase&quot;&gt;Equivalent gas-limit increase&lt;&#x2F;h3&gt;
&lt;p&gt;Lowering &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; from &lt;code&gt;21,000&lt;&#x2F;code&gt; to &lt;code&gt;4,500&lt;&#x2F;code&gt; removes up to &lt;code&gt;16,500&lt;&#x2F;code&gt; gas per transaction. Using recent totals of 163 Ggas&#x2F;day and 1.7 M tx&#x2F;day:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Calculation&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Result&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Avg gas per tx&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;163Bn &#x2F; 1.7M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ 95,882 gas&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;New avg gas per tx&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;95,882 − 16,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ 79,382 gas&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;-&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Throughput at fixed gaslimit&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;95,882 &#x2F; 79,382&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ x1.208&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+20.08%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Daily tx at same gas usage&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1.7M × 1.208&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;≈ 2.053M tx&#x2F;day&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+340k&#x2F;day&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Perfnet measurements show EL clients handle &amp;gt;300 MGas&#x2F;s for pure ETH transfers. Expressed under a 4.5k base this corresponds to &lt;code&gt;300 * (4.5&#x2F;21) ~ 64.3 MGas&#x2F;s&lt;&#x2F;code&gt;, i.e. &lt;code&gt;~771 MGas&lt;&#x2F;code&gt; per 12 s slot. This indicates sufficient headroom and that the current base is significantly overcharged, so no extra engineering is required to improve performance to support this change.&lt;&#x2F;p&gt;
&lt;p&gt;Net effect equals raising a 45 M gas limit to ~54.4 M at unchanged calldata and access-list metering. This directly advances Scaling L1.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;, set the following parameters and rules:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Description&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;td&gt;Base cost of any transaction&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;Surcharge when a value-transferring transaction creates a new account&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,000&lt;&#x2F;td&gt;&lt;td&gt;One account-leaf write in the account trie (nonce and balance coalesce)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,600&lt;&#x2F;td&gt;&lt;td&gt;Cold touch of an account with code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Cold touch of an account known to have no code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;WARM_STATE_READ&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;100&lt;&#x2F;td&gt;&lt;td&gt;Touch of an already-warm account (same as &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt;)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The intrinsic gas accounting defined here overrides &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt;&#x27;s blanket &quot;all tx addresses are warm&quot; rule.&lt;&#x2F;p&gt;
&lt;p&gt;A transaction’s intrinsic base is decomposed into explicit primitives, so warmth must be priced explicitly.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tx.sender&lt;&#x2F;code&gt; is charged as a cold non-code account (&lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;), representing the first access and coalesced account-leaf update.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;tx.to&lt;&#x2F;code&gt; is charged based on its type:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;if a contract create, charge under those rules.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;if an EOA or an empty account, use &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;if a contract, use &lt;code&gt;COLD_ACCOUNT_COST_CODE = 2,600&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;if a precompile, it is warm at tx start and charged zero.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Warmth discovered through an access list still applies and overrides the cold cost.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This decomposition replaces the implicit warmth assumptions of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; and makes the per-account cost explicit in the base or the execution phase as appropriate.&lt;&#x2F;p&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; counts writes at the account-leaf granularity. If a single account&#x27;s nonce and balance both change in one transition, charge one &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; reflects that non-code accounts do not load code or a storage trie, so have a lower warming cost.&lt;&#x2F;li&gt;
&lt;li&gt;A regular ETH transfer additionally includes a cold touch of at least &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; and a &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; of the &lt;code&gt;to&lt;&#x2F;code&gt; address, so the effective minimal productive tx cost is &lt;code&gt;6,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Not including the &lt;code&gt;to&lt;&#x2F;code&gt; cold warming and &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; in &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; means a contract-interaction transaction that does not transfer value does not unnecessarily pay these additional costs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;derivation-non-normative&quot;&gt;Derivation (non-normative)&lt;&#x2F;h3&gt;
&lt;p&gt;Decomposition of the base cost into universal primitives:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Component&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;ECRECOVER&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,000&lt;&#x2F;td&gt;&lt;td&gt;Elliptic curve signature recovery&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATE_UPDATE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,000&lt;&#x2F;td&gt;&lt;td&gt;One account-leaf write (nonce + balance coalesced)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Sender is cold and has no code&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;TX_BASE_COST&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;4,500&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Sum of above (3,000 + 1,000 + 500)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;new-account-surcharge&quot;&gt;New-account surcharge&lt;&#x2F;h3&gt;
&lt;p&gt;Apply &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; when &lt;strong&gt;all&lt;&#x2F;strong&gt; are true:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The transaction is not a &lt;code&gt;CREATE&lt;&#x2F;code&gt; transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is not a precompile.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt; is non-existent per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt; emptiness at the start of transaction execution.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;GAS_NEW_ACCOUNT = 25,000&lt;&#x2F;code&gt;charge covers state growth (new leaf creation and one &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;).
An additional &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt; applies for the initial lookup to determine that the account does not exist.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the &lt;strong&gt;total&lt;&#x2F;strong&gt; intrinsic gas for a value-transferring transaction to a new account is &lt;code&gt;30,000&lt;&#x2F;code&gt; (&lt;code&gt;4,500 base + 500 lookup + 25,000 new-account surcharge&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;For reference, the &lt;strong&gt;total&lt;&#x2F;strong&gt; charges for such transfers change from 21,000 to 30,000.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Component&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Notes&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;TX_BASE_COST&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;td&gt;Base transaction cost&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;500&lt;&#x2F;td&gt;&lt;td&gt;Recipient cold lookup (execution charge)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GAS_NEW_ACCOUNT&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,000&lt;&#x2F;td&gt;&lt;td&gt;Account creation, includes leaf write&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Total&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;&lt;strong&gt;30,000&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td&gt;Sum of above (4,500 + 500 + 25,000)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;value = 0&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt; is empty per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;, no account is created and no surcharge applies.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; transactions are unchanged; their cost already includes account creation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;intrinsic-gas-computation&quot;&gt;Intrinsic gas computation&lt;&#x2F;h3&gt;
&lt;p&gt;Clients compute intrinsic gas as today for each typed transaction &lt;strong&gt;except&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Replace any hardcoded &lt;code&gt;21,000&lt;&#x2F;code&gt; with &lt;code&gt;TX_BASE_COST = 4,500&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Add &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt; when the &lt;em&gt;New-account surcharge&lt;&#x2F;em&gt; conditions hold.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;pseudocode-normative&quot;&gt;Pseudocode (normative):&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; CalculateIntrinsicGas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; state_at_start&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; TX_BASE_COST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Existing rules for calldata and access lists remain unchanged by this EIP.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; GasForCalldata&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                  #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per active calldata pricing EIPs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;has_access_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; GasForAccessList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; per EIP-2930&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is_create&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       and&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       and&lt;&#x2F;span&gt;&lt;span&gt; is_precompile&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;       and&lt;&#x2F;span&gt;&lt;span&gt; is_nonexistent_per_eip161&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state_at_start&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        gasCost&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; GAS_NEW_ACCOUNT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; gasCost&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;evm-gas-schedule-adjustments&quot;&gt;EVM gas schedule adjustments&lt;&#x2F;h3&gt;
&lt;p&gt;These changes refine execution-layer accounting to align with the primitives above.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Value-moving calls.&lt;&#x2F;strong&gt; Replace the legacy &lt;code&gt;CALL_VALUE_COST = 9,000&lt;&#x2F;code&gt; with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If recipient exists: &lt;code&gt;CALL_VALUE_COST = 2 * STATE_UPDATE = 2,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If recipient is EIP-161-empty: &lt;code&gt;CALL_VALUE_COST = STATE_UPDATE + GAS_NEW_ACCOUNT = 26,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;This charge is in addition to warm&#x2F;cold account-touch costs per EIP-2929 and the existing &lt;code&gt;CALL&lt;&#x2F;code&gt; base cost. This EIP does not modify the &lt;code&gt;CALL&lt;&#x2F;code&gt; base cost.
The &lt;code&gt;CALL_VALUE_COST = 2,000&lt;&#x2F;code&gt; applies for all value-carrying calls, regardless of whether the callee&#x27;s account has already been updated earlier in the same transaction. This ensures the 2300-gas stipend mechanism remains safe and consistent for simple value forwarding and does not retroactively depend on account-update history.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Cold-account touches.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;COLD_ACCOUNT_COST_CODE = 2,600&lt;&#x2F;code&gt; when touching an account with code.&lt;&#x2F;li&gt;
&lt;li&gt;Use &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt; when touching an account known to have no code.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Warmth policy.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Access-list entries (charged via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;) and precompiles are warm at tx start.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALL&lt;&#x2F;code&gt; warms its &lt;code&gt;to&lt;&#x2F;code&gt; after charging the appropriate cold cost if cold.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;PAY&lt;&#x2F;code&gt;-style pure value-move primitive, if present, does not warm its recipient and never loads code. It pays &lt;code&gt;WARM_STATE_READ = 100&lt;&#x2F;code&gt; if warm for unrelated reasons, else &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt;, plus the value-write cost above.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Self-transfers.&lt;&#x2F;strong&gt; If &lt;code&gt;from == to&lt;&#x2F;code&gt;, only one &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; occurs. The sender&#x27;s nonce and balance update are coalesced into the same leaf write. No recipient lookup or separate write is charged. (Is a NOP tx other than charging gas and incrementing nonce).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transaction-reference-cases&quot;&gt;Transaction reference cases&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Case&lt;&#x2F;th&gt;&lt;th&gt;Formula&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Total Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;(NOP) No-transfer to EOA&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;(NOP) No-transfer to empty account&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;(NOP) ETH transfer to self&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,500&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH Transfer to existing EOA&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; + &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;No-transfer to contract&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,100 + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH Transfer to contract&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; + &lt;code&gt;STATE_UPDATE&lt;&#x2F;code&gt; + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;8,100 + &lt;strong&gt;execution&lt;&#x2F;strong&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH Transfer creating new account&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; + &lt;code&gt;COLD_ACCOUNT_COST_NOCODE&lt;&#x2F;code&gt; + &lt;code&gt;GAS_NEW_ACCOUNT&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;30,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;This aligns costs with actual state work rather than legacy flat surcharges.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edits-and-interactions-with-other-eips&quot;&gt;Edits and interactions with other EIPs&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt; (Access List).&lt;&#x2F;strong&gt; Intrinsic gas is &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; after &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;. Access lists keep their existing per-entry charges and warming semantics.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; (Gas cost increases for state access).&lt;&#x2F;strong&gt; Refined by this EIP to price non-code cold touches at &lt;code&gt;500&lt;&#x2F;code&gt; and code-account cold touches at &lt;code&gt;2,600&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7702&#x2F;&quot;&gt;EIP-7702&lt;&#x2F;a&gt; (Set EOA Code).&lt;&#x2F;strong&gt; &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; remains &lt;code&gt;4,500&lt;&#x2F;code&gt; even if the sender temporarily assumes code for the transaction. Clients must not perform any disk code-load to determine sender type, since 7702 provides code inline. If the transaction executes code that reads or executes its own code, normal &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; or &lt;code&gt;WARM_STATE_READ&lt;&#x2F;code&gt; costs apply at execution time as per the standard cold&#x2F;warm model.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Calldata-pricing EIPs (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt;).&lt;&#x2F;strong&gt; Unchanged. This EIP does not alter calldata pricing.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Price only what every transaction always does: ECDSA recovery, warming &lt;code&gt;sender&lt;&#x2F;code&gt; and &lt;code&gt;to&lt;&#x2F;code&gt;, and one account-leaf write for the sender (nonce + balance change). That sums to &lt;code&gt;4,500&lt;&#x2F;code&gt; gas. Anything not universal should be metered separately.&lt;&#x2F;p&gt;
&lt;p&gt;Calldata remains metered per byte. No calldata allowance is folded into the base. This reinforces ETH as money and payments: a plain ETH transfer carries no calldata, executes no bytecode, and touches no contract storage slots. It adds exactly one recipient touch (when not a smart contract) and one recipient leaf write, so its total is &lt;code&gt;6,000&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; is unchanged because its cost already includes account creation. Access-list pricing is unchanged.&lt;&#x2F;p&gt;
&lt;p&gt;Legacy pricing undercharged top-level ETH transfers that created new accounts relative to internal &lt;code&gt;CALL&lt;&#x2F;code&gt;-based creations. This EIP corrects that by charging &lt;code&gt;GAS_NEW_ACCOUNT = 25,000&lt;&#x2F;code&gt;, identical to the &lt;code&gt;CALL&lt;&#x2F;code&gt; account-creation surcharge, ensuring consistent pricing for state growth regardless of entry path.&lt;&#x2F;p&gt;
&lt;p&gt;This removes cross-subsidies, aligns charges with resources, and keeps costs equal across paths that perform the same state growth.&lt;&#x2F;p&gt;
&lt;p&gt;Do not fold any calldata allowance into the base. The envelope RLP (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;gas*&lt;&#x2F;code&gt;, &lt;code&gt;to&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;, &lt;code&gt;v&lt;&#x2F;code&gt;, &lt;code&gt;r&lt;&#x2F;code&gt;, &lt;code&gt;s&lt;&#x2F;code&gt;) is not charged as calldata and remains unmetered per byte. Only &lt;code&gt;tx.data&lt;&#x2F;code&gt; bytes are metered at the existing calldata schedule, and access lists keep their per-entry costs. A vanilla ETH transfer executes no bytecode and touches no contract storage slots; it performs signature recovery, warms the sender, and updates sender and recipient accounts. It therefore receives the base discount and pays only the additional recipient costs.&lt;&#x2F;p&gt;
&lt;p&gt;Bundling multiple transfers into a single contract call avoids repeated &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt;, but those transfers then execute serially inside one EVM context. That blocks parallel execution. With a lower per-tx base cost, users have less incentive to bundle, so more transfers remain independent transactions. Independent transactions can be scheduled across threads, which improves parallelism at the client and execution-layer level.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, reducing &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; not only corrects mispricing but also increases the share of transactions that are naturally parallelizable.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP composes cleanly with calldata-pricing proposals such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;&quot;&gt;EIP-7976&lt;&#x2F;a&gt;. Those EIPs affect &lt;code&gt;tx.data&lt;&#x2F;code&gt; metering, while this EIP adjusts only transaction-level intrinsic accounting. There is no overlapping scope.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-charge-full-tx-data-as-calldata&quot;&gt;Why not charge full tx data as calldata?&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Intrinsic coupling to signed fields.&lt;&#x2F;strong&gt; Pricing full-transaction bytes would make intrinsic gas depend on &lt;code&gt;gas_limit&lt;&#x2F;code&gt; and variable-length signature elements, creating fixed-point estimation issues and incentives for signature-length selection as well as iteration unstablity as &lt;code&gt;gas_limit&lt;&#x2F;code&gt; depends on signiture which contains &lt;code&gt;gas_limit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Serialization neutrality.&lt;&#x2F;strong&gt; A fee rule keyed to RLP size couples costs to one encoding and weakens &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; type neutrality and future formats such as SSZ. Calldata is treated as opaque bytes so it avoids this coupling.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Policy targeting and market floor.&lt;&#x2F;strong&gt; Calldata floors (for example &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7623&#x2F;&quot;&gt;EIP-7623&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7976&#x2F;&quot;&gt;EIP-7976&lt;&#x2F;a&gt;) price bytes in &lt;code&gt;tx.data&lt;&#x2F;code&gt; to bound EL payload and steer data to blobs; envelope bytes are control-plane. The &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; is the smallest tx size, and having a low encoding-agnostic intrinsic base keeps the minimum inclusion price coupled to the basefee market, without opening a DoS vector.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Native settlement and unit-of-account.&lt;&#x2F;strong&gt; Even though all transactions receive the same absolute gas reduction, it proportionally improves pristine ETH transfers more. With an ETH transfer at ~6,000 gas vs a permissioned ERC-20&#x2F;LST&#x2F;stablecoin transfer at ~48,000 gas, you get ~8x higher payment throughput per unit gas, which reinforces ETH as the settlement asset and reduces reliance on contract-based money (which carries smart contract risk, operator risk, governance risk and censorship risks via smart contract operator).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2780&#x2F;.&#x2F;assets&#x2F;1.png&quot; alt=&quot;Figure 1&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;effects-on-transactions-per-block&quot;&gt;Effects on transactions per block&lt;&#x2F;h3&gt;
&lt;p&gt;For execution-payload size, use &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7934&#x2F;&quot;&gt;EIP-7934&lt;&#x2F;a&gt;’s 8 MiB uncompressed cap: &lt;code&gt;8,388,608 bytes&lt;&#x2F;code&gt;. A typical EIP-1559 ETH transfer encodes at roughly &lt;code&gt;~110 bytes&lt;&#x2F;code&gt;, yielding a size cap of &lt;code&gt;floor(8,388,608 &#x2F; 110) = 76,260 tx&lt;&#x2F;code&gt; per block when size, not gas, is the binding constraint.&lt;&#x2F;p&gt;
&lt;p&gt;There are two useful ceilings to consider:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Minimal transaction with no value and no execution: &lt;code&gt;TX_BASE_COST = 4,500&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;Minimal ETH payment to an existing EOA: &lt;code&gt;6,000&lt;&#x2F;code&gt; gas (&lt;code&gt;TX_BASE_COST + COLD_ACCOUNT_COST_NOCODE + STATE_UPDATE&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Counts below are &lt;code&gt;floor(gaslimit &#x2F; per-tx-gas)&lt;&#x2F;code&gt;, then capped by &lt;code&gt;76,260&lt;&#x2F;code&gt; when the 8 MiB size limit binds. TPS figures round to the nearest integer.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scenario-a-minimal-txs-at-4-500-gas&quot;&gt;Scenario A: minimal txs at 4,500 gas&lt;&#x2F;h4&gt;
&lt;p&gt;Binding point for size-cap dominance: &lt;code&gt;76,260 * 4,500 = 343,170,000&lt;&#x2F;code&gt; gas. At gaslimits above ~343.17 M, block size, not gas, limits the tx count for 4,500-gas transactions.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Block gaslimit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Old tx&#x2F;bk (21k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;New tx&#x2F;bk (4.5k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 12s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 6s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 3s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 1.5s&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;45 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,142&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;833&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,667&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,667&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;60 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,857&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;13,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,111&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,222&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,444&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;8,889&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;100 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,761&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;22,222&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,852&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,704&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,407&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14,815&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;200 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;9,523&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;44,444&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,704&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,407&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;14,815&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;29,629&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;450 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,428&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;†76,260&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,355&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;12,710&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,420&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;50,840&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;† Size cap binds at 450 M because 450 M &amp;gt; 343.17 M.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scenario-b-eth-transfers-at-6-000-gas&quot;&gt;Scenario B: ETH transfers at 6,000 gas&lt;&#x2F;h4&gt;
&lt;p&gt;Binding point for size-cap dominance: &lt;code&gt;76,260 * 6,000 = 457,560,000&lt;&#x2F;code&gt; gas. At gaslimits below ~457.56 M, gas limits tx count; above it, the 8 MiB size cap dominates.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Block gaslimit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Old tx&#x2F;bk (21k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;New tx&#x2F;bk (6k)&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 12s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 6s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 3s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;TPS @ 1.5s&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;45 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,142&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;625&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,250&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;60 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,857&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;833&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,667&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,667&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;100 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;4,761&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16,666&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;1,389&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,778&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,555&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11,111&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;200 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;9,523&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33,333&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;2,778&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5,556&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;11,111&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;22,222&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;450 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,428&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;75,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,250&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;12,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;25,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;50,000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;changes-for-common-types-of-txs&quot;&gt;Changes for common types of txs&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Transaction Type&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Old Cost&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;New Cost&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;Change&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Simple ETH transfer (existing EOA)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;6,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−71 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ETH transfer creating new EOA&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;21,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;30,000&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;+43 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ERC-20 transfer (typical)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;63,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;48,200&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−24 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;ERC-20 transfer (Solady)&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33,400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;18,400&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−45 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Uniswap v3 swap&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;184,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;169,500&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−8 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Uniswap v3 add-liquidity&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;216,900&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;201,900&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;−7 %&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;reference-mgas-s-for-gaslimit-vs-slot-time&quot;&gt;Reference MGas&#x2F;s for gaslimit vs slot time&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: right&quot;&gt;Block gaslimit&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 12s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 6s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 3s&lt;&#x2F;th&gt;&lt;th style=&quot;text-align: right&quot;&gt;MGas&#x2F;s @ 1.5s&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;45 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;3.75&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;7.50&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;15.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;30.00&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;60 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;5.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;10.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;20.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;40.00&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;100 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;8.33&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16.67&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33.33&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;66.67&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;200 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;16.67&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;33.33&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;66.67&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;133.33&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: right&quot;&gt;450 M&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;37.50&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;75.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;150.00&lt;&#x2F;td&gt;&lt;td style=&quot;text-align: right&quot;&gt;300.00&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is &lt;strong&gt;not&lt;&#x2F;strong&gt; backward compatible. It is a consensus gas repricing that must be activated at &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Wallets, RPCs, gas estimators, and any logic that assumes a &lt;code&gt;21,000&lt;&#x2F;code&gt; base must update.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;While the benefits of reducing transactions&#x27; intrinsic cost are apparent, such a change should be applied if it imposes no negative externalities, or if such effects are negligible.&lt;&#x2F;p&gt;
&lt;p&gt;Tests should be created with blocks of just ETH transfers and tested on Perfnet across all EL clients to ensure the pricing is correct.&lt;&#x2F;p&gt;
&lt;p&gt;Add explicit test vectors (intrinsic gas only):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; to an empty EOA (non-existent per EIP-161): intrinsic &lt;code&gt;30,000&lt;&#x2F;code&gt; (4,500 base + 500 + 25,000 surcharge).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; to a precompile: intrinsic &lt;code&gt;4,500&lt;&#x2F;code&gt; (no surcharge; precompiles are warm at tx start).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;value = 0&lt;&#x2F;code&gt; to an empty address: intrinsic &lt;code&gt;4,500&lt;&#x2F;code&gt; (no creation, no surcharge).&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; transaction: unchanged from prior rules.&lt;&#x2F;li&gt;
&lt;li&gt;EIP-7702 transaction with and without access list: intrinsic uses &lt;code&gt;TX_BASE_COST&lt;&#x2F;code&gt; plus unchanged access-list costs.&lt;&#x2F;li&gt;
&lt;li&gt;Block of txs calling minimal gas contract execution with maximal contract size addresses (so VM is activated for every tx).&lt;&#x2F;li&gt;
&lt;li&gt;Warmth and access list interplay
&lt;ul&gt;
&lt;li&gt;ETH transfer to existing EOA without access list: charge &lt;code&gt;COLD_ACCOUNT_COST_NOCODE = 500&lt;&#x2F;code&gt; for recipient lookup.&lt;&#x2F;li&gt;
&lt;li&gt;Same transaction with recipient in access list: charge &lt;code&gt;WARM_STATE_READ = 100&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;7702 interactions
&lt;ul&gt;
&lt;li&gt;7702 tx where sender assumes code and calls nothing: intrinsic = 4,500, no extra cold-code cost.&lt;&#x2F;li&gt;
&lt;li&gt;7702 tx where sender assumes code and executes self-code: charge &lt;code&gt;COLD_ACCOUNT_COST_CODE&lt;&#x2F;code&gt; when first loaded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Precompile transfers
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;value &amp;gt; 0&lt;&#x2F;code&gt; to &lt;code&gt;0x01&lt;&#x2F;code&gt;–&lt;code&gt;0x09&lt;&#x2F;code&gt;: intrinsic = 4,500, no surcharge.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Self-transfer &lt;code&gt;from == to&lt;&#x2F;code&gt;: total = 4,500.&lt;&#x2F;li&gt;
&lt;li&gt;Internal CALL repricing
&lt;ul&gt;
&lt;li&gt;Internal &lt;code&gt;CALL&lt;&#x2F;code&gt; to existing EOA with value: &lt;code&gt;CALL_VALUE_COST = 2,000&lt;&#x2F;code&gt; plus cold&#x2F;warm costs.&lt;&#x2F;li&gt;
&lt;li&gt;Internal &lt;code&gt;CALL&lt;&#x2F;code&gt; to EIP-161-empty: &lt;code&gt;CALL_VALUE_COST = 26,000&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Zero-value edge cases &lt;code&gt;value = 0&lt;&#x2F;code&gt; to empty address: intrinsic = &lt;code&gt;4,500&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Perfnet stress
&lt;ul&gt;
&lt;li&gt;Fill block with minimal 4,500-gas tx and 6,000-gas ETH transfers; confirm gas vs byte-size binding per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7934&#x2F;&quot;&gt;EIP-7934&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;SELFDESTRUCT test: Create-and-destroy in one tx; confirm normal value-transfer costs apply, no deletion repricing.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As this significantly increases the max tx per block this carries risk.&lt;&#x2F;p&gt;
&lt;p&gt;However this pricing should be the same as performing the component changes inside the transaction; and it factors in the additional costs from state growth which were not originally in the transaction base price.&lt;&#x2F;p&gt;
&lt;p&gt;Current gaslimit testing mostly uses a block with a single transaction; so this should not cause unexpected load compared to what is already being tested.&lt;&#x2F;p&gt;
&lt;p&gt;The semantics of &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; remain unchanged. Following &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;6780&#x2F;&quot;&gt;EIP-6780&lt;&#x2F;a&gt;, only contracts created within the same transaction may be fully deleted. This EIP does not reprice or modify any &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; side-effects.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Package</title>
        <published>2020-06-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Matt Garnett</name><uri>https://github.com/lightclient</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2733/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-transaction-package/4365" />
        

        <id>https://wg-eips.ritovision.com/2733/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2733"
            label="EIP-2733" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2733/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creates a new transaction type which executes a package of one or more
transactions, while passing status information to subsequent transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new transaction type which includes a list of transactions that
must be executed serially by clients. Execution information (e.g. success,
gas_used, etc.) will be propagated forward to the next transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Onboarding new users to Ethereum has been notoriously difficult due to the need
for new users to acquire enough ether to pay for their transactions. This
hurdle has seen a significant allocation of resources over the years to solve.
Today, that solution is meta-transactions. This is, unfortunately, a brittle
solution that requires signatures to be recovered within a smart contract to
authenticate the message. This EIP aims to provide a flexible framework for
relayers to &quot;sponsor&quot; many transactions at once, trustlessly.&lt;&#x2F;p&gt;
&lt;p&gt;Meta-transactions often use relay contracts to maintain nonces and allow users
to pay for gas using alternative assets. They have historically been designed
to catch reversions in their inner transactions by only passing a portion of
the available gas to the subcall. This allows them to be certain the outer call
will have enough gas to complete any required account, like processing a gas
payment. This type of subcall has been considered bad practice for a long time,
but in the case of where you don&#x27;t trust the subcalls, it is the only available
solution.&lt;&#x2F;p&gt;
&lt;p&gt;Transaction packages are an alternative that allow multiple transactions to be
bundled into one package and executed atomically, similarly to how relay
contracts operate. Transactions are able to pass their result to subsequent
transactions. This allows for conditional workflows based on the outcome of
previous transactions. Although this functionality is already possible as
described above, workflows using transaction packages are more robust, because
they are protected from future changes to the gas schedule.&lt;&#x2F;p&gt;
&lt;p&gt;An important byproduct of this EIP is that it also facilitates bundling
transactions for single users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type where &lt;code&gt;id = 2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct TransactionPackage {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    chain_id: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    children: [ChildPackage],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce: u64,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_price: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s: u256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;hash&quot;&gt;Hash&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;keccak256(rlp([2, chain_id, children, nonce, gas_price, v, r, s])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;signature-hash&quot;&gt;Signature Hash&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;keccak256(rlp([2, chain_id, children, nonce, gas_price])&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;receipt&quot;&gt;Receipt&lt;&#x2F;h5&gt;
&lt;p&gt;Each &lt;code&gt;ChildTransaction&lt;&#x2F;code&gt; transaction will generate a &lt;code&gt;ChildReceipt&lt;&#x2F;code&gt; after execution. Each
of these receipts will be aggregated into a &lt;code&gt;Receipt&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;type Receipt = [ChildReceipt]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ChildReceipt {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    status: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cumulative_gas_used: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs_bloom: [u8; 256],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    logs: [u8]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;child-transaction&quot;&gt;Child Transaction&lt;&#x2F;h4&gt;
&lt;p&gt;Let &lt;code&gt;ChildPackage&lt;&#x2F;code&gt; be interpreted as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ChildPackage {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    type: u8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    nonce: u64,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    transactions: [ChildTransaction],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_gas_price: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    v: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    r: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s: u256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct ChildTransaction {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    flags: u8,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    to: Address,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    value: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    data: [u8],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    extra: [u8],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_limit: u256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h5 id=&quot;types&quot;&gt;Types&lt;&#x2F;h5&gt;
&lt;p&gt;The &lt;code&gt;type&lt;&#x2F;code&gt; field is used to denote whether the &lt;code&gt;Child&lt;&#x2F;code&gt; signer wishes to
delegate the &lt;code&gt;max_gas_price&lt;&#x2F;code&gt; and &lt;code&gt;gas_limit&lt;&#x2F;code&gt; choice to the &lt;code&gt;TransactionPackage&lt;&#x2F;code&gt;
signer.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;type&lt;&#x2F;th&gt;&lt;th&gt;signature hash&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(rlp([0, nonce, transactions, max_gas_price])&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x01&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;keccak256(rlp([1, nonce, transactions_without_gas_limit])&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;TransactionPackage&lt;&#x2F;code&gt; can be deemed valid or invalid as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;rust&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;fn&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_valid&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Config&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;State&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionPackage&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;chain_id&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;chain_id &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cum_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;map&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;sum&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; cum_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;children &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;nonce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; child&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;txs &lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;flags &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extra&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; !=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                tx&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; intrinsic_gas&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            )&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;    true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;results&quot;&gt;Results&lt;&#x2F;h3&gt;
&lt;p&gt;Subsequent &lt;code&gt;ChildTransaction&lt;&#x2F;code&gt;s will be able to receive the result of the
previous &lt;code&gt;ChildTransaction&lt;&#x2F;code&gt; via &lt;code&gt;RETURNDATACOPY (0x3E)&lt;&#x2F;code&gt; in first frame of
execution, before making any subcalls. Each element, except the last, will be
&lt;code&gt;0&lt;&#x2F;code&gt;-padded left to 32 bytes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;struct Result {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Status of the previous transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    success: bool,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Total gas used by the previous transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    gas_used: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; Cumulative gas used by previous transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cum_gas_used: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; The size of the return value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return_size: u256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; The return value of the previous transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return_value: [u8]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;intrinsic-cost&quot;&gt;Intrinsic Cost&lt;&#x2F;h3&gt;
&lt;p&gt;Let the intrinsic cost of the transaction package be defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fn intrinsic_gas(tx: TransactionPackage) u256 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    let data_gas = tx.children.map(|c| c.txs.map(|t| data_cost(&amp;amp;c.data)).sum()).sum();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    17000 + 8000 * tx.children.len() + data_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;execution&quot;&gt;Execution&lt;&#x2F;h3&gt;
&lt;p&gt;Transaction packages should be executed as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Deduct the cumulative cost from the outer signer&#x27;s balance.&lt;&#x2F;li&gt;
&lt;li&gt;Load the first child package, and execute the first child transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Record all state changes, logs, the receipt, and refund any unused gas.&lt;&#x2F;li&gt;
&lt;li&gt;If there are no more child transactions, goto &lt;code&gt;8&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Compute &lt;code&gt;Result&lt;&#x2F;code&gt; for the previously executed transaction.&lt;&#x2F;li&gt;
&lt;li&gt;Prepare &lt;code&gt;Result&lt;&#x2F;code&gt; to be available via return opcodes in the next
transaction&#x27;s first frame.&lt;&#x2F;li&gt;
&lt;li&gt;Execute the next transaction, then goto &lt;code&gt;3&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Load the next child package, then goto &lt;code&gt;7&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;each-child-has-its-own-signature&quot;&gt;Each &lt;code&gt;Child&lt;&#x2F;code&gt; has its own signature&lt;&#x2F;h3&gt;
&lt;p&gt;For simplicity, the author has chosen to require each child package to specify
its own signature, even if the signer is the same as the package signer. This
choice is made to allow for maximum flexibility, with minimal client changes.
This transaction can still be used by a single user at the cost of only one
additional signature recovery.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;childpackage-specifies-max-gas-price-instead-of-gas-price&quot;&gt;&lt;code&gt;ChildPackage&lt;&#x2F;code&gt; specifies &lt;code&gt;max_gas_price&lt;&#x2F;code&gt; instead of &lt;code&gt;gas_price&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing child packages to specify a range of acceptable gas prices is
strictly more versatile than a static price. It gives relayers more flexibility
in terms of building transaction bundles, and it makes it possible for relayers
to try and achieve the best price for the transaction sender. With a fixed
price, the relayer may require the user to sign multiple different
transactions, with varying prices. This can be avoided by specifying a max
price, and communicating out-of-band how the urgency of the transaction (e.g.
the relayer should package it with the max price immediately vs. slowly
increasing the gas price).
A future transaction type can be specified with only a single
signature, if such an optimization is desired.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;childpackage-is-also-typed&quot;&gt;&lt;code&gt;ChildPackage&lt;&#x2F;code&gt; is also typed&lt;&#x2F;h3&gt;
&lt;p&gt;The type element serves a modest role in the transaction type, denoting whether
the transaction signer wishes to delegate control of the gas price and gas
limit to the outer signer. This is a useful UX improvement when interacting
with a trusted relayer, as once the user decides to make a transaction the
relayer can ensure it is included on chain by choosing the best gas price and
limit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-flags-and-extra-fields-aren-t-used&quot;&gt;The &lt;code&gt;flags&lt;&#x2F;code&gt; and &lt;code&gt;extra&lt;&#x2F;code&gt; fields aren&#x27;t used&lt;&#x2F;h3&gt;
&lt;p&gt;These fields are included to better support future changes to the transaction
type. This would likely be used in conjunction with the &lt;code&gt;flags&lt;&#x2F;code&gt; and &lt;code&gt;type&lt;&#x2F;code&gt;
fields. A benefit of explicitly defining them is that specialized serialization
of RLP can be avoided, simplifying clients and downstream infrastructure. The
author believe the cost of 2 bytes per transaction is acceptable for smoother
integration of future features.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts which rely on &lt;code&gt;ORIGIN (0x32) == CALLER (0x33) &amp;amp;&amp;amp; RETURNDATASIZE (0x3D) == 0x00&lt;&#x2F;code&gt; will now always fail in transaction packages, unless they are
the first executed transaction. It’s unknown if any contracts conduct this
check.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;managing-packages-efficiently-in-the-mempool&quot;&gt;Managing packages efficiently in the mempool&lt;&#x2F;h3&gt;
&lt;p&gt;The introduction of a new transaction type brings along new concerns regarding
the mempool. Done naively, it could turn into a DDoS vector for clients. This
EIP has been written to reduce as much validation complexity as possible.&lt;&#x2F;p&gt;
&lt;p&gt;An existing invariant in the mempool that is desirable for new transactions to
maintain, is that transactions can be validated in constant time. This is also
possible for packaged transactions. There is an inherent 10Mb limit for RLPx
frames, so that would be the upper bound on transactions that could be included
in a package. On the other hand, clients can also just configure their own
bound locally (e.g. packages must be less than 1Mb). Validity can then be
determined by using the function above.&lt;&#x2F;p&gt;
&lt;p&gt;Once a package has been validated, it must continuously be monitored for nonce
invalidations within its package. One potential way to achieve this efficiently
is to modify the mempool to operate on thin pointers to the underlying
transaction. This will allow packages to ingest as many &quot;single&quot; transactions,
simplifying the facilities for monitoring changes. These &quot;parts&quot; of the package
can maintain a pointer to a structure with pointers to all the parts of the
package. This way, as soon as one part becomes invalid, it can request the
parent to invalidate all outstanding parts of the package.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Typed Transaction Envelope</title>
        <published>2020-06-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2718/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2718-typed-transaction-envelope/4355" />
        

        <id>https://wg-eips.ritovision.com/2718/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2718"
            label="EIP-2718" />
        

        
        

        
        <summary type="html">Defines a new transaction type that is an envelope for future transaction types.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2718/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;TransactionType || TransactionPayload&lt;&#x2F;code&gt; is a valid transaction and &lt;code&gt;TransactionType || ReceiptPayload&lt;&#x2F;code&gt; is a valid transaction receipt where &lt;code&gt;TransactionType&lt;&#x2F;code&gt; identifies the format of the transaction and &lt;code&gt;*Payload&lt;&#x2F;code&gt; is the transaction&#x2F;receipt contents, which are defined in future EIPs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In the past, when we have wanted to add new transaction types we have had to ensure they were backward compatible with all other transactions, meaning that you could differentiate them based only on the encoded payload, and it was not possible to have a transaction that matched both types.
This was seen in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; where the new value was bit-packed into one of the encoded fields.
There are multiple proposals in discussion that define new transaction types such as one that allows EOA accounts to execute code directly within their context, one that enables someone besides &lt;code&gt;msg.sender&lt;&#x2F;code&gt; to pay for gas, and proposals related to layer 1 multi-sig transactions.
These all need to be defined in a way that is mutually compatible, which quickly becomes burdensome to EIP authors and to clients who now have to follow complex rules for differentiating transaction type.&lt;&#x2F;p&gt;
&lt;p&gt;By introducing an envelope transaction type, we only need to ensure backward compatibility with existing transactions and from then on we just need to solve the much simpler problem of ensuring there is no numbering conflict between &lt;code&gt;TransactionType&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;||&lt;&#x2F;code&gt; is the byte&#x2F;byte-array concatenation operator.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;transactions&quot;&gt;Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the transaction root in the block header &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the root hash of &lt;code&gt;patriciaTrie(rlp(Index) =&amp;gt; Transaction)&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Index&lt;&#x2F;code&gt; is the index in the block of this transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Transaction&lt;&#x2F;code&gt; is either &lt;code&gt;TransactionType || TransactionPayload&lt;&#x2F;code&gt; or &lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is a positive unsigned 8-bit number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7f&lt;&#x2F;code&gt; that represents the type of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; is an opaque byte array whose interpretation is dependent on the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; and defined in future EIPs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyTransaction&lt;&#x2F;code&gt; is &lt;code&gt;rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;All signatures for future transaction types &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; include the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; as the first byte of the signed data.
This makes it so we do not have to worry about signatures for one transaction type being used as signatures for a different transaction type.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;receipts&quot;&gt;Receipts&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the receipt root in the block header &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be the root hash of &lt;code&gt;patriciaTrie(rlp(Index) =&amp;gt; Receipt)&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Index&lt;&#x2F;code&gt; is the index in the block of the transaction this receipt is for&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Receipt&lt;&#x2F;code&gt; is either &lt;code&gt;TransactionType || ReceiptPayload&lt;&#x2F;code&gt; or &lt;code&gt;LegacyReceipt&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt; is a positive unsigned 8-bit number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7f&lt;&#x2F;code&gt; that represents the type of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; is an opaque byte array whose interpretation is dependent on the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; and defined in future EIPs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;LegacyReceipt&lt;&#x2F;code&gt; is &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs])&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of the receipt &lt;strong&gt;MUST&lt;&#x2F;strong&gt; match the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of the transaction with a matching &lt;code&gt;Index&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;transactiontype-only-goes-up-to-0x7f&quot;&gt;TransactionType only goes up to 0x7f&lt;&#x2F;h3&gt;
&lt;p&gt;For the forseable future, 0x7f is plenty and it leaves open a number of options for extending the range such as using the high bit as a continuation bit.
This also prevents us from colliding with legacy transaction types, which always start with a byte &lt;code&gt;&amp;gt;= 0xc0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;should-instead-of-must-for-the-transactiontype-being-first-byte-of-signed-data&quot;&gt;&lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; instead of &lt;strong&gt;MUST&lt;&#x2F;strong&gt; for the TransactionType being first byte of signed data&lt;&#x2F;h3&gt;
&lt;p&gt;While it is strongly recommended that all future transactions sign the first byte to ensure that there is no problem with signature reuse, the authors acknowledge that this may not always make sense or be possible.
One example where this isn&#x27;t possible is wrapped legacy transactions that are signature compatible with the legacy signing scheme.
Another potential situation is one where transactions don&#x27;t have a signature in the traditional sense and instead have some other mechanism for determining validity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transactiontype-selection-algorithm&quot;&gt;TransactionType selection algorithm&lt;&#x2F;h3&gt;
&lt;p&gt;There was discussion about defining the &lt;code&gt;TransactionType&lt;&#x2F;code&gt; identifier assignment&#x2F;selection algorithm in this standard.
While it would be nice to have a standardized mechanism for assignment, at the time of writing of this standard there is not a strong need for it so it was deemed out of scope.
A future EIP may introduce a standard for TransactionType identifier assignment if it is deemed necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;opaque-byte-array-rather-than-an-rlp-array&quot;&gt;Opaque byte array rather than an RLP array&lt;&#x2F;h3&gt;
&lt;p&gt;By having the second byte on be opaque bytes, rather than an RLP (or other encoding) list, we can support different encoding formats for the transaction payload in the future such as SSZ, LEB128, or a fixed width format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;origin-and-caller&quot;&gt;ORIGIN and CALLER&lt;&#x2F;h3&gt;
&lt;p&gt;There was discussion about having ORIGIN and CALLER opcodes become dependent on the transaction type, so that each transaction type could define what those opcodes returned.
However, there is a desire to make transaction type opaque to the contracts to discourage contracts treating different types of transactions differently.
There also were concerns over backward compatibility with existing contracts which make assumptions about ORIGIN and CALLER opcodes.
Going forward, we will assume that all transaction types will have an address that reasonably represents a &lt;code&gt;CALLER&lt;&#x2F;code&gt; of the first EVM frame and &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; will be the same address in all cases.
If a transaction type needs to supply additional information to contracts, they will need a new opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Clients can differentiate between the legacy transactions and typed transactions by looking at the first byte.
If it starts with a value in the range &lt;code&gt;[0, 0x7f]&lt;&#x2F;code&gt; then it is a new transaction type, if it starts with a value in the range &lt;code&gt;[0xc0, 0xfe]&lt;&#x2F;code&gt; then it is a legacy transaction type.
&lt;code&gt;0xff&lt;&#x2F;code&gt; is not realistic for an RLP encoded transaction, so it is reserved for future use as an extension sentinel value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;When designing a new 2718 transaction type, it is &lt;strong&gt;STRONGLY&lt;&#x2F;strong&gt; recommended to include the transaction type as the first byte of the signed payload.  If you fail to do this, it is possible that your transaction may be signature compatible with transactions of another type which can introduce security vulnerabilities for users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sponsored, expiring and batch transactions.</title>
        <published>2020-06-11T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2711/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2711-separate-gas-payer-from-msg-sender/4353" />
        

        <id>https://wg-eips.ritovision.com/2711/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:2711"
            label="EIP-2711" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2711/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creates a new transaction type that supports sponsored transactions (separate gas payer from sender), batch transactions (multiple transactions executed in sequence), and expiring transactions (transactions which are not valid after a certain timestamp).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An EIP-2718 transaction with the type number &lt;code&gt;2&lt;&#x2F;code&gt; is a new type of transaction that includes support for:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Sponsored Transactions&lt;&#x2F;strong&gt;: an optional additional signature from which the account that will pay for gas (&lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt;) can be recovered&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Batch Transactions&lt;&#x2F;strong&gt;: multiple transactions from the same sender that will be executed in sequence&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Expiring Transactions&lt;&#x2F;strong&gt;: an optional &lt;code&gt;validUntil&lt;&#x2F;code&gt; field that makes the transaction invalid after a certain point in time&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;sponsored-transactions&quot;&gt;Sponsored Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;With the advent of tokens and especially stable coins, it has become common for users to not hold ETH in an account while they may have other assets of value in that account.  Some users don&#x27;t want to be exposed to the perceived volatility of ETH and instead would prefer to transact using other assets.  Unfortunately, since gas &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be paid for with ETH, this prevents the user from transacting with their assets without first acquiring some ETH using some other means, and then using that ETH to pay fees.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP proposes a mechanism by which we can allow people to transact without ever having to own any ETH by allowing someone else to cover gas costs.  The arrangements that enable the covering of gas costs is out of scope for this EIP but it could be an extra-protocol monthly subscription, payment could occur as part of the transaction being submitted, the recipient may be willing to cover gas costs, or it could be a free service offered as a value-add by a company that you are working with.&lt;&#x2F;p&gt;
&lt;p&gt;While it is possible to implement these sort of mechanisms at the individual contract layer, such solutions require integration by just about every contract and those solutions also end up depending on gas costs being stable with time in order to appropriately bake them into contracts without putting either party at risk of malicious participants in the system.  For this reason, it is believed that separating out &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; from &lt;code&gt;msg.sender&lt;&#x2F;code&gt; at the protocol layer is valuable.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;batch-transactions&quot;&gt;Batch Transactions&lt;&#x2F;h3&gt;
&lt;p&gt;Often times an EOA may want to execute a series of transactions with a strong guarantee that they happen in order with nothing occurring between them.  For example, one may want to send some tokens to a contract and then follow that up with another transaction that makes a contract call on the destination address that causes those tokens to be registered to them.  By supporting transaction batching at layer 1, we can ensure that the user can get strong guarantees at signing time of cross-transaction atomicity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;expiring-transactions&quot;&gt;Expiring Transactions&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;If any form of dust-account clearing is introduced, e.g. (https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;168), it will be necessary to introduce a replay protection, such as https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;169 . Having temporal replay protection removes the need to change nonce-behaviour in the state, since transactions would not be replayable at a later date than explicitly set by the user.&lt;&#x2F;li&gt;
&lt;li&gt;In many cases, such as during ICOs, a lot of people want their transactions to either become included soon (within a couple of hours) or not at all. Currently, transactions are queued and may not execute for several days, at a cost for both the user (who ends up paying gas for a failing purchase) and the network, dealing with the large transaction queues.&lt;&#x2F;li&gt;
&lt;li&gt;Node implementations have no commonly agreed metric for which transactions to keep, discard or propagate. Having a TTL on transactions would make it easier to remove stale transactions from the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;definitions&quot;&gt;Definitions&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;TransactionType&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; 2.  See &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;TransactionSubtype&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is either 1, 2, 3, or 4.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ChainId&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The transaction is valid if this value is &lt;code&gt;0&lt;&#x2F;code&gt; or it is included in a block on a chain whose ID is equal to this value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ValidUntil&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The transaction is valid if this value is &lt;code&gt;0&lt;&#x2F;code&gt; or it is included in a block whose &lt;code&gt;timestamp&lt;&#x2F;code&gt; is less than or equal to this value.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;YParity&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; The parity (0 for even, 1 for odd) of the y-value of a secp256k1 signature.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;ChildTransaction&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; A nested transaction consisting of &lt;code&gt;[to, value, data]&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;SenderPayload&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Defined based on the &lt;code&gt;TransactionSubtype&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;[1, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit, gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[2, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit, gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[3, ChildTransaction[], nonce, ChainId, ValidUntil, gasLimit]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[4, ChildTransaction[], nonce, ChainId, ValidUntil]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;SenderSignature&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;code&gt;[YParity, r, s]&lt;&#x2F;code&gt; of &lt;code&gt;secp256k1(keccak256(rlp([TransactionType, SenderPayload])))&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;GasPayerPayload&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; Defined based on the &lt;code&gt;TransactionSubtype&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;[gasLimit, gasPrice]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;GasPayerSignature&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; is &lt;code&gt;[]&lt;&#x2F;code&gt; for &lt;code&gt;TransactionSubType&lt;&#x2F;code&gt; &lt;code&gt;1&lt;&#x2F;code&gt; or &lt;code&gt;[YParity, r, s]&lt;&#x2F;code&gt; of &lt;code&gt;secp256k1(keccak256(rlp([SenderPayload, SenderSignature, GasPayerPayload])))&lt;&#x2F;code&gt; for others.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-transaction-type&quot;&gt;New Transaction Type&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction with a &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of &lt;code&gt;2&lt;&#x2F;code&gt; will have its &lt;code&gt;Payload&lt;&#x2F;code&gt; interpreted as an RLP encoded tuple of:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[...SenderPayload, ...SenderSignature, ...GasPayerPayload, ...GasPayerSignature]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The address recovered from &lt;code&gt;SenderSignature&lt;&#x2F;code&gt; is the address...&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;...returned by the &lt;code&gt;CALLER&lt;&#x2F;code&gt; opcode (0x33, aka &lt;code&gt;msg.sender&lt;&#x2F;code&gt;) during the first call frame of the transaction&lt;&#x2F;li&gt;
&lt;li&gt;...returned by the &lt;code&gt;ORIGIN&lt;&#x2F;code&gt; opcode (0x32, aka &lt;code&gt;tx.origin&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;...whose &lt;code&gt;nonce&lt;&#x2F;code&gt; is used&lt;&#x2F;li&gt;
&lt;li&gt;...whose ETH balance is deducted if any value is attached to the transaction&lt;&#x2F;li&gt;
&lt;li&gt;...whose ETH balance is deducted to pay for gas if &lt;code&gt;GasPayerSignature&lt;&#x2F;code&gt; is not present&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If &lt;code&gt;GasPayerSignature&lt;&#x2F;code&gt; is present, then the address recovered from it is the address...&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;...whose ETH balance is deducted to pay for gas&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The base gas cost of transactions of this type will be &lt;code&gt;TRANSACTION_TYPE_2_BASE_GAS_PRICE&lt;&#x2F;code&gt; + &lt;code&gt;TRANSACTION_TYPE_2_CHILD_GAS_PRICE&lt;&#x2F;code&gt; * &lt;code&gt;n&lt;&#x2F;code&gt;, rather than the cost associated with transactions of type &lt;code&gt;0&lt;&#x2F;code&gt; and legacy transactions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;new-transaction-receipt&quot;&gt;New Transaction Receipt&lt;&#x2F;h3&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction receipt with a &lt;code&gt;TransactionType&lt;&#x2F;code&gt; of &lt;code&gt;2&lt;&#x2F;code&gt; will have its &lt;code&gt;Payload&lt;&#x2F;code&gt; interpreted as a &lt;code&gt;rlp([status, cumulativeGasUsed, logsBloom, logs][])&lt;&#x2F;code&gt; where each item of the array corresponds to the child-transaction at matching offset in the transaction type 2 &lt;code&gt;Payload&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;one-monolithic-eip&quot;&gt;One Monolithic EIP&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP could be split up into multiple EIPs, one for each of the subtypes and one for the meta-type.  Alternatively, each of the subtypes could be a unique TransactionType.  The reason we chose to go with a single EIP with subtypes is because these 4 transactions all have a &lt;em&gt;lot&lt;&#x2F;em&gt; in common and each separate EIP would be almost identical to the previous.  We felt that in this case, splitting into multiple EIPs wasn&#x27;t worth the duplication of EIP content.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chainid-not-encoded-with-v&quot;&gt;ChainID not encoded with &lt;code&gt;v&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;While we could save one byte in the common case by bundling the y-parity bit of the signature with the Chain ID like in EIP-155, this adds complexity to signing tools that the authors deem not worth it given the size of the transaction overall.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optionality-of-chainid&quot;&gt;Optionality of ChainID&lt;&#x2F;h3&gt;
&lt;p&gt;Sometimes it is useful to have a transaction that &lt;em&gt;can&lt;&#x2F;em&gt; be replayed on multiple chains.  An example of this is when you construct a vanity signature for a transaction and have the &lt;code&gt;from&lt;&#x2F;code&gt; be whatever address that signature recovers to.  With the ability to have someone else be a gas payer (setting both the gas limit and the gas price), one can have transactions that deploy contracts which live at the same address on every chain.  While this can be accomplished with CREATE2 using legacy transactions, we have the opportunity here to simplify the process and enable potentially other future uses of deterministic transactions by making ChainID optional.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;optionality-of-validuntil&quot;&gt;Optionality of ValidUntil&lt;&#x2F;h3&gt;
&lt;p&gt;A user can set &lt;code&gt;ValidUntil&lt;&#x2F;code&gt; to a very large number which effectively makes it non-expiring.  By making &lt;code&gt;ValidUntil&lt;&#x2F;code&gt; optional, we can save some bytes on the wire by allowing such transactions to simply have a &lt;code&gt;0&lt;&#x2F;code&gt; (1 byte in RLP) value for this field.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sender-sets-gaslimit-and-gasprice&quot;&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt; sets &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This type of transaction is useful when the transaction may execute differently depending on what these values are set to.  By having the &lt;code&gt;SENDER&lt;&#x2F;code&gt; set both, we ensure that the &lt;code&gt;SENDER&lt;&#x2F;code&gt; has full control over the transaction details.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sender-sets-gaslimit-gas-payer-sets-gasprice&quot;&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt; sets &lt;code&gt;gasLimit&lt;&#x2F;code&gt;, &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; sets &lt;code&gt;gasPrice&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This type of transaction is useful when the transaction may execute differently depending on how much gas it is allowed (e.g., number of loops) but where the &lt;code&gt;SENDER&lt;&#x2F;code&gt; would like to give the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; the ability to price the transaction to maximize chances of inclusion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-payer-sets-gaslimit-and-gasprice&quot;&gt;&lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; sets &lt;code&gt;gasLimit&lt;&#x2F;code&gt; and &lt;code&gt;gasPrice&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This type of transaction allows the &lt;code&gt;SENDER&lt;&#x2F;code&gt; to define what they want to do, and leaves all worry about gas to the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt;.  This is useful for transactions where the sender doesn&#x27;t care how much gas is used or the price that is paid and also either trusts the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; to be non-malicious or doesn&#x27;t care if the &lt;code&gt;SENDER&lt;&#x2F;code&gt;&#x27;s nonce is increased.  Such situations are useful when you have extra-protocol trust between the &lt;code&gt;SENDER&lt;&#x2F;code&gt; and &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; and you want to separate concerns (what to do vs how to get included) for security or complexity reasons.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;nonces&quot;&gt;Nonces&lt;&#x2F;h3&gt;
&lt;p&gt;The inner transaction needs a nonce to protect themselves from replay attacks.  Since the inner transaction has a nonce, we get replay protection on the outer transaction as well, so it is not critical for security to have multiple parties provide a nonce.&lt;&#x2F;p&gt;
&lt;p&gt;We could have the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; provide a second nonce, but this would increase the payload size and require &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; to do replace-by-fee (noisy for gossip) if they want to slip in a new (different inner) transaction with a higher gas price.  It would also create the possibility of a deadlock if the &lt;code&gt;SENDER&lt;&#x2F;code&gt; nonces aren&#x27;t ordered the same as the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; nonces, and if the &lt;code&gt;SENDER&lt;&#x2F;code&gt; nonce isn&#x27;t the lowest valid nonce for the &lt;code&gt;SENDER&lt;&#x2F;code&gt; then the &lt;code&gt;GAS_PAYER&lt;&#x2F;code&gt; can&#x27;t sign and submit yet.  Finally, client complexity increases slightly if a transaction has two nonces because you have to protect yourself from deadlocks and do more work to determine validity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validuntil&quot;&gt;ValidUntil&lt;&#x2F;h3&gt;
&lt;p&gt;For the dust-account clearing usecase,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This change is much less invasive in the consensus engine.
&lt;ul&gt;
&lt;li&gt;No need to maintain a consensus-field of &#x27;highest-known-nonce&#x27; or cap the number of transactions from a sender in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Only touches the transaction validation part of the consensus engine&lt;&#x2F;li&gt;
&lt;li&gt;Other schemas which uses the &lt;code&gt;nonce&lt;&#x2F;code&gt; can have unintended side-effects,
&lt;ul&gt;
&lt;li&gt;such as inability to create contracts at certain addresses.&lt;&#x2F;li&gt;
&lt;li&gt;more difficult to integrate with offline signers, since more elaborate nonce-schemes requires state access to determine.&lt;&#x2F;li&gt;
&lt;li&gt;More intricate schemes like &lt;code&gt;highest-nonce&lt;&#x2F;code&gt; are a lot more difficult, since highest-known-nonce will be a consensus-struct that is incremented and possibly reverted during transaction execution, requiring one more journalled field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validuntil-as-timestamp-instead-of-block-number&quot;&gt;ValidUntil as timestamp instead of block number&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The unix time is generally available in most settings, even on a computer which is offline. This means that even a setup where blockchain information is unavailable, the party signing a transaction can generate a transaction with the desired properties.&lt;&#x2F;li&gt;
&lt;li&gt;The correlation between time and block number is not fixed; even though a 13s blocktime is &#x27;desired&#x27;, this varies due to both network hashrate and difficulty bomb progression.&lt;&#x2F;li&gt;
&lt;li&gt;The block number is even more unreliable as a timestamp for testnets and private networks.&lt;&#x2F;li&gt;
&lt;li&gt;unix time is more user-friendly, a user can more easily decide on reasonable end-date for a transaction, rather than a suitable number of valid blocks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No known issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Repricing of precompiles and Keccak256 function</title>
        <published>2020-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2666/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip2666-global-precompiles-repricing-and-many-more-discussion-thread/4332" />
        

        <id>https://wg-eips.ritovision.com/2666/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2666"
            label="EIP-2666" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2666/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP tries to set prices of certain precompiles and built-in EVM function to be in line with their performance, consumed resources and newer changes in EVM itself.&lt;&#x2F;p&gt;
&lt;p&gt;New price formulas are proposed for:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHA256 precompile (&lt;code&gt;0x02&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;RIPEMD precompile (&lt;code&gt;0x03&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;KECCAK256 opcode (&lt;code&gt;0x20&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Costs of many precompiles and built-in functions are invalid at the current state of the clients. This EIP contains a list of changes to the pricing formulas to better reflect underlying computations&#x27; structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Historical pricing for these functions in EVM does not reflect inner structure of the underlying computations (inner structure of the hash functions).&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP-2046 changes a &lt;code&gt;STATICCALL (0xfa)&lt;&#x2F;code&gt; cost to precompile and it may be necessary to adjust costs of some precompiles that &lt;em&gt;may&lt;&#x2F;em&gt; have taken old large cost (&lt;code&gt;700&lt;&#x2F;code&gt; gas) into account and tried to compensate for it&lt;&#x2F;li&gt;
&lt;li&gt;Some precompiles are overpriced and their pricing formulas do not reflect the structure of underlying functions&lt;&#x2F;li&gt;
&lt;li&gt;Keccak256 built-in function (opcode) in EVM has pricing that does not reflect underlying hash function structure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block_number &amp;gt;= X&lt;&#x2F;code&gt; set the gas cost of the following precompiles and Keccak256 opcode:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHA256 (precompile &lt;code&gt;0x02&lt;&#x2F;code&gt;): &lt;code&gt;10 + ((len(input) + 8)&#x2F;64 + 1) * 9&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;RIPEMD (precompile &lt;code&gt;0x03&lt;&#x2F;code&gt;): &lt;code&gt;6 + ((len(input) + 8)&#x2F;64 + 1) * 12&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;KECCAK256 (&lt;code&gt;0x20&lt;&#x2F;code&gt;): &lt;code&gt;13 + (len(input)&#x2F;136 + 1)*15&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP &lt;em&gt;ideally&lt;&#x2F;em&gt; requires that &lt;code&gt;MODEXP&lt;&#x2F;code&gt; repricing is &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;&quot;&gt;implemented&lt;&#x2F;a&gt; to also accurately reflect that there is no implicit compensation for an old &lt;code&gt;STATICCALL (0xfa)&lt;&#x2F;code&gt; cost (pre-2046).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Cost of functions being executed must accurately reflect real CPU time spent on computations, so benchmarking was performed for current precompiles and Keccak256 function to measure running time versus input parameters.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;detailed-summary-of-repricing-approach&quot;&gt;Detailed summary of repricing approach&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP relies on two facts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;apriori knowledge of the inner strucute of the hash functions&lt;&#x2F;li&gt;
&lt;li&gt;benchmarks provided by the client teams for some reasonable range of input lengths for random inputs (random byte strings of a given length)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;benchmarks-on-the-most-popular-clients&quot;&gt;Benchmarks on the most popular clients&lt;&#x2F;h3&gt;
&lt;p&gt;Necessary benchmarks for EIP-2666 were provided by the clients and raw form is assembled in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.google.com&#x2F;spreadsheets&#x2F;d&#x2F;1aCQnk7prrp3Mbcf011BE5zZnkbc3Iw7QAixn6mLbKS0&#x2F;edit?usp=sharing&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;SHA256 precompile&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently it&#x27;s &lt;code&gt;60&lt;&#x2F;code&gt; gas + &lt;code&gt;12&lt;&#x2F;code&gt; gas per &lt;code&gt;32&lt;&#x2F;code&gt; byte word (number of words is &lt;code&gt;ceil(len(input)&#x2F;word_len)&lt;&#x2F;code&gt; here and in similar places. If there is no &lt;code&gt;floor&lt;&#x2F;code&gt; or &lt;code&gt;ceil&lt;&#x2F;code&gt; specifier all divisions below are integer divisions (floor divisions)). Proposed formula is &lt;code&gt;A * ((len(input) + 8) &#x2F; 64 + 1) + B&lt;&#x2F;code&gt;, with coefficients below&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OE&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;9&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Besu&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nethermind&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIP-2666 proposes &lt;code&gt;A = 9&lt;&#x2F;code&gt;, &lt;code&gt;B = 10&lt;&#x2F;code&gt;. There are no large one-off costs in this precompile, so it&#x27;s EIP-2046 - safe.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;RIPEMD precompile&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently it&#x27;s &lt;code&gt;600&lt;&#x2F;code&gt; gas + &lt;code&gt;120&lt;&#x2F;code&gt; gas per &lt;code&gt;32&lt;&#x2F;code&gt; byte word. Proposed formula is &lt;code&gt;A * ((len(input) + 8) &#x2F; 64 + 1) + B&lt;&#x2F;code&gt;, with coefficients below&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OE&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Besu&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;29&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nethermind&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIP-2666 proposes &lt;code&gt;A = 12&lt;&#x2F;code&gt;, &lt;code&gt;B = 6&lt;&#x2F;code&gt;. There are no large one-off costs in this precompile, so it&#x27;s EIP-2046 - safe. Besu expects to have performance improvements by the end of the year.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Keccak256 performance&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Currently it&#x27;s &lt;code&gt;30&lt;&#x2F;code&gt; gas + &lt;code&gt;6&lt;&#x2F;code&gt; gas per &lt;code&gt;32&lt;&#x2F;code&gt; byte word. Proposed formula is &lt;code&gt;A * (len(input) &#x2F; 136 + 1) + B&lt;&#x2F;code&gt;, with coefficients below&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;td&gt;13&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;OE&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;15&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Besu&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;19&lt;&#x2F;td&gt;&lt;td&gt;28&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Nethermind&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;16&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;EIP-2666 proposes &lt;code&gt;A = 15&lt;&#x2F;code&gt;, &lt;code&gt;B = 13&lt;&#x2F;code&gt;. There are no large one-off costs in this precompile, so it&#x27;s EIP-2046 - safe. Besu expects to have performance improvements by the end of the year.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tooling-and-data&quot;&gt;Tooling and data&lt;&#x2F;h3&gt;
&lt;p&gt;Reference material (from benchmarks of different clients) with raw data can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.google.com&#x2F;spreadsheets&#x2F;d&#x2F;1aCQnk7prrp3Mbcf011BE5zZnkbc3Iw7QAixn6mLbKS0&#x2F;edit?usp=sharing&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There is a repository available with inputs for benchmarking and precompiles testing &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;shamatar&#x2F;bench_precompiles&quot;&gt;here&lt;&#x2F;a&gt; that can be used by client teams to perform all the necessary measurements.&lt;&#x2F;p&gt;
&lt;p&gt;Raw Besu &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;shemnon&#x2F;0ddba91be501fa23291bdec9107fe99a&quot;&gt;benchmarks&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-on-formulas-structure&quot;&gt;Note on formulas structure&lt;&#x2F;h3&gt;
&lt;p&gt;There are terms in formulas that look like &lt;code&gt;A * 1&lt;&#x2F;code&gt; and those are explicitly not combined to the &lt;code&gt;B&lt;&#x2F;code&gt; coefficient to reflect that hash of an empty byte array requires to perform a round of hashing anyway.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Precompile repricings has happened in a past and can be considered standard procedure. Gas costs of many contracts is expected to reduce that may break re-entrancy protection measures based on fixed gas costs. In any case, such protection should have never been considered good and final.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Let&#x27;s consider a simple example of Keccak256 hash of &lt;code&gt;0&lt;&#x2F;code&gt;, &lt;code&gt;64&lt;&#x2F;code&gt; and &lt;code&gt;160&lt;&#x2F;code&gt; bytes that can is a simple sanity check for implementation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Hash &lt;code&gt;0&lt;&#x2F;code&gt; bytes:
&lt;ul&gt;
&lt;li&gt;Old price: &lt;code&gt;30 + 6 * ceil(0 &#x2F; 32) = 30&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;New price: &lt;code&gt;15 * (0&#x2F;136 + 1) + 13 = 28&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Hash &lt;code&gt;64&lt;&#x2F;code&gt; bytes
&lt;ul&gt;
&lt;li&gt;Old price: &lt;code&gt;30 + 6 * ceil(64 &#x2F; 32) = 42&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;New price: &lt;code&gt;15 * (64&#x2F;136 + 1) + 13 = 28&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Hash &lt;code&gt;160&lt;&#x2F;code&gt; bytes
&lt;ul&gt;
&lt;li&gt;Old price: &lt;code&gt;30 + 6 * ceil(160 &#x2F; 32) = 60&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;New price: &lt;code&gt;15 * (160&#x2F;136 + 1) + 13 = 43&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is no reference implementation at the time of writing as it requires just a simple change of constants in major clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;As described in backward compatibility section in some cases reduction of cost may allow e.g. re-entrancy that was not expected before, but we think that re-entrancy protection based on fixed gas costs is anyway flawed design decision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit size of `initcode`</title>
        <published>2020-05-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2677/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2677-limit-size-of-initcode/4550" />
        

        <id>https://wg-eips.ritovision.com/2677/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:2677"
            label="EIP-2677" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2677/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Enforce a maximum size limit (&lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;) of &lt;code&gt;49152&lt;&#x2F;code&gt; (&lt;code&gt;0xc000&lt;&#x2F;code&gt;) for &lt;code&gt;initcode&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Enforce a maximum size limit (&lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;) for &lt;code&gt;initcode&lt;&#x2F;code&gt;. If the size of &lt;code&gt;initcode&lt;&#x2F;code&gt; exceeds &lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;, then contract creation fails with an out of gas error.&lt;&#x2F;p&gt;
&lt;p&gt;Since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; was implemented, there has been a size limit of &lt;code&gt;24576&lt;&#x2F;code&gt; (&lt;code&gt;0x6000&lt;&#x2F;code&gt;) on contract code. We propose to also limit the size of executable code to &lt;code&gt;2x&lt;&#x2F;code&gt; the above limit, i.e. &lt;code&gt;49152&lt;&#x2F;code&gt; (&lt;code&gt;0xc000&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;This also leads to two nice properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;instruction offset in code fits 16-bit value,&lt;&#x2F;li&gt;
&lt;li&gt;code size fits 16-bit value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;When a client executes &lt;code&gt;initcode&lt;&#x2F;code&gt;, the client has to perform a jumpdest analysis. In some cases, the client also performs a &lt;code&gt;hash&lt;&#x2F;code&gt; of the code:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;To use as a key in a mapping containing the result of a jumpdest analysis&lt;&#x2F;li&gt;
&lt;li&gt;To use for address calculation within &lt;code&gt;CREATE2&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The work performed during a jumpdest analysis scales linearly with the size of the code. Currently, a transaction can expand the memory once, and reuse the same memory segment (with minor modifications) to force the client to perform a lot of analysis&#x2F;hashing, leading to slow block processing.&lt;&#x2F;p&gt;
&lt;p&gt;Historically, this was exploited in June 2017, precipitating the 1.6.5-patch release of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;releases&#x2F;tag&#x2F;v1.6.5&quot;&gt;geth&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The work performed during address calculation within &lt;code&gt;CREATE2&lt;&#x2F;code&gt; is charged in proportion with size of the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;There are three situations where this is applicable:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;creation using a transaction with empty receiver.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In all these (and future) cases, the EVM should fail with Out Of Gas error if the code has a length more than &lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a &quot;network upgrade&quot;, since it modifies consensus-rules.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;For client implementations, this EIP makes attacks based on jumpdest-analysis or hashing of code less problematic, so should increase the robustness of clients.&lt;&#x2F;p&gt;
&lt;p&gt;For layer 2, this EIP introduces failure-modes where there previously were none. There &lt;em&gt;could&lt;&#x2F;em&gt; exist factory-contracts which deploy multi-level contract hierarchies, such that the code for multiple contracts are included in the initcode of the first contract. The author(s) of this EIP are not aware of any such contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases should include the following cases,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;tx create&lt;&#x2F;code&gt; with &lt;code&gt;initcode_size&lt;&#x2F;code&gt; at &lt;code&gt;max_initcode_size&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;CREATE2&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;tx create&lt;&#x2F;code&gt; with &lt;code&gt;initcode_size&lt;&#x2F;code&gt; at &lt;code&gt;max_initcode_size+1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Limit account nonce to 2^64-1</title>
        <published>2020-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2681/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2681-limit-account-nonce-to-2-64-1/4324" />
        

        <id>https://wg-eips.ritovision.com/2681/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2681"
            label="EIP-2681" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2681/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Limit account nonce to be between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Account nonces are currently specified to be arbitrarily long unsigned integers. Dealing with arbitrary length data in the state witnesses is not optimal, therefore this EIP will allow proofs to represent the nonce in a more optimized way.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally it could prove beneficial to transaction formats, where some improvements are potentially sought by at least three other proposals.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, this facilitates a minor optimisation in clients, because the nonce no longer needs to be kept as a 256-bit number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce two new restrictions retroactively from genesis:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Consider any transaction invalid, where the nonce exceeds or equals to &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; instructions&#x27; execution ends with the result &lt;code&gt;0&lt;&#x2F;code&gt; pushed on stack, where the account nonce is &lt;code&gt;2^64-1&lt;&#x2F;code&gt;. Gas for initcode execution is not deducted in this case.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;It is unlikely for any nonce to reach or exceed the proposed limit. If one would want to reach that limit via external transactions, it would cost at least &lt;code&gt;21000 * (2^64-1) = 387_381_625_547_900_583_915_000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;It must be noted that in the past, in the Morden testnet, each new account had a starting nonce of &lt;code&gt;2^20&lt;&#x2F;code&gt; in order to differentiate transactions from mainnet transactions.
This mode of replay protection is out of fashion since &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; introduced a more elegant way using chain identifiers.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Most clients already consider the nonce field to be 64-bit, such as go-ethereum.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The reason a transaction with nonce &lt;code&gt;2^64-1&lt;&#x2F;code&gt; is invalid, because otherwise after inclusion the sender account&#x27;s nonce would exceed &lt;code&gt;2^64-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;While this is a breaking change, no actual effect should be visible:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;There is no account in the state currently which would have a nonce exceeding that value. As of November 2020, the account &lt;code&gt;0xea674fdde714fd979de3edf0f56aa9716b898ec8&lt;&#x2F;code&gt; is responsible for the highest account nonce at approximately 29 million.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;go-ethereum already has this restriction partially in place (&lt;code&gt;state.Account.Nonce&lt;&#x2F;code&gt; and &lt;code&gt;types.txdata.AccountNonce&lt;&#x2F;code&gt; it as a 64-bit number).&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;None.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Trie format transition with overlay trees</title>
        <published>2020-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Guillaume Ballet</name><uri>https://github.com/gballet</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2584/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/overlay-method-for-hex-bin-tree-conversion/7104" />
        

        <id>https://wg-eips.ritovision.com/2584/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2584"
            label="EIP-2584" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2584/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a method to convert the state trie format from hexary to binary: new values are directly stored in a binary trie “laid over” the hexary trie. Meanwhile, the hexary trie is converted to a binary trie in the background. When the process is finished, both layers are merged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes a four phase process to complete the conversion.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In the first phase, all new state writes are made to an overlay binary trie, while the hexary trie is being converted to binary. The block format is changed to have two storage roots: the root of the hexary trie (hereafter called the &quot;base&quot; trie) and the root of the overlay binary trie.&lt;&#x2F;li&gt;
&lt;li&gt;After enough time has been given to miners to perform the conversion, the second phase begins. The overlay tree is progressively merged back into the newly converted binary base trie. A constant number of entries are deleted from the overlay and inserted into the base trie.&lt;&#x2F;li&gt;
&lt;li&gt;The third and final phase begins when the overlay trie is empty. The field holding its root is removed from the block header.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a long running interest in switching the state trie from a hexary format to a binary format, for reasons pertaining to proof and storage sizes. The conversion process poses a catch-up issue, caused by the sheer size of the full state: it can not be translated in a reasonable time (i.e. on the same order of magnitude as the block time).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;This specification follows the notation introduced by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;. Prior to reading it is advisable to be familiar with the Yellow Paper.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;binary-tries&quot;&gt;Binary tries&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP assumes that a binary trie is defined like the MPT, except that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The series of bytes in I₀ is seen as a series of &lt;em&gt;bits&lt;&#x2F;em&gt; and so ∀i≤256, I₀[i] is the ith bit in key I₀&lt;&#x2F;li&gt;
&lt;li&gt;The first item of an &lt;strong&gt;extension&lt;&#x2F;strong&gt; or a &lt;strong&gt;leaf&lt;&#x2F;strong&gt; is replacing nibbles with bits;&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;strong&gt;branch&lt;&#x2F;strong&gt; is a 2 item structure in which both items correspond to each of the two possible bit values for the keys at this point in their traversal;&lt;&#x2F;li&gt;
&lt;li&gt;c(𝕴,i) ≡ RLP((u(0), u(1)) at a branch, where u(j) = n({I : I ∈ 𝕴 ⋀ I₀[i] = j}, i+1)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Let ß be the function that, given a hexary trie, computes the equivalent representation of that trie in the aforementioned binary trie format.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phase-1&quot;&gt;Phase 1&lt;&#x2F;h3&gt;
&lt;p&gt;Let &lt;em&gt;h₁&lt;&#x2F;em&gt; be the previously agreed-upon block height at which phase 1 starts, and &lt;em&gt;h₂&lt;&#x2F;em&gt; the block at which phase 2 starts. For each block of height h₁ ≤ &lt;em&gt;h&lt;&#x2F;em&gt; &amp;lt; h₂:&lt;&#x2F;p&gt;
&lt;ol start=&quot;0&quot;&gt;
&lt;li&gt;A conversion process is started in the background, to turn the hexary trie into its binary equivalent. The end goal of this process is the calculation of the &lt;em&gt;root hash of the converted binary trie&lt;&#x2F;em&gt;, denoted Hᵣ². The root of the hexary trie is hereafter called Hᵣ¹⁶. Formally, this process is written as Hᵣ² ≡ ß(Hᵣ¹⁶).&lt;&#x2F;li&gt;
&lt;li&gt;Block headers contain a new Hₒ field, which is the &lt;em&gt;root of the overlay binary trie&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Hᵣ ≡ P(H)ᵣ¹⁶, i.e. as long as the conversion from hexary to binary is not complete, the hexary trie root is the same as that of its parent block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The following is changed in the execution environment:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Upon executing a &lt;em&gt;state read&lt;&#x2F;em&gt;, ϒ first searches for the address in the overlay trie. If the key can not be found there, ϒ then searches the base trie as it did at block heights h&#x27; &amp;lt; h₁;&lt;&#x2F;li&gt;
&lt;li&gt;Upon executing a &lt;em&gt;state write&lt;&#x2F;em&gt;, ϒ inserts or updates the value into the overlay tree. The base tree is left untouched;&lt;&#x2F;li&gt;
&lt;li&gt;If an account is deleted, ϒ inserts the empty hash H(∅) at the address of that account in order to mark its deletion; reads from such an address behave the same as a missing account, regardless of what is present in the base trie.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Phase 1 ends at block height h₂, which is set far enough from h₁ to offer miners enough time to perform the conversion.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phase-2&quot;&gt;Phase 2&lt;&#x2F;h3&gt;
&lt;p&gt;This phase differs from the previous one on the following points:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;At block height h₂, before the execution of ϒ, Hᵣ ≡ Hᵣ², i.e. the value before the execution of the transition function is set to the root of the converted &lt;em&gt;binary base trie&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;Hₒ is still present in the block tree, however the overlay trie content can only be &lt;em&gt;read from or deleted&lt;&#x2F;em&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;At block height h ≥ h₂, before the execution of ϒ, N accounts are being deleted from the binary overlay trie and inserted into the binary base trie;&lt;&#x2F;li&gt;
&lt;li&gt;Upon executing a &lt;em&gt;state write&lt;&#x2F;em&gt;, ϒ will insert or update the value into the &lt;em&gt;base&lt;&#x2F;em&gt; trie. If the search key exists in the overlay trie, it is deleted.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Account deletion is performed according to the following rules:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The first N accounts (in lexicographic order) remaining in the overlay tree are selected; For each of these accounts:&lt;&#x2F;li&gt;
&lt;li&gt;If the value is the empty hash, remove the account at the same address from the binary base trie;&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, insert&#x2F;update the account at the corresponding address in the base trie with its overlay trie value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;When the overlay trie is empty, phase 2 ends and phase 3 begins.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;phase-3&quot;&gt;Phase 3&lt;&#x2F;h3&gt;
&lt;p&gt;Phase 3 is the same as phase 2, except for the following change:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Hₒ is dropped from the block header&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Methods that have been discussed until now include a &quot;stop the world&quot; approach, in which the chain is stopped for the significant amount of time that is required by the conversion, and a &quot;copy on write&quot; approach, in which branches are converted upon being accessed.
The approach suggested here has the advantage that the chain continues to operate normally during the conversion process, and that the tree is fully converted to a binary format, in a predictable time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This requires a fork and will break backwards compatibility, as the hashes and block formats will necessarily be different. This will cause a fork in clients that don&#x27;t implement the overlay tree, and those that do not accept the new binary root. No mitigation is proposed, as this is a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;For testing phase 1, it suffices to check that every key in the hexary trie is also available in the binary trie. A looser but faster test picks 1% of keys in the hexary trie at random, and checks that they are present in the binary trie;&lt;&#x2F;li&gt;
&lt;li&gt;TBD for phase 2 &amp;amp; 3&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A prototype version of the conversion process (phase 1) is available for &lt;code&gt;geth&lt;&#x2F;code&gt; in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;go-ethereum&#x2F;pull&#x2F;12&quot;&gt;this PR&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;There are three attack vectors that I can foresee:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A targeted attack that would cause the overlay trie to be unreasonably large. Since gas costs will likely increase during the transition process, lengthening phase 2 will make Ethereum more expensive during an extended period of time. This could be solved by increasing the cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; during phase 1.&lt;&#x2F;li&gt;
&lt;li&gt;Conversely, if h₂ comes too soon, a majority of miners might not be able to produce the correct value for Hᵣ² in time.&lt;&#x2F;li&gt;
&lt;li&gt;If a group of miners representing more than 51% of the network are reporting an invalid value, they could be stealing funds without anyone having a say.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;community-feedback&quot;&gt;Community feedback&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Preliminary tests indicate that a fast machine can perform the conversion in roughly 30 minutes.&lt;&#x2F;li&gt;
&lt;li&gt;The initial version of this EIP expected miners to vote on the value of the binary base root. This has been removed because of the complexity of this process, and because this functionality is already guaranteed by the &quot;longest chain&quot; rule.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ModExp Gas Cost</title>
        <published>2020-03-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Kelly Olson</name><uri>https://github.com/ineffectualproperty</uri>
	</author>
	
	<author>
		<name>Sean Gulley</name><uri>https://github.com/sean-sn</uri>
	</author>
	
	<author>
		<name>Simon Peffers</name><uri>https://github.com/simonatsn</uri>
	</author>
	
	<author>
		<name>Justin Drake</name><uri>https://github.com/justindrake</uri>
	</author>
	
	<author>
		<name>Dankrad Feist</name><uri>https://github.com/dankrad</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2565/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/big-integer-modular-exponentiation-eip-198-gas-cost/4150" />
        

        <id>https://wg-eips.ritovision.com/2565/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2565"
            label="EIP-2565" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2565/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Defines the gas cost of the &lt;code&gt;ModExp&lt;&#x2F;code&gt; (&lt;code&gt;0x00..05&lt;&#x2F;code&gt;) precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;To accurately reflect the real world operational cost of the &lt;code&gt;ModExp&lt;&#x2F;code&gt; precompile, this EIP specifies an algorithm for calculating the gas cost. This algorithm approximates the multiplication complexity cost and multiplies that by an approximation of the iterations required to execute the exponentiation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Modular exponentiation is a foundational arithmetic operation for many cryptographic functions including signatures, VDFs, SNARKs, accumulators, and more. Unfortunately, the ModExp precompile is currently over-priced, making these operations inefficient and expensive. By reducing the cost of this precompile, these cryptographic functions become more practical, enabling improved security, stronger randomness (VDFs), and more.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, the gas cost of calling the precompile at address &lt;code&gt;0x0000000000000000000000000000000000000005&lt;&#x2F;code&gt; will be calculated as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_multiplication_complexity(base_length, modulus_length):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    max_length = max(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    words = math.ceil(max_length &#x2F; 8)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return words**2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_iteration_count(exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if exponent_length &amp;lt;= 32 and exponent == 0: iteration_count = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;lt;= 32: iteration_count = exponent.bit_length() - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif exponent_length &amp;gt; 32: iteration_count = (8 * (exponent_length - 32)) + ((exponent &amp;amp; (2**256 - 1)).bit_length() - 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(iteration_count, 1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def calculate_gas_cost(base_length, modulus_length, exponent_length, exponent):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    multiplication_complexity = calculate_multiplication_complexity(base_length, modulus_length)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    iteration_count = calculate_iteration_count(exponent_length, exponent)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return max(200, math.floor(multiplication_complexity * iteration_count &#x2F; 3))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;After benchmarking the ModExp precompile, we discovered that it is ‘overpriced’ relative to other precompiles. We also discovered that the current gas pricing formula could be improved to better estimate the computational complexity of various ModExp input variables. The following changes improve the accuracy of the &lt;code&gt;ModExp&lt;&#x2F;code&gt; pricing:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-modify-computational-complexity-formula-to-better-reflect-the-computational-complexity&quot;&gt;1. Modify ‘computational complexity’ formula to better reflect the computational complexity&lt;&#x2F;h3&gt;
&lt;p&gt;The complexity function defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; is as follow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def mult_complexity(x):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if x &amp;lt;= 64: return x ** 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif x &amp;lt;= 1024: return x ** 2 &#x2F;&#x2F; 4 + 96 * x - 3072&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else: return x ** 2 &#x2F;&#x2F; 16 + 480 * x - 199680&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where is &lt;code&gt;x&lt;&#x2F;code&gt; is &lt;code&gt;max(length_of_MODULUS, length_of_BASE)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The complexity formula in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; was meant to approximate the difficulty of Karatsuba multiplication. However, we found a better approximation for modelling modular exponentiation. In the complexity formula defined in this EIP, &lt;code&gt;x&lt;&#x2F;code&gt; is divided by 8 to account for the number of limbs in multiprecision arithmetic. A comparison of the current ‘complexity’ function and the proposed function against the execution time can be seen below:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;.&#x2F;assets&#x2F;Complexity_Regression.png&quot; alt=&quot;Option 1 Graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The complexity function defined here has a better fit vs. the execution time when compared to the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; complexity function. This better fit is because this complexity formula accounts for the use of binary exponentiation algorithms that are used by ‘bigint’ libraries for large exponents. You may also notice the regression line of the proposed complexity function bisects the test vector data points. This is because the run time varies depending on if the modulus is even or odd.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-change-the-value-of-gquaddivisor&quot;&gt;2. Change the value of GQUADDIVISOR&lt;&#x2F;h3&gt;
&lt;p&gt;After changing the &#x27;computational complexity&#x27; formula in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt; to the one defined here it is necessary to change &lt;code&gt;QGUADDIVSOR&lt;&#x2F;code&gt; to bring the gas costs inline with their runtime. By setting the &lt;code&gt;QGUADDIVISOR&lt;&#x2F;code&gt; to &lt;code&gt;3&lt;&#x2F;code&gt; the cost of the ModExp precompile will have a higher cost (gas&#x2F;second) than other precompiles such as ECRecover.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2565&#x2F;.&#x2F;assets&#x2F;GQuad_Change.png&quot; alt=&quot;Option 2 Graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;3-set-a-minimum-gas-cost-to-prevent-abuse&quot;&gt;3. Set a minimum gas cost to prevent abuse&lt;&#x2F;h3&gt;
&lt;p&gt;This prevents the precompile from underpricing small input values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;There are no changes to the underlying interface or arithmetic algorithms, so the existing test vectors can be reused. Below is a table with the updated test vectors:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Test Case&lt;&#x2F;th&gt;&lt;th&gt;EIP-198 Pricing&lt;&#x2F;th&gt;&lt;th&gt;EIP-2565 Pricing&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_square&lt;&#x2F;td&gt;&lt;td&gt;204&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_qube&lt;&#x2F;td&gt;&lt;td&gt;204&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_1_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;3276&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_square&lt;&#x2F;td&gt;&lt;td&gt;665&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_qube&lt;&#x2F;td&gt;&lt;td&gt;665&lt;&#x2F;td&gt;&lt;td&gt;200&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_2_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;10649&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_square&lt;&#x2F;td&gt;&lt;td&gt;1894&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_qube&lt;&#x2F;td&gt;&lt;td&gt;1894&lt;&#x2F;td&gt;&lt;td&gt;341&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_3_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;30310&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_square&lt;&#x2F;td&gt;&lt;td&gt;5580&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_qube&lt;&#x2F;td&gt;&lt;td&gt;5580&lt;&#x2F;td&gt;&lt;td&gt;1365&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_4_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;89292&lt;&#x2F;td&gt;&lt;td&gt;21845&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_square&lt;&#x2F;td&gt;&lt;td&gt;17868&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_qube&lt;&#x2F;td&gt;&lt;td&gt;17868&lt;&#x2F;td&gt;&lt;td&gt;5461&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;modexp_nagydani_5_pow0x10001&lt;&#x2F;td&gt;&lt;td&gt;285900&lt;&#x2F;td&gt;&lt;td&gt;87381&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;21607&quot;&gt;Geth&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;ineffectualproperty&#x2F;60e34f15c31850c5b60c8cf3a28cd423&quot;&gt;Python&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The biggest security consideration for this EIP is creating a potential DoS vector by making ModExp operations too inexpensive relative to their computation time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;198&#x2F;&quot;&gt;EIP-198&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Escalator fee market change for ETH 1.0 chain</title>
        <published>2020-03-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Dan Finlay</name><email>dan@danfinlay.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2593/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/another-simple-gas-fee-model-the-escalator-algorithm-from-the-agoric-papers/6399" />
        

        <id>https://wg-eips.ritovision.com/2593/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2593"
            label="EIP-2593" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2593/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The current &quot;first price auction&quot; fee model in Ethereum is inefficient and needlessly costly to users. This EIP proposes a way to replace this with a mechanism that allows dynamically priced transaction fees and efficient transaction price discovery.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Based on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;agoric.com&#x2F;papers&#x2F;incentive-engineering-for-computational-resource-management&#x2F;full-text&#x2F;&quot;&gt;The Agoric Papers&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Each transaction would have the option of providing parameters that specify an &quot;escalating&quot; bid, creating a time-based auction for validators to include that transaction.&lt;&#x2F;p&gt;
&lt;p&gt;This creates highly efficient price discovery, where the price will always immediately fall to the highest bid price, which is not necessarily that user&#x27;s highest price they would pay.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;uploads&#x2F;default&#x2F;original&#x2F;2X&#x2F;0&#x2F;042795efa4c2680d644bc66386cd2984a70293f8.gif&quot; alt=&quot;escalator algorithm price chart&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently prices transaction fees using a simple first-price auction, which leads to well documented inefficiencies (some of which are documented in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;blob&#x2F;master&#x2F;EIPS&#x2F;.&#x2F;01559.md&quot;&gt;EIP-1559&lt;&#x2F;a&gt;) when users are trying to estimate what price will get a transaction included in a block, especially during times of price volatility and full blocks.&lt;&#x2F;p&gt;
&lt;p&gt;EIP 1559 is currently being championed as an improvement for the Ethereum protocol, and while I agree that the gas market is very inefficient, since a change like this will affect all client and wallet implementations, the Ethereum community should make sure to make a selection based on solid reasoning and justifications, which I believe 1559 is currently lacking.&lt;&#x2F;p&gt;
&lt;p&gt;To facilitate a more productive and concrete discussion about the gas fee market, I felt it was important to present an alternative that is clearly superior to the status quo, so that any claimed properties of EIP-1559 can be compared to a plausible alternative improvement.&lt;&#x2F;p&gt;
&lt;p&gt;I suggest the three gas payment algorithms be compared under all combinations of these conditions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Blocks that are regularly half full, Blocks that are regularly less than half full, and blocks that repeatedly full in a surprising (&quot;black swan&quot;) series.&lt;&#x2F;li&gt;
&lt;li&gt;Users that are willing to wait for a price that may be below the market rate, vs users who value inclusion urgently and are willing to pay above market rate.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We should then ask:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Is the user willing to pay the most in a given scenario also likely to have their transaction processed in a time period they find acceptable?&lt;&#x2F;li&gt;
&lt;li&gt;Are users who want a good price likely to get included in a reasonable period of time? (Ideally within one block)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I believe that under this analysis we will find that the escalator algorithm outperforms EIP-1559 in both normal and volatile conditions, for both high-stakes transactions and more casual users looking for a good price.&lt;&#x2F;p&gt;
&lt;p&gt;While I think a deeper simulation&#x2F;analysis should be completed, I will share my expected results under these conditions.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, by introducing tx fee payment related to the current time, we create an incentive for miners to more honestly report the current time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;user-strategies-under-various-conditions-and-algorithms&quot;&gt;User Strategies Under Various Conditions and Algorithms&lt;&#x2F;h3&gt;
&lt;p&gt;First I will suggest a likely optimal strategy for different players under the conditions of the different algorithms being considered.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Gas Strategy&lt;&#x2F;th&gt;&lt;th&gt;Current Single-Price&lt;&#x2F;th&gt;&lt;th&gt;EIP 1559&lt;&#x2F;th&gt;&lt;th&gt;Escalator&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User bids within the range of prices that have been recently accepted, likely over-pays slightly.&lt;&#x2F;td&gt;&lt;td&gt;User bids one price tier over the current rate, and is likely included.&lt;&#x2F;td&gt;&lt;td&gt;User bids a range from the low end of recently included to the high end, and is likely included at the lowest rate possible.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below or near the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids under or at the current price tier, and may wait for the price to fall. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids as low as they&#x27;d like, but set an upper bound on how long they&#x27;re willing to wait before increasing price.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User bids over the price of all recently accepted transactions, almost definitely over-paying significantly.&lt;&#x2F;td&gt;&lt;td&gt;User bids over the current price tier, and needs to increase their &lt;code&gt;tip&lt;&#x2F;code&gt; parameter to be competitive on the next block, recreating the single-price auction price problem.&lt;&#x2F;td&gt;&lt;td&gt;User bids over a price that has been accepted consistently, with an escalating price in case that price is not high enough.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids under or at the current price tier, and may wait for the price to fall. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids as low as they&#x27;d like, but set an upper bound on how long they&#x27;re willing to wait before increasing price.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User bids within or over the range of prices that have been recently accepted, likely over-pays slightly, and is likely included in the next block.&lt;&#x2F;td&gt;&lt;td&gt;User bids at or over the current price tier, and is likely included in the next block.&lt;&#x2F;td&gt;&lt;td&gt;User submits bid starting within recently accepted prices, is likely accepted in the next block.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids at or under the current price tier, and is likely included in the next block. If bidding under and waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User bids as low as they&#x27;d like, but set an upper bound on how long they&#x27;re willing to wait before increasing price, is likely included in the next few blocks at the lowest possible price.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;user-results-under-various-conditions-and-algorithms&quot;&gt;User Results Under Various Conditions and Algorithms&lt;&#x2F;h3&gt;
&lt;p&gt;Now I will consider the ultimate results of the strategies listed above. Are users happy under these conditions? Did we save users money? Were users who wanted urgent inclusion able to secure it?&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Gas Strategy&lt;&#x2F;th&gt;&lt;th&gt;Current Single-Price&lt;&#x2F;th&gt;&lt;th&gt;EIP 1559&lt;&#x2F;th&gt;&lt;th&gt;Escalator&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly half full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User can wait for a better price, but may need to resubmit re-signed transactions.&lt;&#x2F;td&gt;&lt;td&gt;User can wait for a better price, but may need to resubmit re-signed transactions.&lt;&#x2F;td&gt;&lt;td&gt;User can discover the lowest price within their time preference with a single signature.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User over-pays, but reliably gets transaction included.&lt;&#x2F;td&gt;&lt;td&gt;Due to &lt;code&gt;tip&lt;&#x2F;code&gt; parameter &quot;breaking tie&quot; within a block, user over-pays for reliable inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User is able to balance the amount of overpayment they risk with the urgency they require.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their price, and waits for it, or manually re-submits.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their price, and waits for it, or manually re-submits.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their lowest price, but also their highest price and maximum wait time, so no resubmission is needed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user wants urgent inclusion.&lt;&#x2F;td&gt;&lt;td&gt;User over-pays, but reliably gets transaction included.&lt;&#x2F;td&gt;&lt;td&gt;User bids at or over current price tier, gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;td&gt;User pays an expected amount, and gets transaction mined reliably.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Blocks regularly under-full, user willing to wait for a good price.&lt;&#x2F;td&gt;&lt;td&gt;User bids below the low end of the recently accepted prices, may need to wait for a while. If waiting too long, user may need to re-submit with a higher price.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their price, and waits for it, or manually re-submits.&lt;&#x2F;td&gt;&lt;td&gt;User chooses their lowest price, but also their highest price and maximum wait time, so no resubmission is needed.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;In all cases, the escalator algorithm as I have described is able to perform optimally.&lt;&#x2F;p&gt;
&lt;p&gt;The current gas auction model works well under half-full and less conditions, but for users with urgent needs, has the downside of overpayment. For users seeking a low price, the current model has the downside of requiring re-submission, but has the benefit of always giving users a path towards reliable block inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-1559 also performs well under normal conditions, but under conditions where blocks are regularly full, the price discovery mechanism breaks, and miners will fall back to the &lt;code&gt;TIP&lt;&#x2F;code&gt; parameter to choose the transactions to include, meaning that under network congestion, EIP-1559 forces users to &lt;em&gt;either&lt;&#x2F;em&gt; choose efficient prices or certainty of next-block inclusion.&lt;&#x2F;p&gt;
&lt;p&gt;EIP-1559 also has all the re-submission issues of the current model in situations where a user would like to pay under the current market rate, but has certain time constraints limiting their patience. The Escalator algorithm is the only strategy listed here that allows users to discover the lowest possible price given the network conditions and their time constraints.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Client-Wide Parameters&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;INITIAL_FORK_BLKNUM&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Transaction Parameters&lt;&#x2F;strong&gt;
The transaction &lt;code&gt;gasPrice&lt;&#x2F;code&gt; parameter is now optional, and if excluded can be replaced by these parameters instead:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;START_PRICE&lt;&#x2F;code&gt;: The lowest price that the user would like to pay for the transaction.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;START_TIME&lt;&#x2F;code&gt;: The first time that this transaction is valid at.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_PRICE&lt;&#x2F;code&gt;: The maximum price the sender would be willing to pay to have this transaction processed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MAX_TIME&lt;&#x2F;code&gt;: The time at which point the user&#x27;s &lt;code&gt;MAX_PRICE&lt;&#x2F;code&gt; is achieved. The transaction remains valid after this time at that price.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Proposal&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For all blocks where &lt;code&gt;block.number &amp;gt;= INITIAL_FORK_BLKNUM&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;When processing a transaction with the new pricing parameters, miners now receive a fee based off of the following linear function, where &lt;code&gt;BLOCK&lt;&#x2F;code&gt; is the current block number:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;IF &lt;code&gt;BLOCK &amp;gt; MAX_TIME&lt;&#x2F;code&gt; then &lt;code&gt;TX_FEE = MAX_PRICE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TX_FEE = START_PRICE + ((MAX_PRICE - START_PRICE) &#x2F; (MAX_TIME - START_TIME) * (BLOCK - START_TIME))&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As a JavaScript function:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; txFee&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;startTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; startPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxTime&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; maxPrice&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; currentTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;currentTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; priceRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startPrice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; blockRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; maxTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;  const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; slope&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; priceRange&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; blockRange&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startPrice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;slope&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;currentTime&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; startTime&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Since a current &lt;code&gt;gasPrice&lt;&#x2F;code&gt; transaction is effectively a flat-escalated transaction bid, it is entirely compatible with this model, and so there is no concrete requirement to deprecate current transaction processing logic, allowing cold wallets and hardware wallets to continue working for the foreseeable future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The security considerations for this EIP are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;None currently known.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Account gas storage opcodes</title>
        <published>2020-03-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3322/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3322-efficient-gas-storage/5470" />
        

        <id>https://wg-eips.ritovision.com/3322/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:3322"
            label="EIP-3322" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3322/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Allows contract accounts to store gas that can be transferred to the refund counter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Contracts can persist gas for later transfer to the refund counter.
Three opcodes are introduced to read, add to, and use this gas counter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The refund mechanism is currently being used by gas tokens to arbitrage gas price.
This brings gas supply elasticity and price stability by moving gas from blocks with less demand to blocks with more demand.
Unfortunately this rewards unnecessary state growth.
By introducing a superior gas storage mechanism, the gas market will require less storage and computation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Contract accounts gain an unsigned gas refund counter, initially zero.&lt;&#x2F;p&gt;
&lt;p&gt;Three new opcodes are introduced to manage this state.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFGAS&lt;&#x2F;code&gt; (&lt;code&gt;0x49&lt;&#x2F;code&gt;): Pushes the current account&#x27;s gas refund counter onto the stack.
Shares gas pricing with &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;USEGAS&lt;&#x2F;code&gt; (&lt;code&gt;0x4a&lt;&#x2F;code&gt;): Pops &lt;code&gt;amount&lt;&#x2F;code&gt; from the stack.
The minimum of &lt;code&gt;amount&lt;&#x2F;code&gt; and the current account&#x27;s gas refund counter is transferred to the execution context&#x27;s refund counter.
Costs &lt;code&gt;5000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STOREGAS&lt;&#x2F;code&gt; (&lt;code&gt;0x4b&lt;&#x2F;code&gt;): Pops &lt;code&gt;amount&lt;&#x2F;code&gt; from the stack.
Costs &lt;code&gt;5000 + amount&lt;&#x2F;code&gt; gas.
Increases the current account&#x27;s gas refund counter by &lt;code&gt;amount&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;By reusing the execution context&#x27;s refund counter we can reuse its 50% DoS protection, which limits its block elasticity contribution to 2x.&lt;&#x2F;p&gt;
&lt;p&gt;The gas costs are based on similar opcodes &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Most accounts will store no gas, so the per-account storage overhead should be minimal or even zero in the normal case.&lt;&#x2F;p&gt;
&lt;p&gt;The opcode numbers chosen are in the same &lt;code&gt;0x4X&lt;&#x2F;code&gt; range as &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; and &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Because the gas is added to the refund counter, no compatibility issues are anticipated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;Final&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0x60004900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034900&lt;&#x2F;td&gt;&lt;td&gt;5003&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034960034900&lt;&#x2F;td&gt;&lt;td&gt;10006&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x60034960034900&lt;&#x2F;td&gt;&lt;td&gt;10006&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x484900&lt;&#x2F;td&gt;&lt;td&gt;5010&lt;&#x2F;td&gt;&lt;td&gt;100000&lt;&#x2F;td&gt;&lt;td&gt;100000&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0x61ffff4a00&lt;&#x2F;td&gt;&lt;td&gt;70538&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;65535&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;DoS is already limited by the 50% refund limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New opcodes TXGASLIMIT and CALLGASLIMIT</title>
        <published>2020-02-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><email>forshtat1@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2542/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2542-add-txgaslimit-callgaslimit-txgasrefund-opcodes" />
        

        <id>https://wg-eips.ritovision.com/2542/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2542"
            label="EIP-2542" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2542/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism to allow smart contracts to access information on gas limits for the current transaction and execution frame.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is an existing opcode &lt;code&gt;0x45 GASLIMIT&lt;&#x2F;code&gt; that provides access to the block gas limit. While this information may be useful in some cases, it is probably not a value that smart contract developers may be concerned about. The opcode &lt;code&gt;0x5a GAS&lt;&#x2F;code&gt; provides the remaining gas, not the initial one. Also, it is worth noting how existing &lt;code&gt;0x32 ORIGIN&lt;&#x2F;code&gt;, &lt;code&gt;0x33 CALLER&lt;&#x2F;code&gt;, &lt;code&gt;0x34 CALLVALUE&lt;&#x2F;code&gt; and &lt;code&gt;0x3a GASPRICE&lt;&#x2F;code&gt; opcodes set a pattern of having access to both the transaction and current execution frame state.
TBD: as 0x30 opcode range is exhausted, the proposed opcodes can be added to 0x50 range, or a new range can be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As concepts of relaying, meta-transactions, gas fees, and account abstraction gain popularity, it becomes critical for some contracts to be able to track gas expenditure with absolute precision. Without access to this data on an EVM level, such contracts resort to approximation, mimicking EVM logic on-chain, and some use-cases even become infeasible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If block.number &amp;gt;= TBD, add three new opcodes:&lt;&#x2F;p&gt;
&lt;p&gt;TXGASLIMIT: 0x5c&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the gas limit of the entire transaction onto the stack. This is a value of the &#x27;startgas&#x27; parameter signed by the externally owned account.&lt;br &#x2F;&gt;
Gas costs: 2 (same as &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;CALLGASLIMIT: 0x5d&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the gas limit of the current execution frame onto the stack. This is the &#x27;callGas&#x27; value that was obtained after the application of the EIP-150 “all but one 64th” rule.&lt;br &#x2F;&gt;
Gas costs: 2 (same as &lt;code&gt;GASLIMIT&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;Also, consider renaming &lt;code&gt;0x45 GASLIMIT&lt;&#x2F;code&gt; to &lt;code&gt;BLOCKGASLIMIT&lt;&#x2F;code&gt; to avoid confusion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Consider a solidity smart contract that wants to know how much gas the entire transaction or a part of it had consumed. It is not entirely possible with the current EVM. With proposed changes, using a pseudo-Solidity syntax, this information would be easily available:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function keepTrackOfGas(string memory message, uint256 number) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    uint gasUsed = msg.gasLimit - gasleft();&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is an extremely common use case, and multiple implementations suffer from not taking the non-accessible expenses into consideration. The state-of-the-art solution for the &lt;code&gt;gasUsed&lt;&#x2F;code&gt; problem is to access &#x27;gasleft()&#x27; as the first line of your smart contract.&lt;br &#x2F;&gt;
Note how variable transaction input size means the gas used by the transaction depends on the number of zero and non-zero bytes of input, as well &lt;code&gt;GTXDATANONZERO&lt;&#x2F;code&gt;. Another issue is that Solidity handles &lt;code&gt;public&lt;&#x2F;code&gt; methods by loading the entire input from &lt;code&gt;calldata&lt;&#x2F;code&gt; to &lt;code&gt;memory&lt;&#x2F;code&gt;, spending an unpredictable amount of gas.&lt;&#x2F;p&gt;
&lt;p&gt;Another application is for a method to have a requirement for a gas limit given to it. This situation arises quite commonly in the context of meta-transactions, where the msg.sender&#x27;s account holder may not be too interested in the inner transaction&#x27;s success. Exaggerated pseudocode:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;function verifyGasLimit(uint256 desiredGasLimit, bytes memory signature, address signer, bytes memory someOtherData) public {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(ecrecover(abi.encodePacked(desiredGasLimit, someOtherData), signature) == signer, &amp;quot;Signature does not match&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    require(tx.gasLimit == desiredGasLimit, &amp;quot;Transaction limit does not match the signed value. The signer did not authorize that.&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In this situation it is not possible to rely on &#x27;gasleft()&#x27; value, because it is dynamic, depends on opcode and calldata pricing, and cannot be signed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces two new opcodes and renames an existing one, but stays fully backwards compatible apart from that.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;forwards-compatibility&quot;&gt;Forwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;A major consideration for this proposal is its alignment with one or many possible future modifications to the EVM:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;EIP-2489 Deprecate the GAS opcode (a.k.a. 39-UNGAS proposal)&lt;br &#x2F;&gt;
There is a sentiment that the ability of smart contracts to perform &quot;gas introspection&quot; leads to the contracts being dependent on current opcode pricing.&lt;br &#x2F;&gt;
While criticizing said misconception is beyond the scope of this EIP, in case there is a need to make a breaking change to the behavior of the existing &lt;code&gt;0x5a GAS&lt;&#x2F;code&gt; opcode, the same considerations will apply to the proposed opcodes. This means this EIP does not add any new restraints on EMV evolution.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Stateless Ethereum&lt;br &#x2F;&gt;
The UNGAS proposal is said to be related to the ongoing project of Stateless Ethereum. It’s not strictly necessary for stateless Ethereum, but it is an idea for how to make future breaking changes to gas schedules easier.&lt;br &#x2F;&gt;
As long as the concept of &#x27;gas limit&#x27; is part of the EVM, the author sees no reason proposed opcodes would conflict with Stateless Ethereum. Gas schedules are not exposed by this proposal.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Comparison with other controversial opcodes&lt;br &#x2F;&gt;
There are opcodes that are not proposed for deprecation but face criticism. Examples include &lt;code&gt;0x32 ORIGIN&lt;&#x2F;code&gt; being misused by smart contract developers, or &lt;code&gt;0x46 CHAINID&lt;&#x2F;code&gt; making some smart-contracts &#x27;unforkable&#x27;.&lt;br &#x2F;&gt;
This EIP neither encourages nor enables any bad security practices, and does not introduce any concepts that are new for EVM either.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Existing smart contracts are not affected by this change.&lt;br &#x2F;&gt;
Smart contracts that will use proposed opcodes must not use them for the core of any security features, but only as a source of information about their execution environment.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementations must be completed before any EIP is given status &quot;Final&quot;, but it need not be completed before the EIP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of &quot;rough consensus and running code&quot; is still useful when it comes to resolving many discussions of API details.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BLS12-377 curve operations</title>
        <published>2020-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	<author>
		<name>hujw77</name><uri>https://github.com/hujw77</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2539/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2539-bls12-377-precompile-discussion-thread/4659" />
        

        <id>https://wg-eips.ritovision.com/2539/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2539"
            label="EIP-2539" />
        

        
        

        
        <summary type="html">Precompiles for BLS12-377 curve operations</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2539/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This precompile adds operation on BLS12-377 curve (from Zexe paper) as a precompile in a set necessary to &lt;em&gt;efficiently&lt;&#x2F;em&gt; perform operations such as BLS signature verification and perform SNARKs verifications. Unique properties of BLS12-377 also later allow to have SNARKs that check BLS12-377 pairing in an efficient way and allow e.g. constant-size BLS signature aggregation.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= X&lt;&#x2F;code&gt; we introduce &lt;em&gt;nine&lt;&#x2F;em&gt; separate precompiles to perform the following operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BLS12_377_G1ADD - to perform point addition on a curve defined over prime field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G1MUL - to perform point multiplication on a curve defined over prime field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G1MULTIEXP - to perform multiexponentiation on a curve defined over prime field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G2ADD - to perform point addition on a curve twist defined over quadratic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G2MUL - to perform point multiplication on a curve twist defined over quadratic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_G2MULTIEXP - to perform multiexponentiation on a curve twist defined over quadratic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_PAIRING - to perform a pairing operations between a set of &lt;em&gt;pairs&lt;&#x2F;em&gt; of (G1, G2) points&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_MAP_FP_TO_G1 - maps base field element into the G1 point&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_377_MAP_FP2_TO_G2 - maps extension field element into the G2 point&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Multiexponentiation operation is included to efficiently aggregate public keys or individual signer&#x27;s signatures during BLS signature verification.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;proposed-addresses-table&quot;&gt;Proposed addresses table&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Precompile&lt;&#x2F;th&gt;&lt;th&gt;Address&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G1ADD&lt;&#x2F;td&gt;&lt;td&gt;0x15&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G1MUL&lt;&#x2F;td&gt;&lt;td&gt;0x16&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G1MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x17&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G2ADD&lt;&#x2F;td&gt;&lt;td&gt;0x18&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G2MUL&lt;&#x2F;td&gt;&lt;td&gt;0x19&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_G2MULTIEXP&lt;&#x2F;td&gt;&lt;td&gt;0x1a&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_PAIRING&lt;&#x2F;td&gt;&lt;td&gt;0x1b&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_MAP_FP_TO_G1&lt;&#x2F;td&gt;&lt;td&gt;0x1c&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_377_MAP_FP2_TO_G2&lt;&#x2F;td&gt;&lt;td&gt;0x1d&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Motivation of this precompile is to add a cryptographic primitive that allows to get 120+ bits of security for operations over pairing friendly curve compared to the existing BN254 precompile that only provides 80 bits of security. In addition it allows efficient one-time recursive proof aggregations, e.g. proofs about existence of BLS12-377 based signature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Curve parameters:&lt;&#x2F;p&gt;
&lt;p&gt;BLS12-377 curve is fully defined by the following set of parameters (coefficient &lt;code&gt;A=0&lt;&#x2F;code&gt; for all BLS12 curves):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = 0x01ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Main subgroup order = 0x12ab655e9a2ca55660b44d1e5c37b00159aa76fed00000010a11800000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Extension tower:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp quadratic non-residue = 0x01ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508bffffffffffc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp6&#x2F;Fp12 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c1 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist type: D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c1 = 0x010222f6db0fd6f343bd03737460c589dc7b4f91cd5fd889129207b63c6bf8000dd39e5c1ccccccd1c9ed9999999999a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Generators:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x008848defe740a67c8fc6225bf87ff5485951e2caa9d41bb188282c8bd37cb5cd5481512ffcd394eeab9b16eb21be9ef&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x01914a69c5102eff1f674f5d30afeec4bd7fb348ca3e52d96d182ad44fb82305c2fe3d3634a9591afd82de55559c8ea6&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;G2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c0 = 0x018480be71c785fec89630a2a3841d01c565f071203e50317ea501f557db6b9b71889f52bb53540274e3e48f7c005196&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c1 = 0x00ea6040e700403170dc5a51b1b140d5532777ee6651cecbe7223ece0799c9de5cf89984bff76fe6b26bfefa6ea16afe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c0 = 0x00690d665d446f7bd960736bcbb2efb4de03ed7274b49a58e458c282f832d204f2cf88886d8c7c2ef094094409fd4ddf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c1 = 0x00f8169fd28355189e549da3151a70aa61ef11ac3d591bf12463b01acee304c24279b83f5e52270bd9a1cdd185eb8f93&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pairing parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|x| (miller loop scalar) = 0x8508c00000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x is negative = false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;fine-points-and-encoding-of-base-elements&quot;&gt;Fine points and encoding of base elements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field elements encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;To encode points involved in the operation one has to encode elements of the base field and the extension field.&lt;&#x2F;p&gt;
&lt;p&gt;Base field element (Fp) is encoded as &lt;code&gt;64&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer (top &lt;code&gt;16&lt;&#x2F;code&gt; bytes are always zeroes). &lt;code&gt;64&lt;&#x2F;code&gt; bytes are chosen to have &lt;code&gt;32&lt;&#x2F;code&gt; byte aligned ABI (representable as e.g. &lt;code&gt;bytes32[2]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[2]&lt;&#x2F;code&gt;). Corresponding integer &lt;strong&gt;must&lt;&#x2F;strong&gt; be less than field modulus.&lt;&#x2F;p&gt;
&lt;p&gt;For elements of the quadratic extension field (Fp2) encoding is byte concatenation of individual encoding of the coefficients totaling in &lt;code&gt;128&lt;&#x2F;code&gt; bytes for a total encoding. For an Fp2 element in a form &lt;code&gt;el = c0 + c1 * v&lt;&#x2F;code&gt; where &lt;code&gt;v&lt;&#x2F;code&gt; is formal quadratic non-residue and &lt;code&gt;c0&lt;&#x2F;code&gt; and &lt;code&gt;c1&lt;&#x2F;code&gt; are Fp elements the corresponding byte encoding will be &lt;code&gt;encode(c0) || encode(c1)&lt;&#x2F;code&gt; where &lt;code&gt;||&lt;&#x2F;code&gt; means byte concatenation (or one can use &lt;code&gt;bytes32[4]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[4]&lt;&#x2F;code&gt; in terms of Solidity types).&lt;&#x2F;p&gt;
&lt;p&gt;If encodings do not follow this spec anywhere during parsing in the precompile the precompile &lt;em&gt;must&lt;&#x2F;em&gt; return an error.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-points-in-g1-g2&quot;&gt;Encoding of points in G1&#x2F;G2:&lt;&#x2F;h4&gt;
&lt;p&gt;Points in either G1 (in base field) or in G2 (in extension field) are encoded as byte concatenation of encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; affine coordinates. Total encoding length for G1 point is thus &lt;code&gt;128&lt;&#x2F;code&gt; bytes and for G2 point is &lt;code&gt;256&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-of-infinity-encoding&quot;&gt;Point of infinity encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;Also referred as &quot;zero point&quot;. For BLS12 curves point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (formal zeroes in Fp or Fp2) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, so encoding of such point &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; is used as a convention to encode point of infinity.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars-for-multiplication-operation&quot;&gt;Encoding of scalars for multiplication operation:&lt;&#x2F;h4&gt;
&lt;p&gt;Scalar for multiplication operation is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. Corresponding integer is &lt;strong&gt;not&lt;&#x2F;strong&gt; required to be less than or equal than main subgroup size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-operations&quot;&gt;ABI for operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abi-for-g1-addition&quot;&gt;ABI for G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G1 addition call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G1 points (&lt;code&gt;128&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiplication&quot;&gt;ABI for G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiplication call expects &lt;code&gt;160&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of encoding of G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiplication operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g1-multiexponentiation&quot;&gt;ABI for G1 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G1 multiexponentiation call expects &lt;code&gt;160*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiexponentiation operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of G1 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-addition&quot;&gt;ABI for G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G2 addition call expects &lt;code&gt;512&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G2 points (&lt;code&gt;256&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Either of points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiplication&quot;&gt;ABI for G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiplication call expects &lt;code&gt;288&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of encoding of G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiplication operation result - single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Point being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-multiexponentiation&quot;&gt;ABI for G2 multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;G2 multiexponentiation call expects &lt;code&gt;288*k&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of multiexponentiation operation result - single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Any of G2 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-pairing&quot;&gt;ABI for pairing&lt;&#x2F;h4&gt;
&lt;p&gt;Pairing call expects &lt;code&gt;384*k&lt;&#x2F;code&gt; bytes as an inputs that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices. Each slice has the following structure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;128&lt;&#x2F;code&gt; bytes of G1 point encoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;256&lt;&#x2F;code&gt; bytes of G2 point encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Output is a &lt;code&gt;32&lt;&#x2F;code&gt; bytes where first &lt;code&gt;31&lt;&#x2F;code&gt; bytes are equal to &lt;code&gt;0x00&lt;&#x2F;code&gt; and the last byte is &lt;code&gt;0x01&lt;&#x2F;code&gt; if pairing result is equal to multiplicative identity in a pairing target field and &lt;code&gt;0x00&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid encoding of any boolean variable must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Any of G1 or G2 points being not on the curve must result in error&lt;&#x2F;li&gt;
&lt;li&gt;Any of G1 or G2 points are not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Field elements encoding rules apply (obviously)&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp-element-to-g1-point&quot;&gt;ABI for mapping Fp element to G1 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;64&lt;&#x2F;code&gt; bytes as input that is interpreted as an element of the base field. Output of this call is &lt;code&gt;128&lt;&#x2F;code&gt; bytes and is G1 point following respective encoding rules.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not a valid field element&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp2-element-to-g2-point&quot;&gt;ABI for mapping Fp2 element to G2 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;128&lt;&#x2F;code&gt; bytes as input that is interpreted as an element of the quadratic extension field. Output of this call is &lt;code&gt;256&lt;&#x2F;code&gt; bytes and is G2 point following respective encoding rules.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not a valid field element&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;prevention-of-ddos-on-error-handling&quot;&gt;Prevention of DDoS on error handling&lt;&#x2F;h3&gt;
&lt;p&gt;This precompile performs extensive computations and in case of any errors during execution it MUST consume all gas from the gas schedule for the corresponding operation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming a constant &lt;code&gt;30 MGas&#x2F;second&lt;&#x2F;code&gt; following prices are suggested.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-addition&quot;&gt;G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;600&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-multiplication&quot;&gt;G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;12000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-addition&quot;&gt;G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;4500&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-multiplication&quot;&gt;G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;55000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-g2-multiexponentiation&quot;&gt;G1&#x2F;G2 Multiexponentiation&lt;&#x2F;h4&gt;
&lt;p&gt;Multiexponentiations are expected to be performed by the Peppinger algorithm (we can also say that it &lt;strong&gt;must&lt;&#x2F;strong&gt; be performed by Peppinger algorithm to have a speedup that results in a discount over naive implementation by multiplying each pair separately and adding the results). For this case there was a table prepared for discount in case of &lt;code&gt;k &amp;lt;= 128&lt;&#x2F;code&gt; points in the multiexponentiation with a discount cap &lt;code&gt;max_discount&lt;&#x2F;code&gt; for &lt;code&gt;k &amp;gt; 128&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid non-integer arithmetic call cost is calculated as &lt;code&gt;k * multiplication_cost * discount &#x2F; multiplier&lt;&#x2F;code&gt; where &lt;code&gt;multiplier = 1000&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt; is a number of (scalar, point) pairs for the call, &lt;code&gt;multiplication_cost&lt;&#x2F;code&gt; is a corresponding single multiplication call cost for G1&#x2F;G2.&lt;&#x2F;p&gt;
&lt;p&gt;Discounts table as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1200], [2, 888], [3, 764], [4, 641], [5, 594], [6, 547], [7, 500], [8, 453], [9, 438], [10, 423], [11, 408], [12, 394], [13, 379], [14, 364], [15, 349], [16, 334], [17, 330], [18, 326], [19, 322], [20, 318], [21, 314], [22, 310], [23, 306], [24, 302], [25, 298], [26, 294], [27, 289], [28, 285], [29, 281], [30, 277], [31, 273], [32, 269], [33, 268], [34, 266], [35, 265], [36, 263], [37, 262], [38, 260], [39, 259], [40, 257], [41, 256], [42, 254], [43, 253], [44, 251], [45, 250], [46, 248], [47, 247], [48, 245], [49, 244], [50, 242], [51, 241], [52, 239], [53, 238], [54, 236], [55, 235], [56, 233], [57, 232], [58, 231], [59, 229], [60, 228], [61, 226], [62, 225], [63, 223], [64, 222], [65, 221], [66, 220], [67, 219], [68, 219], [69, 218], [70, 217], [71, 216], [72, 216], [73, 215], [74, 214], [75, 213], [76, 213], [77, 212], [78, 211], [79, 211], [80, 210], [81, 209], [82, 208], [83, 208], [84, 207], [85, 206], [86, 205], [87, 205], [88, 204], [89, 203], [90, 202], [91, 202], [92, 201], [93, 200], [94, 199], [95, 199], [96, 198], [97, 197], [98, 196], [99, 196], [100, 195], [101, 194], [102, 193], [103, 193], [104, 192], [105, 191], [106, 191], [107, 190], [108, 189], [109, 188], [110, 188], [111, 187], [112, 186], [113, 185], [114, 185], [115, 184], [116, 183], [117, 182], [118, 182], [119, 181], [120, 180], [121, 179], [122, 179], [123, 178], [124, 177], [125, 176], [126, 176], [127, 175], [128, 174]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 174&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pairing-operation&quot;&gt;Pairing operation&lt;&#x2F;h4&gt;
&lt;p&gt;Cost of the pairing operation is &lt;code&gt;55000*k + 65000&lt;&#x2F;code&gt; where &lt;code&gt;k&lt;&#x2F;code&gt; is a number of pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp-to-g1-mapping-operation&quot;&gt;Fp-to-G1 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp -&amp;gt; G1 mapping is &lt;code&gt;5500&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp2-to-g2-mapping-operation&quot;&gt;Fp2-to-G2 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp2 -&amp;gt; G2 mapping is &lt;code&gt;75000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Motivation section covers a total motivation to have operations over BLS12-377 curve available. We also extend a rationale for move specific fine points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;multiexponentiation-as-a-separate-call&quot;&gt;Multiexponentiation as a separate call&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit separate multiexponentiation operation that allows one to save execution time (so gas) by both the algorithm used (namely Peppinger algorithm) and (usually forgotten) by the fact that &lt;code&gt;CALL&lt;&#x2F;code&gt; operation in Ethereum is expensive (at the time of writing), so one would have to pay non-negigible overhead if e.g. for multiexponentiation of &lt;code&gt;100&lt;&#x2F;code&gt; points would have to call the multipication precompile &lt;code&gt;100&lt;&#x2F;code&gt; times and addition for &lt;code&gt;99&lt;&#x2F;code&gt; times (roughly &lt;code&gt;138600&lt;&#x2F;code&gt; would be saved).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility questions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;important-notes&quot;&gt;Important notes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;subgroup-checks&quot;&gt;Subgroup checks&lt;&#x2F;h4&gt;
&lt;p&gt;Subgroup check &lt;strong&gt;is mandatory&lt;&#x2F;strong&gt; during the pairing call. Implementations &lt;em&gt;should&lt;&#x2F;em&gt; use fast subgroup checks: at the time of writing multiplication gas cost is based on &lt;code&gt;double-and-add&lt;&#x2F;code&gt; multiplication method that has a clear &quot;worst case&quot; (all bits are equal to one). For pairing operation it&#x27;s expected that implementation uses faster subgroup check, e.g. by using wNAF multiplication method for elliptic curves that is ~ &lt;code&gt;40%&lt;&#x2F;code&gt; cheaper with windows size equal to 4. (Tested empirically. Savings are due to lower hamming weight of the group order and even lower hamming weight for wNAF. Concretely, subgroup check for both G1 and G2 points in a pair are around &lt;code&gt;35000&lt;&#x2F;code&gt; combined).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the large test parameters space we first provide properties that various operations must satisfy. We use additive notation for point operations, capital letters (&lt;code&gt;P&lt;&#x2F;code&gt;, &lt;code&gt;Q&lt;&#x2F;code&gt;) for points, small letters (&lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;) for scalars. Generator for G1 is labeled as &lt;code&gt;G&lt;&#x2F;code&gt;, generator for G2 is labeled as &lt;code&gt;H&lt;&#x2F;code&gt;, otherwise we assume random point on a curve in a correct subgroup. &lt;code&gt;0&lt;&#x2F;code&gt; means either scalar zero or point of infinity. &lt;code&gt;1&lt;&#x2F;code&gt; means either scalar one or multiplicative identity. &lt;code&gt;group_order&lt;&#x2F;code&gt; is a main subgroup order. &lt;code&gt;e(P, Q)&lt;&#x2F;code&gt; means pairing operation where &lt;code&gt;P&lt;&#x2F;code&gt; is in G1, &lt;code&gt;Q&lt;&#x2F;code&gt; is in G2.&lt;&#x2F;p&gt;
&lt;p&gt;Requeired properties for basic ops (add&#x2F;multiply):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Commutativity: &lt;code&gt;P + Q = Q + P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Additive negation: &lt;code&gt;P + (-P) = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Doubling &lt;code&gt;P + P = 2*P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subgroup check: &lt;code&gt;group_order * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Trivial multiplication check: &lt;code&gt;1 * P = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by zero: &lt;code&gt;0 * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by the unnormalized scalar &lt;code&gt;(scalar + group_order) * P = scalar * P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Required properties for pairing operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Degeneracy &lt;code&gt;e(P, 0*Q) = e(0*P, Q) = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Bilinearity &lt;code&gt;e(a*P, b*Q) = e(a*b*P, Q) = e(P, a*b*Q)&lt;&#x2F;code&gt; (internal test, not visible through ABI)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Test vector for all operations are expanded in this &lt;code&gt;csv&lt;&#x2F;code&gt; files in matter-labs&#x27; 1962 proposol.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a various choice of existing implementations of the curve operations. It may require extra work to add an ABI:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Code bases with fixed parameters&lt;&#x2F;li&gt;
&lt;li&gt;Rust: matter-labs&lt;&#x2F;li&gt;
&lt;li&gt;C++: matter-labs&lt;&#x2F;li&gt;
&lt;li&gt;Original implementation linked in Zexe paper in Rust: github.com&#x2F;scipr-lab&#x2F;zexe&lt;&#x2F;li&gt;
&lt;li&gt;Standalone in Go: github.com&#x2F;kilic&#x2F;bls12-377&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Strictly following the spec will eliminate security implications or consensus implications in a contrast to the previous BN254 precompile.&lt;&#x2F;p&gt;
&lt;p&gt;Important topic is a &quot;constant time&quot; property for performed operations. We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Phase out refunds</title>
        <published>2020-02-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>William Morriss</name><uri>https://github.com/wjmelements</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3300/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-3300-phase-out-refunds/5434" />
        

        <id>https://wg-eips.ritovision.com/3300/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3300"
            label="EIP-3300" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3300/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Phases out the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; gas refunds.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP would define a block when the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; refunds would begin to diminish.
The refund would step linearly downward, eroding the implicit value of such refunds at an accelerating pace.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Refunds increase block elasticity, so the block gas target can exceed the number established by miners by up to 2x.
This can cause hesitancy for miners to increase the block gas target.&lt;&#x2F;p&gt;
&lt;p&gt;Refunds, tokenized or not, are valuable to their holders, especially during congestion.
If refunds must be removed, a gradual change in their value would be less-disruptive to the gas market than sudden abolition.
Refund consumption would proceed, especially during periods of congestion, and the refunds would be cleaned up from the state.
Refund creation, driven by demand, would naturally diminish as the efficiency of the refunds fall.
As the refund value approaches the activation cost, the implicit value of the refunds will approach zero, but in periods of congestion they will be cleaned up.&lt;&#x2F;p&gt;
&lt;p&gt;This change is less work for the protocol developers than compensation and cleanup, while likely still achieving cleanup.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK_NUM&lt;&#x2F;code&gt;: EIP-3300 activation block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REFUND_DECAY_STEP&lt;&#x2F;code&gt;: 1 gas&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REFUND_DECAY_FREQUENCY&lt;&#x2F;code&gt;: 100 blocks&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Computed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;: &lt;code&gt;REFUND_DECAY_STEP * ceil((block.number + 1 - FORK_BLOCK_NUM) &#x2F; REFUND_DECAY_FREQUENCY)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;On the block this EIP activates, and again every &lt;code&gt;REFUND_DECAY_FREQUENCY&lt;&#x2F;code&gt; blocks, all gas refunds, including &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; would diminish by &lt;code&gt;REFUND_DECAY_STEP&lt;&#x2F;code&gt;, until 0.
The current difference is called the &lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;, which shall be subtracted from each gas refund.&lt;&#x2F;p&gt;
&lt;p&gt;For gas-cost regimes with refund removals that cancel prior refunds, the invariant that the refund counter cannot go negative will be preserved by diminishing the magnitude of those removals by &lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;, until 0.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eip-2929&quot;&gt;EIP-2929&lt;&#x2F;h3&gt;
&lt;p&gt;The refunds as of EIP-2929 are as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;24000 for SELFDESTRUCT&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_RESET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (5000 - 100)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (20000 - 100)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; (20000 - 100)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; (15000)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each of these refunds would be decreased by the current &lt;code&gt;REFUND_DECAY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There is also a case where &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; is removed from the refund counter.
That removal will also diminish by &lt;code&gt;REFUND_DECAY_STEP&lt;&#x2F;code&gt; until 0, maintaining the non-negative refund counter invariant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Persisted refunds would become worthless before they fall below their activation cost.
Once the refunds are worthless, they can be removed by another hard fork without waiting for 0.
The rate of diminishing specified would currently require (24000-5000) * 100 = 1,900,000 blocks for &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; and (15000-5000) * 100 = 1,000,000 blocks for &lt;code&gt;SSTORE&lt;&#x2F;code&gt;.
This timeframe is currently about a year, which should be enough flexibility for the remaining refunds to be consumed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal breaks gas refunds, which contribute to block elasticity.
The effect of this will be increased gas price volatility: higher highs and lower lows.&lt;&#x2F;p&gt;
&lt;p&gt;Because the refund counter is separate from the gas counter, the block-to-block gas changes will not break &lt;code&gt;eth_estimateGas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for BLS12-381 curve operations</title>
        <published>2020-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	<author>
		<name>Kelly Olson</name><uri>https://github.com/ineffectualproperty</uri>
	</author>
	
	<author>
		<name>Alex Stokes</name><uri>https://github.com/ralexstokes</uri>
	</author>
	
	<author>
		<name>Antonio Sanso</name><uri>https://github.com/asanso</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2537/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip2537-bls12-precompile-discussion-thread/4187" />
        

        <id>https://wg-eips.ritovision.com/2537/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2537"
            label="EIP-2537" />
        

        
        

        
        <summary type="html">Adds operation on BLS12-381 curve as a precompile in a set necessary to efficiently perform operations such as BLS signature verification.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2537/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Add functionality to efficiently perform operations over the BLS12-381 curve, including those for BLS signature verification.&lt;&#x2F;p&gt;
&lt;p&gt;Along with the curve arithmetic, multi-scalar-multiplication operations are included to efficiently aggregate public keys or individual signer&#x27;s signatures during BLS signature verification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation of this precompile is to add a cryptographic primitive that allows to get 120+ bits of security for operations over pairing friendly curve compared to the existing BN254 precompile that only provides 80 bits of security.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;constants&quot;&gt;Constants&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Name&lt;&#x2F;th&gt;&lt;th&gt;Value&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G1ADD&lt;&#x2F;td&gt;&lt;td&gt;0x0b&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G1MSM&lt;&#x2F;td&gt;&lt;td&gt;0x0c&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G2ADD&lt;&#x2F;td&gt;&lt;td&gt;0x0d&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_G2MSM&lt;&#x2F;td&gt;&lt;td&gt;0x0e&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_PAIRING_CHECK&lt;&#x2F;td&gt;&lt;td&gt;0x0f&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_MAP_FP_TO_G1&lt;&#x2F;td&gt;&lt;td&gt;0x10&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BLS12_MAP_FP2_TO_G2&lt;&#x2F;td&gt;&lt;td&gt;0x11&lt;&#x2F;td&gt;&lt;td&gt;precompile address&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;We introduce &lt;em&gt;seven&lt;&#x2F;em&gt; separate precompiles to perform the following operations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BLS12_G1ADD - to perform point addition in G1 (curve over base prime field) with a gas cost of &lt;code&gt;375&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_G1MSM - to perform multi-scalar-multiplication (MSM) in G1 (curve over base prime field) with a gas cost formula defined in the corresponding section&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_G2ADD - to perform point addition in G2 (curve over quadratic extension of the base prime field) with a gas cost of &lt;code&gt;600&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_G2MSM - to perform multi-scalar-multiplication (MSM) in G2 (curve over quadratic extension of the base prime field) with a gas cost formula defined in the corresponding section&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_PAIRING_CHECK - to perform a pairing operations between a set of &lt;em&gt;pairs&lt;&#x2F;em&gt; of (G1, G2) points a gas cost formula defined in the corresponding section&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_MAP_FP_TO_G1 - maps base field element into the G1 point with a gas cost of &lt;code&gt;5500&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;li&gt;BLS12_MAP_FP2_TO_G2 - maps extension field element into the G2 point with a gas cost of &lt;code&gt;23800&lt;&#x2F;code&gt; gas&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A mapping functions specification is included as a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;field_to_curve&#x2F;&quot;&gt;document&lt;&#x2F;a&gt;. This mapping function does NOT perform mapping of the byte string into a field element (as it can be implemented in many different ways and can be efficiently performed in EVM), but only does field arithmetic to map a field element into a curve point. Such functionality is required for signature schemes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;curve-parameters&quot;&gt;Curve parameters&lt;&#x2F;h3&gt;
&lt;p&gt;The BLS12 curve is fully defined by the following set of parameters (coefficient &lt;code&gt;A=0&lt;&#x2F;code&gt; for all BLS12 curves):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Base field modulus = p = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp - finite field of size p&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve Fp equation: Y^2 = X^3+B (mod p)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Main subgroup order = q = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Extension tower&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp quadratic non-residue = nr2 = 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaaa&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 is Fp[X]&#x2F;(X^2-nr2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Curve Fp2 equation: Y^2 = X^3 + B*(v+1) where v is the square root of nr2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp6&#x2F;Fp12 construction:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Fp2 cubic non-residue c1 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Twist type: M&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c0 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;B coefficient for twist c1 = 0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Generators:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H1:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X = 0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y = 0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;H2:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c0 = 0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;X c1 = 0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c0 = 0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y c1 = 0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Pairing parameters:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;|x| (miller loop scalar) = 0xd201000000010000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;x is negative = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;One should note that base field modulus &lt;code&gt;p&lt;&#x2F;code&gt; is equal to &lt;code&gt;3 mod 4&lt;&#x2F;code&gt; that allows an efficient square root extraction, although as described below gas cost of decompression is larger than gas cost of supplying decompressed point data in &lt;code&gt;calldata&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fields-and-groups&quot;&gt;Fields and Groups&lt;&#x2F;h3&gt;
&lt;p&gt;Field Fp is defined as the finite field of size &lt;code&gt;p&lt;&#x2F;code&gt; with elements represented as integers between 0 and p-1 (both inclusive).&lt;&#x2F;p&gt;
&lt;p&gt;Field Fp2 is defined as &lt;code&gt;Fp[X]&#x2F;(X^2-nr2)&lt;&#x2F;code&gt; with elements  &lt;code&gt;el = c0 + c1 * v&lt;&#x2F;code&gt;, where &lt;code&gt;v&lt;&#x2F;code&gt; is the formal square root of &lt;code&gt;nr2&lt;&#x2F;code&gt; represented as integer pairs &lt;code&gt;(c0,c1)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Group G1 is defined as a set of Fp pairs (points) &lt;code&gt;(x,y)&lt;&#x2F;code&gt; such that either &lt;code&gt;(x,y)&lt;&#x2F;code&gt; is  &lt;code&gt;(0,0)&lt;&#x2F;code&gt; or &lt;code&gt;x,y&lt;&#x2F;code&gt; satisfy the curve Fp equation.&lt;&#x2F;p&gt;
&lt;p&gt;Group G2 is defined as a set of Fp2 pairs (points) &lt;code&gt;(x&#x27;,y&#x27;)&lt;&#x2F;code&gt; such that either &lt;code&gt;(x,y)&lt;&#x2F;code&gt; is &lt;code&gt;(0,0)&lt;&#x2F;code&gt; or &lt;code&gt;(x&#x27;,y&#x27;)&lt;&#x2F;code&gt; satisfy the curve Fp2 equation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fine-points-and-encoding-of-base-elements&quot;&gt;Fine points and encoding of base elements&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;field-elements-encoding&quot;&gt;Field elements encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;In order to produce inputs to an operation, one encodes elements of the base field and the extension field.&lt;&#x2F;p&gt;
&lt;p&gt;A base field element (Fp) is encoded as &lt;code&gt;64&lt;&#x2F;code&gt; bytes by performing the BigEndian encoding of the corresponding (unsigned) integer. Due to the size of &lt;code&gt;p&lt;&#x2F;code&gt;, the top &lt;code&gt;16&lt;&#x2F;code&gt; bytes are always zeroes. &lt;code&gt;64&lt;&#x2F;code&gt; bytes are chosen to have &lt;code&gt;32&lt;&#x2F;code&gt; byte aligned ABI (representable as e.g. &lt;code&gt;bytes32[2]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[2]&lt;&#x2F;code&gt; with the latter assuming the BigEndian encoding). The corresponding integer &lt;strong&gt;must&lt;&#x2F;strong&gt; be less than field modulus.&lt;&#x2F;p&gt;
&lt;p&gt;For elements of the quadratic extension field (Fp2), encoding is byte concatenation of individual encoding of the coefficients totaling in &lt;code&gt;128&lt;&#x2F;code&gt; bytes for a total encoding. For an Fp2 element in a form &lt;code&gt;el = c0 + c1 * v&lt;&#x2F;code&gt; where &lt;code&gt;v&lt;&#x2F;code&gt; is the formal square root of a quadratic non-residue and &lt;code&gt;c0&lt;&#x2F;code&gt; and &lt;code&gt;c1&lt;&#x2F;code&gt; are Fp elements the corresponding byte encoding will be &lt;code&gt;encode(c0) || encode(c1)&lt;&#x2F;code&gt; where &lt;code&gt;||&lt;&#x2F;code&gt; means byte concatenation (or one can use &lt;code&gt;bytes32[4]&lt;&#x2F;code&gt; or &lt;code&gt;uint256[4]&lt;&#x2F;code&gt; in terms of Solidity types).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note on the top &lt;code&gt;16&lt;&#x2F;code&gt; bytes being zero&lt;&#x2F;em&gt;: it is required that an encoded element is &quot;in a field&quot;, which means strictly &lt;code&gt;&amp;lt; modulus&lt;&#x2F;code&gt;. In BigEndian encoding it automatically means that for a modulus that is just &lt;code&gt;381&lt;&#x2F;code&gt; bit long the top &lt;code&gt;16&lt;&#x2F;code&gt; bytes in &lt;code&gt;64&lt;&#x2F;code&gt; bytes encoding are zeroes and this &lt;strong&gt;must&lt;&#x2F;strong&gt; be checked even if only a subslice of input data is used for actual decoding.&lt;&#x2F;p&gt;
&lt;p&gt;On inputs that can not be a valid encodings of field elements the precompile &lt;em&gt;must&lt;&#x2F;em&gt; return an error.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-points-in-g1-g2&quot;&gt;Encoding of points in G1&#x2F;G2:&lt;&#x2F;h4&gt;
&lt;p&gt;Points of G1 and G2 are encoded as byte concatenation of the respective encodings of the &lt;code&gt;x&lt;&#x2F;code&gt; and &lt;code&gt;y&lt;&#x2F;code&gt; coordinates. Total encoding length for a G1 point is thus &lt;code&gt;128&lt;&#x2F;code&gt; bytes and for a G2 point is &lt;code&gt;256&lt;&#x2F;code&gt; bytes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;point-of-infinity-encoding&quot;&gt;Point of infinity encoding:&lt;&#x2F;h4&gt;
&lt;p&gt;Also referred to as the &quot;zero point&quot;. For BLS12 curves, the point with coordinates &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; (zeroes in Fp or Fp2) is &lt;em&gt;not&lt;&#x2F;em&gt; on the curve, so a sequence of &lt;code&gt;128&lt;&#x2F;code&gt; resp. &lt;code&gt;256&lt;&#x2F;code&gt; zero bytes, which naively would decode as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt; is instead used by convention to encode the point of infinity of G1 resp. G2.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;encoding-of-scalars-for-multiplication-operation&quot;&gt;Encoding of scalars for multiplication operation:&lt;&#x2F;h4&gt;
&lt;p&gt;A scalar for the multiplication operation is encoded as &lt;code&gt;32&lt;&#x2F;code&gt; bytes by performing BigEndian encoding of the corresponding (unsigned) integer. The corresponding integer is &lt;strong&gt;not&lt;&#x2F;strong&gt; required to be less than or equal to main subgroup order &lt;code&gt;q&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;behavior-on-empty-inputs&quot;&gt;Behavior on empty inputs:&lt;&#x2F;h4&gt;
&lt;p&gt;Certain operations have variable length input, such as MSMs (takes a list of pairs &lt;code&gt;(point, scalar)&lt;&#x2F;code&gt;), or pairing (takes a list of &lt;code&gt;(G1, G2)&lt;&#x2F;code&gt; points). While their behavior is well-defined (from an arithmetic perspective) on empty inputs, this EIP discourages such use cases and variable input length operations must return an error if the input is empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;abi-for-operations&quot;&gt;ABI for operations&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;abi-for-g1-addition&quot;&gt;ABI for G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G1 addition call expects &lt;code&gt;256&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G1 points (&lt;code&gt;128&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G1 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;p&gt;There is no subgroup check for the G1 addition precompile.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;abi-for-g1-msm&quot;&gt;ABI for G1 MSM&lt;&#x2F;h4&gt;
&lt;p&gt;G1 MSM call expects &lt;code&gt;160*k&lt;&#x2F;code&gt; (&lt;code&gt;k&lt;&#x2F;code&gt; being a &lt;strong&gt;positive&lt;&#x2F;strong&gt; integer) bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of a G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of MSM operation result - a single G1 point (&lt;code&gt;128&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G1 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;An input is on the G1 elliptic curve but not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-g2-addition&quot;&gt;ABI for G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;G2 addition call expects &lt;code&gt;512&lt;&#x2F;code&gt; bytes as an input that is interpreted as byte concatenation of two G2 points (&lt;code&gt;256&lt;&#x2F;code&gt; bytes each). Output is an encoding of addition operation result - a single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G2 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Note:&lt;&#x2F;p&gt;
&lt;p&gt;There is no subgroup check for the G2 addition precompile.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;abi-for-g2-msm&quot;&gt;ABI for G2 MSM&lt;&#x2F;h4&gt;
&lt;p&gt;G2 MSM call expects &lt;code&gt;288*k&lt;&#x2F;code&gt; (&lt;code&gt;k&lt;&#x2F;code&gt; being a &lt;strong&gt;positive&lt;&#x2F;strong&gt; integer) bytes as an input that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices each of them being a byte concatenation of encoding of G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes) and encoding of a scalar value (&lt;code&gt;32&lt;&#x2F;code&gt; bytes). Output is an encoding of MSM operation result - a single G2 point (&lt;code&gt;256&lt;&#x2F;code&gt; bytes).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on the G2 elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;An input is on the G2 elliptic curve but not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-pairing-check&quot;&gt;ABI for pairing check&lt;&#x2F;h4&gt;
&lt;p&gt;Pairing check call expects &lt;code&gt;384*k&lt;&#x2F;code&gt;  (&lt;code&gt;k&lt;&#x2F;code&gt; being a &lt;strong&gt;positive&lt;&#x2F;strong&gt; integer)  bytes as an inputs that is interpreted as byte concatenation of &lt;code&gt;k&lt;&#x2F;code&gt; slices. Each slice has the following structure:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;128&lt;&#x2F;code&gt; bytes of G1 point encoding&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;256&lt;&#x2F;code&gt; bytes of G2 point encoding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Each point is expected to be in the subgroup of order &lt;code&gt;q&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;It checks the equation &lt;code&gt;e(P1, Q1) * e(P2, Q2) * ... * e(Pk, Qk) == 1&lt;&#x2F;code&gt; in the pairing target field where &lt;code&gt;e&lt;&#x2F;code&gt; is the pairing operation. Output is &lt;code&gt;32&lt;&#x2F;code&gt; bytes where first &lt;code&gt;31&lt;&#x2F;code&gt; bytes are equal to &lt;code&gt;0x00&lt;&#x2F;code&gt; and the last byte is either &lt;code&gt;0x00&lt;&#x2F;code&gt; (false) or &lt;code&gt;0x01&lt;&#x2F;code&gt; (true).&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Invalid coordinate encoding&lt;&#x2F;li&gt;
&lt;li&gt;An input is neither a point on its respective elliptic curve nor the infinity point&lt;&#x2F;li&gt;
&lt;li&gt;An input is on its respective elliptic curve but not in the correct subgroup&lt;&#x2F;li&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp-element-to-g1-point&quot;&gt;ABI for mapping Fp element to G1 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;64&lt;&#x2F;code&gt; bytes as an input that is interpreted as an element of Fp. Output of this call is &lt;code&gt;128&lt;&#x2F;code&gt; bytes and is an encoded G1 point.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not correctly encoded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;abi-for-mapping-fp2-element-to-g2-point&quot;&gt;ABI for mapping Fp2 element to G2 point&lt;&#x2F;h4&gt;
&lt;p&gt;Field-to-curve call expects &lt;code&gt;128&lt;&#x2F;code&gt; bytes as an input that is interpreted as an element of Fp2. Output of this call is &lt;code&gt;256&lt;&#x2F;code&gt; bytes and is an encoded G2 point.&lt;&#x2F;p&gt;
&lt;p&gt;Error cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Input has invalid length&lt;&#x2F;li&gt;
&lt;li&gt;Input is not correctly encoded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-burning-on-error&quot;&gt;Gas burning on error&lt;&#x2F;h3&gt;
&lt;p&gt;Following the current state of all other precompiles, if a call to one of the precompiles in this EIP results in an error then all the gas supplied along with a &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; is burned.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ddos-protection&quot;&gt;DDoS protection&lt;&#x2F;h3&gt;
&lt;p&gt;A sane implementation of this EIP &lt;em&gt;should not&lt;&#x2F;em&gt; contain potential infinite loops (it is possible and not even hard to implement all the functionality without &lt;code&gt;while&lt;&#x2F;code&gt; loops) and the gas schedule accurately reflects the time spent on computations of the corresponding function (precompiles pricing reflects an amount of gas consumed in the worst case where such a case exists).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-schedule&quot;&gt;Gas schedule&lt;&#x2F;h3&gt;
&lt;p&gt;Assuming &lt;code&gt;EcRecover&lt;&#x2F;code&gt; precompile as a baseline.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-addition&quot;&gt;G1 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;375&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-multiplication&quot;&gt;G1 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;12000&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-addition&quot;&gt;G2 addition&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;600&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g2-multiplication&quot;&gt;G2 multiplication&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;22500&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;g1-g2-msm&quot;&gt;G1&#x2F;G2 MSM&lt;&#x2F;h4&gt;
&lt;p&gt;MSMs are expected to be performed by Pippenger&#x27;s algorithm (we can also say that it &lt;strong&gt;must&lt;&#x2F;strong&gt; be performed by Pippenger&#x27;s algorithm to have a speedup that results in a discount over naive implementation by multiplying each pair separately and adding the results). For this case there was a table prepared for discount in case of &lt;code&gt;k &amp;lt;= 128&lt;&#x2F;code&gt; points in the MSM with a discount cap &lt;code&gt;max_discount&lt;&#x2F;code&gt; for &lt;code&gt;k &amp;gt; 128&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The call cost is calculated as &lt;code&gt;(k * multiplication_cost * discount) &#x2F;&#x2F; multiplier&lt;&#x2F;code&gt; where &lt;code&gt;multiplier = 1000&lt;&#x2F;code&gt;, &lt;code&gt;k&lt;&#x2F;code&gt; is a number of (scalar, point) pairs for the call, &lt;code&gt;multiplication_cost&lt;&#x2F;code&gt; is a corresponding G1&#x2F;G2 multiplication cost presented above and &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is an integer division.&lt;&#x2F;p&gt;
&lt;p&gt;G1 and G2 are priced separately, each having their own discount table and &lt;code&gt;max_discount&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;g1-discounts&quot;&gt;G1 discounts&lt;&#x2F;h5&gt;
&lt;p&gt;Discounts table for G1 MSM as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1000], [2, 949], [3, 848], [4, 797], [5, 764], [6, 750], [7, 738], [8, 728], [9, 719], [10, 712], [11, 705], [12, 698], [13, 692], [14, 687], [15, 682], [16, 677], [17, 673], [18, 669], [19, 665], [20, 661], [21, 658], [22, 654], [23, 651], [24, 648], [25, 645], [26, 642], [27, 640], [28, 637], [29, 635], [30, 632], [31, 630], [32, 627], [33, 625], [34, 623], [35, 621], [36, 619], [37, 617], [38, 615], [39, 613], [40, 611], [41, 609], [42, 608], [43, 606], [44, 604], [45, 603], [46, 601], [47, 599], [48, 598], [49, 596], [50, 595], [51, 593], [52, 592], [53, 591], [54, 589], [55, 588], [56, 586], [57, 585], [58, 584], [59, 582], [60, 581], [61, 580], [62, 579], [63, 577], [64, 576], [65, 575], [66, 574], [67, 573], [68, 572], [69, 570], [70, 569], [71, 568], [72, 567], [73, 566], [74, 565], [75, 564], [76, 563], [77, 562], [78, 561], [79, 560], [80, 559], [81, 558], [82, 557], [83, 556], [84, 555], [85, 554], [86, 553], [87, 552], [88, 551], [89, 550], [90, 549], [91, 548], [92, 547], [93, 547], [94, 546], [95, 545], [96, 544], [97, 543], [98, 542], [99, 541], [100, 540], [101, 540], [102, 539], [103, 538], [104, 537], [105, 536], [106, 536], [107, 535], [108, 534], [109, 533], [110, 532], [111, 532], [112, 531], [113, 530], [114, 529], [115, 528], [116, 528], [117, 527], [118, 526], [119, 525], [120, 525], [121, 524], [122, 523], [123, 522], [124, 522], [125, 521], [126, 520], [127, 520], [128, 519]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 519&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h5 id=&quot;g2-discounts&quot;&gt;G2 discounts&lt;&#x2F;h5&gt;
&lt;p&gt;Discounts table for G2 MSM as a vector of pairs &lt;code&gt;[k, discount]&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[[1, 1000], [2, 1000], [3, 923], [4, 884], [5, 855], [6, 832], [7, 812], [8, 796], [9, 782], [10, 770], [11, 759], [12, 749], [13, 740], [14, 732], [15, 724], [16, 717], [17, 711], [18, 704], [19, 699], [20, 693], [21, 688], [22, 683], [23, 679], [24, 674], [25, 670], [26, 666], [27, 663], [28, 659], [29, 655], [30, 652], [31, 649], [32, 646], [33, 643], [34, 640], [35, 637], [36, 634], [37, 632], [38, 629], [39, 627], [40, 624], [41, 622], [42, 620], [43, 618], [44, 615], [45, 613], [46, 611], [47, 609], [48, 607], [49, 606], [50, 604], [51, 602], [52, 600], [53, 598], [54, 597], [55, 595], [56, 593], [57, 592], [58, 590], [59, 589], [60, 587], [61, 586], [62, 584], [63, 583], [64, 582], [65, 580], [66, 579], [67, 578], [68, 576], [69, 575], [70, 574], [71, 573], [72, 571], [73, 570], [74, 569], [75, 568], [76, 567], [77, 566], [78, 565], [79, 563], [80, 562], [81, 561], [82, 560], [83, 559], [84, 558], [85, 557], [86, 556], [87, 555], [88, 554], [89, 553], [90, 552], [91, 552], [92, 551], [93, 550], [94, 549], [95, 548], [96, 547], [97, 546], [98, 545], [99, 545], [100, 544], [101, 543], [102, 542], [103, 541], [104, 541], [105, 540], [106, 539], [107, 538], [108, 537], [109, 537], [110, 536], [111, 535], [112, 535], [113, 534], [114, 533], [115, 532], [116, 532], [117, 531], [118, 530], [119, 530], [120, 529], [121, 528], [122, 528], [123, 527], [124, 526], [125, 526], [126, 525], [127, 524], [128, 524]]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;max_discount = 524&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pairing-check-operation&quot;&gt;Pairing check operation&lt;&#x2F;h4&gt;
&lt;p&gt;The cost of the pairing check operation is &lt;code&gt;32600*k + 37700&lt;&#x2F;code&gt; where &lt;code&gt;k&lt;&#x2F;code&gt; is a number of pairs.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp-to-g1-mapping-operation&quot;&gt;Fp-to-G1 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp -&amp;gt; G1 mapping is &lt;code&gt;5500&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;fp2-to-g2-mapping-operation&quot;&gt;Fp2-to-G2 mapping operation&lt;&#x2F;h4&gt;
&lt;p&gt;Fp2 -&amp;gt; G2 mapping is &lt;code&gt;23800&lt;&#x2F;code&gt; gas&lt;&#x2F;p&gt;
&lt;h4 id=&quot;gas-schedule-clarifications-for-the-variable-length-input&quot;&gt;Gas schedule clarifications for the variable-length input&lt;&#x2F;h4&gt;
&lt;p&gt;For MSM and pairing functions, the gas cost depends on the input length. The current state of how the gas schedule is implemented in major clients (at the time of writing) is that the gas cost function does &lt;em&gt;not&lt;&#x2F;em&gt; perform any validation of the length of the input and never returns an error. So we present a list of rules how the gas cost functions &lt;strong&gt;must&lt;&#x2F;strong&gt; be implemented to ensure consistency between clients and safety.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;gas-schedule-clarifications-for-g1-g2-msm&quot;&gt;Gas schedule clarifications for G1&#x2F;G2 MSM&lt;&#x2F;h5&gt;
&lt;p&gt;Define a constant &lt;code&gt;LEN_PER_PAIR&lt;&#x2F;code&gt; that is equal to &lt;code&gt;160&lt;&#x2F;code&gt; for G1 operation and to &lt;code&gt;288&lt;&#x2F;code&gt; for G2 operation. Define a function &lt;code&gt;discount(k)&lt;&#x2F;code&gt; following the rules in the corresponding section, where &lt;code&gt;k&lt;&#x2F;code&gt; is number of pairs.&lt;&#x2F;p&gt;
&lt;p&gt;The following pseudofunction reflects how gas should be calculated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;k = floor(len(input) &#x2F; LEN_PER_PAIR);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if k == 0 {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  return 0;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost = k * multiplication_cost * discount(k) &#x2F;&#x2F; multiplier;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return gas_cost;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We use floor division to get the number of pairs. If the length of the input is not divisible by &lt;code&gt;LEN_PER_PAIR&lt;&#x2F;code&gt; we still produce &lt;em&gt;some&lt;&#x2F;em&gt; result, but later on the precompile will return an error. Also, the case when &lt;code&gt;k = 0&lt;&#x2F;code&gt; is safe: &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; cost is non-zero, and the case with formal zero gas cost is already used in &lt;code&gt;Blake2f&lt;&#x2F;code&gt; precompile. In any case, the main precompile routine &lt;strong&gt;must&lt;&#x2F;strong&gt; produce an error on such an input because it violated encoding rules.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;gas-schedule-clarifications-for-pairing&quot;&gt;Gas schedule clarifications for pairing&lt;&#x2F;h5&gt;
&lt;p&gt;Define a constant &lt;code&gt;LEN_PER_PAIR = 384&lt;&#x2F;code&gt;;&lt;&#x2F;p&gt;
&lt;p&gt;The following pseudofunction reflects how gas should be calculated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;k = floor(len(input) &#x2F; LEN_PER_PAIR);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas_cost = 32600*k + 37700;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;return gas_cost;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;We use floor division to get the number of pairs. If the length of the input is not divisible by &lt;code&gt;LEN_PER_PAIR&lt;&#x2F;code&gt; we still produce &lt;em&gt;some&lt;&#x2F;em&gt; result, but later on the precompile will return an error (the precompile routine &lt;strong&gt;must&lt;&#x2F;strong&gt; produce an error on such an input because it violated encoding rules).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The motivation section covers a total motivation to have operations over the BLS12-381 curves available. We also extend a rationale for more specific fine points.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;msm-as-a-separate-call&quot;&gt;MSM as a separate call&lt;&#x2F;h3&gt;
&lt;p&gt;Explicit separate MSM operation that allows one to save execution time (so gas) by both the algorithm used (namely Pippenger&#x27;s algorithm) and (usually forgotten) by the fact that &lt;code&gt;CALL&lt;&#x2F;code&gt; operation in Ethereum is expensive (at the time of writing), so one would have to pay non-negligible overhead if e.g. for MSM of &lt;code&gt;100&lt;&#x2F;code&gt; points would have to call the multiplication precompile &lt;code&gt;100&lt;&#x2F;code&gt; times and addition for &lt;code&gt;99&lt;&#x2F;code&gt; times (roughly &lt;code&gt;138600&lt;&#x2F;code&gt; would be saved).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;no-dedicated-mul-call&quot;&gt;No dedicated MUL call&lt;&#x2F;h3&gt;
&lt;p&gt;Dedicated MUL precompiles which perform single G1&#x2F;G2 point by scalar multiplication have exactly the same ABI as MSM with &lt;code&gt;k == 1&lt;&#x2F;code&gt;.
MSM has to inspect the input length to reject inputs of invalid lengths. Therefore, it should recognize the case of &lt;code&gt;k == 1&lt;&#x2F;code&gt; and invoke the underlying implementation of single point multiplication to avoid the overhead of more complex multi-scalar multiplication algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backward compatibility questions.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subgroup-checks&quot;&gt;Subgroup checks&lt;&#x2F;h3&gt;
&lt;p&gt;MSMs and pairings MUST perform a subgroup check.
Implementations SHOULD use the optimized subgroup check method detailed in a dedicated &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;fast_subgroup_checks&#x2F;&quot;&gt;document&lt;&#x2F;a&gt;.
On any input that fails the subgroup check, the precompile MUST return an error.
As endomorphism acceleration requires input on the correct subgroup, implementers MAY use endomorphism acceleration.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;field-to-curve-mapping&quot;&gt;Field to curve mapping&lt;&#x2F;h3&gt;
&lt;p&gt;The algorithms and set of parameters for SWU mapping method are provided by a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;field_to_curve&#x2F;&quot;&gt;document&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the large test parameters space, we first provide properties that various operations must satisfy. We use additive notation for point operations, capital letters (&lt;code&gt;P&lt;&#x2F;code&gt;, &lt;code&gt;Q&lt;&#x2F;code&gt;) for points, small letters (&lt;code&gt;a&lt;&#x2F;code&gt;, &lt;code&gt;b&lt;&#x2F;code&gt;) for scalars. The generator for G1 is labeled as &lt;code&gt;G&lt;&#x2F;code&gt;, the generator for G2 is labeled as &lt;code&gt;H&lt;&#x2F;code&gt;, otherwise we assume random points on a curve in a correct subgroup. &lt;code&gt;0&lt;&#x2F;code&gt; means either scalar zero or point at infinity. &lt;code&gt;1&lt;&#x2F;code&gt; means either scalar one or multiplicative identity. &lt;code&gt;group_order&lt;&#x2F;code&gt; is the main subgroup order. &lt;code&gt;e(P, Q)&lt;&#x2F;code&gt; means pairing operation where &lt;code&gt;P&lt;&#x2F;code&gt; is in G1, &lt;code&gt;Q&lt;&#x2F;code&gt; is in G2.&lt;&#x2F;p&gt;
&lt;p&gt;Required properties for basic ops (add&#x2F;multiply):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Commutativity: &lt;code&gt;P + Q = Q + P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Identity element: &lt;code&gt;P + 0 = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Additive negation: &lt;code&gt;P + (-P) = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Doubling &lt;code&gt;P + P = 2*P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Subgroup check: &lt;code&gt;group_order * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Trivial multiplication check: &lt;code&gt;1 * P = P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by zero: &lt;code&gt;0 * P = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication by the unnormalized scalar &lt;code&gt;(scalar + group_order) * P = scalar * P&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Required properties for pairing operation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Bilinearity &lt;code&gt;e(a*P, b*Q) = e(a*b*P, Q) = e(P, a*b*Q)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Non-degeneracy &lt;code&gt;e(P, Q) != 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e(P, 0*Q) = e(0*P, Q) = 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;e(P, -Q) = e(-P, Q)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;test-vectors&#x2F;&quot;&gt;in the test vectors files&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;benchmarking-test-cases&quot;&gt;Benchmarking test cases&lt;&#x2F;h3&gt;
&lt;p&gt;A set of test vectors for quick benchmarking on new implementations is located in a separate &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2537&#x2F;assets&#x2F;bench_vectors&#x2F;&quot;&gt;file&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There are two fully spec compatible implementations on the day of writing:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;One in Rust language that is based on the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt; code and integrated with OpenEthereum for this library&lt;&#x2F;li&gt;
&lt;li&gt;One implemented specifically for Geth as a part of the current codebase&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Strictly following the spec will eliminate security implications or consensus implications in a contrast to the previous BN254 precompile.&lt;&#x2F;p&gt;
&lt;p&gt;Important topic is a &quot;constant time&quot; property for performed operations. We explicitly state that this precompile &lt;strong&gt;IS NOT REQUIRED&lt;&#x2F;strong&gt; to perform all the operations using constant time algorithms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Penalty for account trie misses</title>
        <published>2020-02-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2583/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2583-penalties-for-trie-misses/4190" />
        

        <id>https://wg-eips.ritovision.com/2583/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2583"
            label="EIP-2583" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2583/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a gas penalty for opcodes which access the account for trie non-existent accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a gas penalty for accesses to the account trie, where the address being looked up does not exist. Non-existing accounts can be used in
DoS attacks, since they bypass cache mechanisms, thus creating a large discrepancy between &#x27;normal&#x27; mode of execution and &#x27;worst-case&#x27; execution of an opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;As the ethereum trie becomes more and more saturated, the number of disk lookups that a node is required to do in order to access a piece of state increases too. This means that checking e.g. &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account at block &lt;code&gt;5&lt;&#x2F;code&gt; was &lt;em&gt;inherently&lt;&#x2F;em&gt; a cheaper operation that it is at, say &lt;code&gt;8.5M&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;From an implementation perspective, a node can (and does) use various caching mechanisms to cope with the problem, but there&#x27;s an inherent problem with caches: when they yield a &#x27;hit&#x27;, they&#x27;re great, but when they &#x27;miss&#x27;, they&#x27;re useless.&lt;&#x2F;p&gt;
&lt;p&gt;This is attackable. By forcing a node to lookup non-existent keys, an attacker can maximize the number of disk lookups.
Sidenote: even if the &#x27;non-existence&#x27; is cached, it&#x27;s trivial to use a new non-existent key the next time, and never hit the same non-existent key again. Thus, caching &#x27;non-existence&#x27; might be dangerous, since it will evict &#x27;good&#x27; entries.&lt;&#x2F;p&gt;
&lt;p&gt;So far, the attempts to handle this problem has been in raising the gas cost, e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;However, when determining gas-costs, a secondary problem that arises due to the large discrepancy between &#x27;happy-path&#x27; and &#x27;notorious path&#x27; -- how do we determine the pricing?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &#x27;happy-path&#x27;, assuming all items are cached?
&lt;ul&gt;
&lt;li&gt;Doing so would that would underprice all trie-accesses, and could be DoS-attacked.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &#x27;normal&#x27; usage, based on benchmarks of actual usage?
&lt;ul&gt;
&lt;li&gt;This is basically what we do now, but that means that intentionally notorious executions are underpriced -- which constitutes a DoS vulnerability.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &#x27;paranoid&#x27; case: price everything as if caching did not exist?
&lt;ul&gt;
&lt;li&gt;This would severely harm basically every contract due to the gas-cost increase. Also, if the gas limits were raised in order to allow the same amount of computation as before, the notorious case could again be used for DoS attacks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;From an engineering point of view, a node implementor is left with few options:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implement bloom filters for existence. This is difficult, not least because of the problems of reorgs, and the fact that it&#x27;s difficult to undo bloom filter modifications.&lt;&#x2F;li&gt;
&lt;li&gt;Implement flattened account databases. This is also difficult, both because of reorgs and also because it needs to be an &lt;em&gt;additional&lt;&#x2F;em&gt; data structure aside from the &lt;code&gt;trie&lt;&#x2F;code&gt; -- we need the &lt;code&gt;trie&lt;&#x2F;code&gt; for consensus. So it&#x27;s an extra data structure of around &lt;code&gt;15G&lt;&#x2F;code&gt; that needs to be kept in check. This is currently being pursued by the Geth-team.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP proposes a mechanism to alleviate the situation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define the constant &lt;code&gt;penalty&lt;&#x2F;code&gt; as &lt;code&gt;TBD&lt;&#x2F;code&gt; (suggested &lt;code&gt;2000&lt;&#x2F;code&gt; gas).&lt;&#x2F;p&gt;
&lt;p&gt;For opcodes which access the account trie, whenever the operation is invoked targeting an &lt;code&gt;address&lt;&#x2F;code&gt; which does not exist in the trie, then &lt;code&gt;penalty&lt;&#x2F;code&gt; gas is deducted from the available &lt;code&gt;gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;detailed-specification&quot;&gt;Detailed specification&lt;&#x2F;h3&gt;
&lt;p&gt;These are the opcodes which triggers lookup into the main account trie:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Opcode&lt;&#x2F;th&gt;&lt;th&gt;Affected&lt;&#x2F;th&gt;&lt;th&gt;Comment&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;BALANCE&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;balance(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODEHASH&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;extcodehash(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODECOPY&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;extcodecopy(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;EXTCODESIZE&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;extcodesize(nonexistent_addr)&lt;&#x2F;code&gt; would incur &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALLCODE&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATICCALL&lt;&#x2F;td&gt;&lt;td&gt;Yes&lt;&#x2F;td&gt;&lt;td&gt;See details below about call variants&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;SELFDESTRUCT&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;td&gt;See details below.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CREATE&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;td&gt;Create destination not explicitly settable, and assumed to be nonexistent already.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CREATE2&lt;&#x2F;td&gt;&lt;td&gt;No&lt;&#x2F;td&gt;&lt;td&gt;Create destination not explicitly settable, and assumed to be nonexistent already.&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;notes-on-call-derivatives&quot;&gt;Notes on Call-derivatives&lt;&#x2F;h3&gt;
&lt;p&gt;A &lt;code&gt;CALL&lt;&#x2F;code&gt; triggers a lookup of the &lt;code&gt;CALL&lt;&#x2F;code&gt; destination address. The base cost for &lt;code&gt;CALL&lt;&#x2F;code&gt; is at &lt;code&gt;700&lt;&#x2F;code&gt; gas. A few other characteristics determine the actual gas cost of a call:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the &lt;code&gt;CALL&lt;&#x2F;code&gt; (or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;) transfers value, an additional &lt;code&gt;9K&lt;&#x2F;code&gt; is added as cost.
1.1 If the &lt;code&gt;CALL&lt;&#x2F;code&gt; destination did not previously exist, an additional &lt;code&gt;25K&lt;&#x2F;code&gt; gas is added to the cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This EIP adds a second rule in the following way:&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;If the call does &lt;em&gt;not&lt;&#x2F;em&gt; transfer value and the callee does &lt;em&gt;not&lt;&#x2F;em&gt; exist, then &lt;code&gt;penalty&lt;&#x2F;code&gt; gas is added to the cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In the table below,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;value&lt;&#x2F;code&gt; means non-zero value transfer,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;!value&lt;&#x2F;code&gt; means zero value transfer,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;dest&lt;&#x2F;code&gt; means destination already exists, or is a &lt;code&gt;precompile&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;!dest&lt;&#x2F;code&gt; means destination does not exist and is not a &lt;code&gt;precompile&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;value,dest&lt;&#x2F;th&gt;&lt;th&gt;value, !dest&lt;&#x2F;th&gt;&lt;th&gt;!value, dest&lt;&#x2F;th&gt;&lt;th&gt;!value, !dest&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;CALLCODE&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;DELEGATECALL&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;STATICCALL&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;N&#x2F;A&lt;&#x2F;td&gt;&lt;td&gt;no change&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Whether the rules of this EIP is to be applied for regular ether-sends in &lt;code&gt;transactions&lt;&#x2F;code&gt; is TBD. See the &#x27;Backwards Compatibility&#x27;-section for some more discussion on that topic.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-on-selfdestruct&quot;&gt;Note on &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; opcode also triggers an account trie lookup of the &lt;code&gt;beneficiary&lt;&#x2F;code&gt;. However, due to the following reasons, it has been omitted from having a &lt;code&gt;penalty&lt;&#x2F;code&gt; since it already costs &lt;code&gt;5K&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clarifications&quot;&gt;Clarifications:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;base&lt;&#x2F;code&gt; costs of any opcodes are not modified by the EIP.&lt;&#x2F;li&gt;
&lt;li&gt;The opcode &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is not modified by this EIP, regardless of whether the &lt;code&gt;self&lt;&#x2F;code&gt; address exists or not.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With this scheme, we could continue to price these operations based on the &#x27;normal&#x27; usage, but gain protection from attacks that try to maximize disk lookups&#x2F;cache misses.
This EIP does not modify anything regarding storage trie accesses, which might be relevant for a future EIP. However, there are a few crucial differences.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Storage tries are typically small, and there&#x27;s a high cost to populate a storage trie with sufficient density for it to be in the same league as the account trie.&lt;&#x2F;li&gt;
&lt;li&gt;If an attacker wants to use an existing large storage trie, e.g. some popular token, he would typically have to make a &lt;code&gt;CALL&lt;&#x2F;code&gt; to cause a lookup in that token -- something like &lt;code&gt;token.balanceOf(&amp;lt;nonexistent-address&amp;gt;)&lt;&#x2F;code&gt;.
That adds quite a lot of extra gas-impediments, as each &lt;code&gt;CALL&lt;&#x2F;code&gt; is another &lt;code&gt;700&lt;&#x2F;code&gt; gas, plus gas for arguments to the &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;determining-the-penalty&quot;&gt;Determining the &lt;code&gt;penalty&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;A transaction with &lt;code&gt;10M&lt;&#x2F;code&gt; gas can today cause ~&lt;code&gt;14K&lt;&#x2F;code&gt; trie lookups.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;1000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;5800&lt;&#x2F;code&gt; lookups, &lt;code&gt;41%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;2000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;3700&lt;&#x2F;code&gt; lookups, &lt;code&gt;26%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;3000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;2700&lt;&#x2F;code&gt; lookups, &lt;code&gt;20%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;penalty&lt;&#x2F;code&gt; of &lt;code&gt;4000&lt;&#x2F;code&gt;would lower the number to ~&lt;code&gt;2100&lt;&#x2F;code&gt; lookups, &lt;code&gt;15%&lt;&#x2F;code&gt; of the original.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;There exists a roofing function for the &lt;code&gt;penalty&lt;&#x2F;code&gt;. Since the &lt;code&gt;penalty&lt;&#x2F;code&gt; is deducted from &lt;code&gt;gas&lt;&#x2F;code&gt;, that means that a malicious contract can always invoke a malicious relay to perform the trie lookup. Let&#x27;s refer to this as the &#x27;shielded relay&#x27; attack.&lt;&#x2F;p&gt;
&lt;p&gt;In such a scenario, the &lt;code&gt;malicious&lt;&#x2F;code&gt; would spend &lt;code&gt;~750&lt;&#x2F;code&gt; gas each call to &lt;code&gt;relay&lt;&#x2F;code&gt;, and would need to provide the &lt;code&gt;relay&lt;&#x2F;code&gt; with at least &lt;code&gt;700&lt;&#x2F;code&gt; gas to do a trie access.&lt;&#x2F;p&gt;
&lt;p&gt;Thus, the effective &lt;code&gt;cost&lt;&#x2F;code&gt; would be on the order of &lt;code&gt;1500&lt;&#x2F;code&gt;. It can thus be argued that &lt;code&gt;penalty&lt;&#x2F;code&gt; above &lt;code&gt;~800&lt;&#x2F;code&gt; would not achieve better protection against trie-miss attacks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard-fork.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ether-transfers&quot;&gt;Ether transfers&lt;&#x2F;h3&gt;
&lt;p&gt;A regular &lt;code&gt;transaction&lt;&#x2F;code&gt; from one EOA to another, with value, is not affected.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;transaction&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt; value, to a destination which does not exist, would be. This scenario is highly unlikely to matter, since such a &lt;code&gt;transaction&lt;&#x2F;code&gt; is useless -- even during success, all it would accomplish would be to spend some &lt;code&gt;gas&lt;&#x2F;code&gt;. With this EIP, it would potentially spend some more gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;layer-2&quot;&gt;Layer 2&lt;&#x2F;h3&gt;
&lt;p&gt;Regarding layer-2 backward compatibility, this EIP is a lot less disruptive than EIPs which modify the &lt;code&gt;base&lt;&#x2F;code&gt; cost of an opcode. For state accesses, there are
seldom legitimate scenarios where&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A contract checks &lt;code&gt;BALANCE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; of another contract &lt;code&gt;b&lt;&#x2F;code&gt;, &lt;em&gt;and&lt;&#x2F;em&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;If such &lt;code&gt;b&lt;&#x2F;code&gt; does not exist, continues the execution&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h4 id=&quot;solidity-remote-calls&quot;&gt;Solidity remote calls&lt;&#x2F;h4&gt;
&lt;p&gt;Example: When a remote call is made in Solidity:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    recipient.invokeMethod(1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Solidity does a pre-flight &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; on &lt;code&gt;recipient&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If the pre-flight check returns &lt;code&gt;0&lt;&#x2F;code&gt;, then &lt;code&gt;revert(0,0)&lt;&#x2F;code&gt; is executed, to stop the execution.&lt;&#x2F;li&gt;
&lt;li&gt;If the pre-flight check returns non-zero, then the execution continues and the &lt;code&gt;CALL&lt;&#x2F;code&gt; is made.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;With this EIP in place, the &#x27;happy-path&#x27; would work as previously, and the &#x27;notorious&#x27;-path where &lt;code&gt;recipient&lt;&#x2F;code&gt; does not exist would cost an extra &lt;code&gt;penalty&lt;&#x2F;code&gt; gas, but the actual execution-flow would be unchanged.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;erc223&quot;&gt;ERC223&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;223&quot;&gt;ERC223 Token Standard&lt;&#x2F;a&gt; is, at the time of writing, marked as &#x27;Draft&#x27;, but is deployed and in use on mainnet today.&lt;&#x2F;p&gt;
&lt;p&gt;The ERC specifies that when a token &lt;code&gt;transfer(_to,...)&lt;&#x2F;code&gt; method is invoked, then:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;This function must transfer tokens and invoke the function &lt;code&gt;tokenFallback (address, uint256, bytes)&lt;&#x2F;code&gt; in &lt;code&gt;_to&lt;&#x2F;code&gt;, if &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract.
...
NOTE: The recommended way to check whether the &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract or an address is to assemble the code of &lt;code&gt;_to&lt;&#x2F;code&gt;. If there is no code in &lt;code&gt;_to&lt;&#x2F;code&gt;, then this is an externally owned address, otherwise it&#x27;s a contract.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The reference implementations from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Dexaran&#x2F;ERC223-token-standard&#x2F;tree&#x2F;development&#x2F;token&#x2F;ERC223&quot;&gt;Dexaran&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-contracts&#x2F;blob&#x2F;1bc923b6a222e79a90f20305a459b0ee779eb918&#x2F;contracts&#x2F;token&#x2F;ERC721&#x2F;ERC721.sol#L499&quot;&gt;OpenZeppelin&lt;&#x2F;a&gt; both implement the &lt;code&gt;isContract&lt;&#x2F;code&gt; check using an &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; invocation.&lt;&#x2F;p&gt;
&lt;p&gt;This scenario &lt;em&gt;could&lt;&#x2F;em&gt; be affected, but in practice should not be. Let&#x27;s consider the possibilities:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; is a contract: Then &lt;code&gt;ERC223&lt;&#x2F;code&gt; specifies that the function &lt;code&gt;tokenFallback(...)&lt;&#x2F;code&gt; is invoked.
&lt;ul&gt;
&lt;li&gt;The gas expenditure for that call is at least&lt;code&gt;700&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;In order for the &lt;code&gt;callee&lt;&#x2F;code&gt; to be able to perform any action, best practice it to ensure that it has at least &lt;code&gt;2300&lt;&#x2F;code&gt; gas along with the call.&lt;&#x2F;li&gt;
&lt;li&gt;In summary: this path requires there to be least &lt;code&gt;3000&lt;&#x2F;code&gt; extra gas available (which is not due to any &lt;code&gt;penalty&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; exists, but is no contract. The flow exits here, and is not affected by this EIP&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;_to&lt;&#x2F;code&gt; does not exist: A &lt;code&gt;penalty&lt;&#x2F;code&gt; is deducted.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;In summary, it would seem that &lt;code&gt;ERC223&lt;&#x2F;code&gt; should not be affected, as long as the &lt;code&gt;penalty&lt;&#x2F;code&gt; does not go above around &lt;code&gt;3000&lt;&#x2F;code&gt; gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;other&quot;&gt;Other&lt;&#x2F;h3&gt;
&lt;p&gt;The contract &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x08d32b0da63e2c3bcf8019c9c5d849d7a9d791e6#code&quot;&gt;&lt;code&gt;Dentacoin&lt;&#x2F;code&gt;&lt;&#x2F;a&gt; would be affected.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    function transfer(address _to, uint256 _value) returns (bool success) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ... &#x2F;&#x2F; omitted for brevity&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (balances[msg.sender] &amp;gt;= _value &amp;amp;&amp;amp; balances[_to] + _value &amp;gt; balances[_to]) {               &#x2F;&#x2F; Check if sender has enough and for overflows&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            balances[msg.sender] = safeSub(balances[msg.sender], _value);   &#x2F;&#x2F; Subtract DCN from the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if (msg.sender.balance &amp;gt;= minBalanceForAccounts &amp;amp;&amp;amp; _to.balance &amp;gt;= minBalanceForAccounts) {    &#x2F;&#x2F; Check if sender can pay gas and if recipient could&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                balances[_to] = safeAdd(balances[_to], _value);             &#x2F;&#x2F; Add the same amount of DCN to the recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Transfer(msg.sender, _to, _value);                          &#x2F;&#x2F; Notify anyone listening that this transfer took place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            } else {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                balances[this] = safeAdd(balances[this], DCNForGas);        &#x2F;&#x2F; Pay DCNForGas to the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                balances[_to] = safeAdd(balances[_to], safeSub(_value, DCNForGas));  &#x2F;&#x2F; Recipient balance -DCNForGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                Transfer(msg.sender, _to, safeSub(_value, DCNForGas));      &#x2F;&#x2F; Notify anyone listening that this transfer took place&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if(msg.sender.balance &amp;lt; minBalanceForAccounts) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if(!msg.sender.send(gasForDCN)) throw;                  &#x2F;&#x2F; Send eth to sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if(_to.balance &amp;lt; minBalanceForAccounts) {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if(!_to.send(gasForDCN)) throw;                         &#x2F;&#x2F; Send eth to recipient&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        } else { throw; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The contract checks &lt;code&gt;_to.balance &amp;gt;= minBalanceForAccounts&lt;&#x2F;code&gt;, and if the &lt;code&gt;balance&lt;&#x2F;code&gt; is too low, some &lt;code&gt;DCN&lt;&#x2F;code&gt; is converted to &lt;code&gt;ether&lt;&#x2F;code&gt; and sent to the &lt;code&gt;_to&lt;&#x2F;code&gt;. This is a mechanism to ease on-boarding, whereby a new user who has received some &lt;code&gt;DCN&lt;&#x2F;code&gt; can immediately create a transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Before this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When sending &lt;code&gt;DCN&lt;&#x2F;code&gt; to a non-existing address, the additional &lt;code&gt;gas&lt;&#x2F;code&gt; expenditure would be:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;9000&lt;&#x2F;code&gt; for an ether-transfer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;25000&lt;&#x2F;code&gt; for a new account-creation&lt;&#x2F;li&gt;
&lt;li&gt;(&lt;code&gt;2300&lt;&#x2F;code&gt; would be refunded to the caller later)&lt;&#x2F;li&gt;
&lt;li&gt;A total runtime &lt;code&gt;gas&lt;&#x2F;code&gt;-cost of &lt;code&gt;34K&lt;&#x2F;code&gt; gas would be required to handle this case.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After this EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;In addition to the &lt;code&gt;34K&lt;&#x2F;code&gt; an additional &lt;code&gt;penalty&lt;&#x2F;code&gt; would be added.
&lt;ul&gt;
&lt;li&gt;Possibly two, since the reference implementation does the balance-check twice, but it&#x27;s unclear whether the compiled code would indeed perform the check twice.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;A total runtime &lt;code&gt;gas&lt;&#x2F;code&gt;-cost of &lt;code&gt;34K+penalty&lt;&#x2F;code&gt; (or &lt;code&gt;34K + 2 * penalty&lt;&#x2F;code&gt;) would be required to handle this case.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It can be argued that the extra penalty of &lt;code&gt;2-3K&lt;&#x2F;code&gt; gas can be considered marginal in relation to the other &lt;code&gt;34K&lt;&#x2F;code&gt; gas already required to handle this.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The following cases need to be considered and tested:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;That during creation of a brand new contract, within the constructor, the &lt;code&gt;penalty&lt;&#x2F;code&gt; should not be applied for calls concerning the self-address.&lt;&#x2F;li&gt;
&lt;li&gt;TBD: How the &lt;code&gt;penalty&lt;&#x2F;code&gt; is applied in the case of a contract which has performed a &lt;code&gt;selfdestruct&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;a) previously in the same call-context,&lt;&#x2F;li&gt;
&lt;li&gt;b) previously in the same transaction,&lt;&#x2F;li&gt;
&lt;li&gt;c) previously in the same block,
For any variant of &lt;code&gt;EXTCODEHASH(destructed)&lt;&#x2F;code&gt;, &lt;code&gt;CALL(destructed)&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE(destructed)&lt;&#x2F;code&gt; etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The effects on a &lt;code&gt;transaction&lt;&#x2F;code&gt; with &lt;code&gt;0&lt;&#x2F;code&gt; value going to a non-existent account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;See &#x27;Backwards Compatibility&#x27;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not yet available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;alternative-variants&quot;&gt;Alternative variants&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;alt-1-insta-refunds&quot;&gt;Alt 1: Insta-refunds&lt;&#x2F;h3&gt;
&lt;p&gt;Bump all trie accesses with &lt;code&gt;penalty&lt;&#x2F;code&gt;. &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; becomes &lt;code&gt;2700&lt;&#x2F;code&gt; instead of &lt;code&gt;700&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a trie access hit an existing item, immediately refund penalty (&lt;code&gt;2K&lt;&#x2F;code&gt; )&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Upside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This eliminates the &#x27;shielded relay&#x27; attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Downside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This increases the up-front cost of many ops (CALL&#x2F;EXTCODEHASH&#x2F;EXTCODESIZE&#x2F;STATICCALL&#x2F;EXTCODESIZE etc)
&lt;ul&gt;
&lt;li&gt;Which may break many contracts.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;alt-2-parent-bail&quot;&gt;Alt 2: Parent bail&lt;&#x2F;h3&gt;
&lt;p&gt;Use &lt;code&gt;penalty&lt;&#x2F;code&gt; as described, but if a child context goes OOG on the &lt;code&gt;penalty&lt;&#x2F;code&gt;, then the remainder is subtracted from the
parent context (recursively).&lt;&#x2F;p&gt;
&lt;p&gt;Upside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This eliminates the &#x27;shielded relay&#x27; attack&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Downside:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This breaks the current invariant that a child context is limited by whatever &lt;code&gt;gas&lt;&#x2F;code&gt; was allocated for it.
&lt;ul&gt;
&lt;li&gt;However, the invariant is not &lt;em&gt;totally&lt;&#x2F;em&gt; thrown out, the new invariant becomes that it is limited to &lt;code&gt;gas + penalty&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;This can be seen as &#x27;messy&#x27; -- since only &lt;em&gt;some&lt;&#x2F;em&gt; types of OOG (penalties) becomes passed up the call chain, but not others, e.g. OOG due to trying
to allocate too much memory. There is a distinction, however:
&lt;ul&gt;
&lt;li&gt;Gas-costs which arise due to not-yet-consumed resources do not get passed to parent. For example: a huge allocation is not actually performed if there is insufficient gas.&lt;&#x2F;li&gt;
&lt;li&gt;Whereas gas-costs which arise due to already-consumed resources &lt;em&gt;do&lt;&#x2F;em&gt; get passed to parent; in this case the penalty is paid post-facto for a trie iteration.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Implement Difficulty Freeze</title>
        <published>2020-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Hancock</name><uri>https://github.com/madeoftin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2515/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2515-replace-the-difficulty-bomb-with-a-difficulty-freeze/3995" />
        

        <id>https://wg-eips.ritovision.com/2515/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2515"
            label="EIP-2515" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2515/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty Freeze is an alternative to the Difficulty Bomb that is implemented within the protocols difficulty adjustment algorithm. The Difficulty Freeze begins at a certain block height, determined in advance, freezes the difficulty and increases by 1% after that block forever. This does not stop the chain, but it incentivizes devs to upgrade at a regular cadence and requires any chain split to address the difficulty freeze.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty Freeze is a mechanism that is easy to predict and model, and the pressures of missing it are more readily felt by the core developers and client maintainers. The client maintainers are also positioned as the group that is most able to respond to an incoming Difficulty Freeze. This combined with the predictability is more likely to lead to the timely diffusual of the bomb.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current difficulty bombs&#x27; effect on the Block Time Targeting mechanism is rather complex to model, and it has both appeared when it was not expected (Muir Glacier) and negatively affected miners when they are not the target (in the case of delaying forks due to technical difficulties). Miners are affected by a reduction in block rewards due to the increase in block time. Users are affected as a function of the usability of the chain is affected by increased block times. Both of these groups are unable on their own to address the difficulty bomb. In the case of the Difficulty Freeze, the consequences of missing it are more directly felt by the client maintainers and it is more predictiable and so knowing when to make the change is readily apparent.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add variable &lt;code&gt;DIFFICULTY_FREEZE_HEIGHT&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The logic of the Difficulty Freeze is defined as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (BLOCK_HEIGHT &amp;lt;= DIFFICULTY_FREEZE_HEIGHT):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * max(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                1 - (block_timestamp - parent_timestamp) &#x2F;&#x2F; 10, -99)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; block_diff = parent_diff + parent_diff * 0.01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;Optional Implementation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Add the variable &lt;code&gt;DIFFICULTY_FREEZE_DIFFERENCE&lt;&#x2F;code&gt; and use the &lt;code&gt;LAST_FORK_HEIGHT&lt;&#x2F;code&gt; to calculate when the Difficulty Freeze would occur.&lt;&#x2F;p&gt;
&lt;p&gt;For example we can set the &lt;code&gt;DFD = 1,800,000 blocks&lt;&#x2F;code&gt; or approximately 9 months. The Difficulty Calculation would then be.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if (BLOCK_HEIGHT  &amp;lt;= LAST_FORK_HEIGHT + DIFFICULTY_FREEZE_DIFFERENCE) :&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * max(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                1 - (block_timestamp - parent_timestamp) &#x2F;&#x2F; 10, -99)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; block_diff = parent_diff + parent_diff * 0.01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This approach would have the added benefit that updating the Difficulty Freeze is easier as it happens automatically at the time of every upgrade. The trade-off is that the logic for checking is more complex and would require further analysis and test cases to ensure no consensus bugs arise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Block height is very easy to predict and evaluate within the system. This removes the effect of the Difficulty Bomb on block time, simplifying the block time targeting mechanism. The addition of an increase in the difficulty was added after feedback that the game theory of the mechanism did not reliably result in .&lt;&#x2F;p&gt;
&lt;p&gt;https:&#x2F;&#x2F;twitter.com&#x2F;quentinc137&#x2F;status&#x2F;1227110578235330562&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No backward incompatibilities&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The effect of missing the Difficulty Freeze has a different impact than missing the Difficulty Bomb. At the point of a Difficulty freeze, the protocol is no longer able to adapt to changes in hash power on the network. This can lead to one of three scenarios.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The Hash rate Increases:
Block Times would increase on the network for short time until the increase in difficulty is too high for the network to add any more miners.&lt;&#x2F;li&gt;
&lt;li&gt;The Hash rate decreases:
Block times would increase.&lt;&#x2F;li&gt;
&lt;li&gt;The Hash rate stays the same:
A consistent increase in blocktimes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Clients are motivated to have their client sync fully to the network and so are very motivated to keep this situation from occurring. Simultaneously delaying the Difficulty Freeze is most easily implemented by client teams. Therefore the group that is most negatively affected is also the group that can most efficiently address it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;economic-considerations&quot;&gt;Economic Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Under the current Difficult, Bomb issuance of ETH is reduced as the Ice Age takes affect. Under the Difficulty Freeze, it is more likely that issuance would increase for a short time; however, clients are motivated to prevent this and keep clients syncing effectively. This means it is much less likely to occur. The increase to the difficulty over time will eventually reduce blocktimes and also issuance.&lt;&#x2F;p&gt;
&lt;p&gt;It is also easy to predict when this change would happen, and stakeholders who are affected (Eth Holders) can keep client developers accountable by observing when the Difficulty Freeze is approaching and yell at them on twitter.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Coinbase calls</title>
        <published>2020-01-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ricardo Guilherme Schmidt</name><uri>https://github.com/3esmit</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2474/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/gas-abstraction-non-signed-block-validator-only-procedures/4388/2" />
        

        <id>https://wg-eips.ritovision.com/2474/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2474"
            label="EIP-2474" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2474/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Allow contracts to be called directly by &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; (block validator), without a transaction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;em&gt;In proof-of-work blockchains, validators are known as miners.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The validator might want to execute functions directly, without having to sign a transaction. Some examples might be presenting a proof in a contract for a change which also benefits the validator.&lt;&#x2F;p&gt;
&lt;p&gt;A notable example would be when a validator want to act as an &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1077&#x2F;&quot;&gt;EIP-1077&lt;&#x2F;a&gt; Gas Relayer, incentivized to pick up fees from meta transactions.
Without this change, they can do so by signing from any address a &lt;code&gt;gasPrice = 0&lt;&#x2F;code&gt; transaction with the gas relayed call.
However this brings an overhead of a signed transaction by validator that does nothing, as &lt;code&gt;msg.sender&lt;&#x2F;code&gt; is never used, and there is no gas cost to EVM charge.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal makes possible to remove this unused ecrecover.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order to reduce the overhead of calls that don&#x27;t use &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and are being called by validator with &lt;code&gt;tx.gasPrice = 0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The calls to be executed by &lt;code&gt;block.coinbase&lt;&#x2F;code&gt; would be included first at block, and would consume normally the gas of block, however they won&#x27;t pay&#x2F;cost gas, instead the call logic would pay the validator in other form.&lt;&#x2F;p&gt;
&lt;p&gt;Would be valid to execute any calls without a transaction by the block coinbase, except when the validator call tries to read &lt;code&gt;msg.sender&lt;&#x2F;code&gt;, which would throw an invalid jump.&lt;&#x2F;p&gt;
&lt;p&gt;Calls included by the validator would have &lt;code&gt;tx.origin = block.coinbase&lt;&#x2F;code&gt; and &lt;code&gt;gas.price = 0&lt;&#x2F;code&gt; for the rest of call stack, the rest follows as normal calls.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;tx.origin = block.coinbase&lt;&#x2F;code&gt; could cause some issues on bad designed contracts, such as using &lt;code&gt;tx.origin&lt;&#x2F;code&gt; to validate a signature, an analysis on how contracts use tx.origin might be useful to decide if this is a good choice.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Deprecate the CALLCODE opcode</title>
        <published>2019-12-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2488/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2488-deprecate-the-callcode-opcode/3957" />
        

        <id>https://wg-eips.ritovision.com/2488/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2488"
            label="EIP-2488" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2488/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Deprecate &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; in a &lt;em&gt;somewhat&lt;&#x2F;em&gt; backwards compatible way, by making it always return failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt; was part of the Frontier release of Ethereum. In the first few weeks&#x2F;months it became clear
that it cannot accomplish its intended design goal. This was rectified with introducing &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;
(&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;7&#x2F;&quot;&gt;EIP-7&lt;&#x2F;a&gt;) in the Homestead update (early 2016).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CALLCODE&lt;&#x2F;code&gt; became never utilized, but it still puts a burden on EVM implementations.&lt;&#x2F;p&gt;
&lt;p&gt;Disabling it will not improve the situation for any client whose goal is to sync from genesis, but would
help light clients or clients planning to sync from a later point in time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLOCK&lt;&#x2F;code&gt;, the &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; (&lt;code&gt;0xf2&lt;&#x2F;code&gt;) instruction always returns &lt;code&gt;0&lt;&#x2F;code&gt;, which signals failure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It would be possible just to remove the opcode and exceptionally abort if it is encountered.
However, by returning failure, the contract has a chance to act on it and potentially recover.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This is a breaking change and has a potential to break contracts. The author expects no contracts of any value
should be affected.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: validate this claim.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Muir Glacier Difficulty Bomb Delay</title>
        <published>2019-11-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Eric Conner</name><uri>https://github.com/econoar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2384/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2384-difficulty-bomb-delay" />
        

        <id>https://wg-eips.ritovision.com/2384/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2384"
            label="EIP-2384" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2384/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) and slowly accelerating. This EIP proposes to delay the difficulty bomb for another 4,000,000 blocks (~611 days).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;MUIR_GLACIER_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting to the client that the difficulty bomb is adjusting 9 million blocks later than the Homestead fork, which is also 7 million blocks later than the Byzantium fork and 4 million blocks later than the Constantinople fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty bomb started to become noticeable again on October 5th 2019 at block 8,600,000. Block times have been around 13.1s on average and now as of block 8,900,000 are around 14.3s. This will start to accelerate exponentially every 100,000 blocks. Estimating the added impact from the difficulty bomb on block times shows that we will see 20s block times near the end of December 2019 and 30s+ block times starting February 2020. This will start making the chain bloated and more costly to use. It&#x27;s best to delay the difficulty bomb again to around the time of expected launch of the Eth2 finality gadget.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 9_000_000) if block.number &amp;gt;= MUIR_GLACIER_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by 52 million seconds (approximately 611 days), so the chain would be back at 20 second block times around July 2021. It&#x27;s important to note this pushes the ice age 4,000,000 blocks from ~block 8,800,000 NOT from when this EIP is activated in a fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP shortly after the Istanbul fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation in it&#x27;s logic does not differ from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;EIP-649&lt;&#x2F;a&gt; or &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1234&#x2F;&quot;&gt;EIP-1234&lt;&#x2F;a&gt;; an implementation for Parity-Ethereum is available in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;pull&#x2F;9187&quot;&gt;parity-ethereum#9187&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTSLOAD opcode</title>
        <published>2019-10-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Dominic Letz</name><uri>https://github.com/dominicletz</uri>
	</author>
	
	<author>
		<name>Santiago Palladino</name><uri>https://github.com/spalladino</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2330/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2330-extsload-and-abi-for-lower-gas-cost-and-off-chain-apps/3733" />
        

        <id>https://wg-eips.ritovision.com/2330/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2330"
            label="EIP-2330" />
        

        
        

        
        <summary type="html">A new EVM opcode to read external contract storage data.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2330/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a new opcode &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; at &lt;code&gt;0x5c&lt;&#x2F;code&gt; which pops two items from the stack: &lt;code&gt;&amp;lt;account address&amp;gt; &amp;lt;storage key&amp;gt;&lt;&#x2F;code&gt; and pushes one item: &lt;code&gt;&amp;lt;storage value&amp;gt;&lt;&#x2F;code&gt;. The gas cost is sum of account access cost and storage read based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2929&#x2F;&quot;&gt;EIP-2929&lt;&#x2F;a&gt; Access Lists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While any off-chain application can read all contract storage data of all contracts, this is not possible for deployed smart contracts themselves. These are bound to use contract calls for any interaction including reading data from other contracts. This EIP adds an EVM opcode to directly read external contract storage.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost when reading from registry style contract such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;EIP-20s&lt;&#x2F;a&gt;, ENS and other data contracts is very high, because they incur cross contract call cost, cost for ABI encoding, decoding and dispatching and finally loading the data. In many cases the underlying storage that is being queried is though just a simple mapping. On top of that, the view function may SLOAD many other slots which caller may not be interested in, which further adds to the gas costs. In these cases a new &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; call directly accessing the mapping in storage could not only &lt;strong&gt;reduce the gas cost&lt;&#x2F;strong&gt; of the interaction more than 10x, but also it would make the gas cost &lt;strong&gt;predictable&lt;&#x2F;strong&gt; for the reading contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new EVM instruction &lt;code&gt;EXTSLOAD (0x5c)&lt;&#x2F;code&gt; that works like &lt;code&gt;SLOAD (0x54)&lt;&#x2F;code&gt; but an additional parameter representing the contract that is to be read from.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EXTSLOAD&lt;&#x2F;span&gt;&lt;span&gt; (0x5c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; instruction pops 2 values from the stack, first &lt;code&gt;contract&lt;&#x2F;code&gt; a contract address and then second &lt;code&gt;slot&lt;&#x2F;code&gt; a storage address within &lt;code&gt;contract&lt;&#x2F;code&gt;. As result &lt;code&gt;EXTSLOAD&lt;&#x2F;code&gt; pushes on the stack the value from the contract storage of &lt;code&gt;contract&lt;&#x2F;code&gt; at the storage &lt;code&gt;slot&lt;&#x2F;code&gt; address or &lt;code&gt;0&lt;&#x2F;code&gt; in case the account &lt;code&gt;contract&lt;&#x2F;code&gt; does not exist.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost-pre-verkle&quot;&gt;Gas cost pre-verkle&lt;&#x2F;h3&gt;
&lt;p&gt;Gas to be charged before Verkle Tree change is specified as &lt;code&gt;ACCOUNT_ACCESS_COST + STORAGE_READ_COST&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt; if the account address is already in &lt;code&gt;accessed_addresses&lt;&#x2F;code&gt; set, otherwise &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;STORAGE_READ_COST&lt;&#x2F;code&gt; is &lt;code&gt;WARM_STORAGE_READ_COST&lt;&#x2F;code&gt; if storage key is already in &lt;code&gt;accessed_storage_keys&lt;&#x2F;code&gt; set, otherwise &lt;code&gt;COLD_STORAGE_READ_COST&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;gas-cost-post-verkle&quot;&gt;Gas cost post-verkle&lt;&#x2F;h3&gt;
&lt;p&gt;It is important to consider that post Verkle tree change, &lt;code&gt;ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; will not be needed since a single account&#x27;s storage would be spread across the entire global trie. Hence gas to be charged post Verkle Tree change is just &lt;code&gt;STORAGE_READ_COST&lt;&#x2F;code&gt;, which is as specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2330&#x2F;#gas-cost-pre-verkle&quot;&gt;Gas cost pre-verkle&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Without this EIP, a contract can still opt-in to make their entire state public, by having a method that simply SLOADs and returns the values (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2330&#x2F;.&#x2F;assets&#x2F;Extsload.sol&quot;&gt;example&lt;&#x2F;a&gt;). The complexity of the gas cost can be seen as &lt;code&gt;1&lt;&#x2F;code&gt;x CALL cost + &lt;code&gt;N&lt;&#x2F;code&gt;x SLOAD cost. Hence, the gas cost specified for using EXTSLOAD opcode on an account for &lt;code&gt;N&lt;&#x2F;code&gt; times, the charge of &lt;code&gt;1&lt;&#x2F;code&gt;x &lt;code&gt;COLD_ACCOUNT_ACCESS_COST&lt;&#x2F;code&gt; and &lt;code&gt;N&lt;&#x2F;code&gt;x &lt;code&gt;STORAGE_READ_COST&lt;&#x2F;code&gt; is hereby justified.&lt;&#x2F;li&gt;
&lt;li&gt;Without this EIP, a contract can still use internal state of other contracts. An external party can supply a value and proof to a contract, which the contract can verify using &lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt;. This is only possible for the previous blocks and not the latest state (since current blockhash cannot be determined before execution).&lt;&#x2F;li&gt;
&lt;li&gt;This opcode can be seen as breaking object-oriented (OO) model because it allows to read storage of other contracts. In usual systems using OO is net positive, because there is no limit on machine code and it hardly adds any cost to add more methods or use single method to get a ton of data while the caller needs to just a small portion of data. However on EVM, there are visible costs, i.e. about $0.2 per SLOAD (20 gwei and ETHUSD 2000). Also, OO has caused misleading assumptions for developers where variables marked as &quot;private&quot; in smart contracts are encrypted in some way&#x2F;impossible to read which has resulted bad designs. Hence, this EIP can be beneficial in terms of making smart contract systems more efficient as well as preventing misconceptions as well.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is fully backwards compatible since it adds a new instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Since the opcode is similar to SLOAD, it should be easy to implement in various clients.&lt;&#x2F;li&gt;
&lt;li&gt;This opcode allows the callee &lt;code&gt;A&lt;&#x2F;code&gt; to re-enter a caller contract &lt;code&gt;B&lt;&#x2F;code&gt; and read state of &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;B&lt;&#x2F;code&gt; cannot stop &lt;code&gt;A&lt;&#x2F;code&gt; from doing that. Since this does not change any state, it should not be a security issue. Contracts generally use re-entrancy guards, but that is only added to write methods. So even currently without EXTSLOAD, &lt;code&gt;A&lt;&#x2F;code&gt; can re-enter &lt;code&gt;B&lt;&#x2F;code&gt; and read their state exposed by any view methods and it has not been an issue.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>BEGINDATA opcode</title>
        <published>2019-10-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Lundfall</name><uri>https://github.com/MrChico</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2327/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/new-opcode-begindata/3727" />
        

        <id>https://wg-eips.ritovision.com/2327/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2327"
            label="EIP-2327" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2327/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduces a new opcode &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt;, which indicates that the remaining bytes of the contract should be regarded as data rather than contract code
and cannot be executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It is common for smart contracts to efficiently store data directly in the contract bytecode. Examples include constructor arguments, constant variables, compiler metadata and the contract runtime during the init phase. Currently, such data is not distinguished from normal bytecode and is still being analysed for &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s by EVM interpreters. This EIP introduces a new opcode &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; at byte &lt;code&gt;0xb6&lt;&#x2F;code&gt;, which marks the remainding bytecode as data, indicating to EVM interpreters, static analysis tools and chain explorers that the remaining bytes do not represent opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; opcode has been suggested before as part of the EIP &lt;code&gt;Subroutines and Static Jumps for the EVM&lt;&#x2F;code&gt; &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt; as a way to determine the position of jumptables in contract bytecode. It is here introduced in its own right in order to exclude data from the &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; analysis of contracts, making it impossible to jump to data. This makes it easier for static analysis tools to analyse contracts, allows disassemblers, chain explorers and debuggers to not display data as a mess of INVALID opcodes and may even provide a marginal improvement in performance. It also helps scalability because it improves on-chain evaluation of transactions from other chains in that the validation that the code conforms to a certain pattern does not need to do a full jumpdest analysis to see that data is not executed and thus does not have to conform to the pattern (used by the optimism project). Additionally, it paves the way for suggestions such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1712&quot;&gt;EIP-1712&lt;&#x2F;a&gt; to disallow unused opcodes, jumptables &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt; and speculative proposals to disallow for deployment of contracts with stack usage violations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;While computing the valid &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt;s of a contract, halt analysis once the first &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; is encountered. In other words: A jump to any codelocation equal to or greater than the location of the first &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; causes a &lt;code&gt;BAD_JUMP_DESTINATION&lt;&#x2F;code&gt; error.
If &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; is encountered during contract execution, it has the same semantics as &lt;code&gt;STOP&lt;&#x2F;code&gt;. It uses 0 gas.&lt;&#x2F;p&gt;
&lt;p&gt;Bytes past &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; remain accessible via &lt;code&gt;CODECOPY&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt;. &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; does not influence &lt;code&gt;CODESIZE&lt;&#x2F;code&gt; or &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The byte &lt;code&gt;0xb6&lt;&#x2F;code&gt; was chosen to align with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;615&#x2F;&quot;&gt;EIP-615&lt;&#x2F;a&gt;.
The choice to &lt;code&gt;STOP&lt;&#x2F;code&gt; if &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; is encountered is somewhat arbitrary. An alternative would be to be to abort the execution with an out-of-gas error.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal will not change any existing contracts unless their current behaviour relies upon the usage of unused opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;Since contracts have been using data from the very start, in a sense all of them use unused opcodes,
but they would have to use data in a way that it is skipped during execution and jumped over.
The Solidity compiler never generated such code. It has to be evaluated whether contracts created by other means
could have such a code structure.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases should include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;A contract which jumps to a destination &lt;code&gt;X&lt;&#x2F;code&gt;, where &lt;code&gt;X&lt;&#x2F;code&gt; has a pc value higher than the &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; opcode, and the byte at &lt;code&gt;X&lt;&#x2F;code&gt; is &lt;code&gt;0x5b&lt;&#x2F;code&gt;. This should fail with a &lt;code&gt;BAD_JUMP_DESTINATION&lt;&#x2F;code&gt; error.&lt;&#x2F;li&gt;
&lt;li&gt;A contract which encounters the &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; opcode (should stop executing the current call frame)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple Subroutines for the EVM</title>
        <published>2019-10-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><uri>https://github.com/gcolvin</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>John Max Skaller</name><email>skaller@internode.on.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2315/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2315-simple-subroutines-for-the-evm/3941" />
        

        <id>https://wg-eips.ritovision.com/2315/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2315"
            label="EIP-2315" />
        

        
        

        
        <summary type="html">Two opcodes for efficient, safe, and static subroutines.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2315/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal provides a &lt;em&gt;complete&lt;&#x2F;em&gt;, &lt;em&gt;efficient&lt;&#x2F;em&gt;, &lt;em&gt;safe&lt;&#x2F;em&gt; and &lt;em&gt;static&lt;&#x2F;em&gt; control-flow facility.&lt;&#x2F;p&gt;
&lt;p&gt;It introduces two new opcodes to support calling and returning from subroutines:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMPSUB relative_offset&lt;&#x2F;code&gt; -- relative jump to subroutine&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; -- return to &lt;code&gt;PC&lt;&#x2F;code&gt; after most recent &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It depends on the two new opcodes proposed by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;4200&#x2F;&quot;&gt;EIP-4200&lt;&#x2F;a&gt; to support static jumps:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RJUMP relative_offset&lt;&#x2F;code&gt; — relative jump to &lt;code&gt;PC + relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RJUMPI relative_offset&lt;&#x2F;code&gt; — conditional relative jump&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;It deprecates &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt;, allowing valid code to support streaming, one-pass, and other near-linear compilers.&lt;&#x2F;p&gt;
&lt;p&gt;In concert with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3540&#x2F;&quot;&gt;EIP-3540&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3670&#x2F;&quot;&gt;EIP-3670&lt;&#x2F;a&gt; it ensures, at initialization time, that valid code will not execute invalid instructions or jump to invalid locations, will not underflow stack, will maintain consistent numbers of inputs and outputs for subroutines, and will have bounded stack height in the absence of recursion.&lt;&#x2F;p&gt;
&lt;p&gt;This is among the simplest possible proposals that meets these requirements.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;a-complete-control-flow-facility&quot;&gt;A complete control-flow facility.&lt;&#x2F;h3&gt;
&lt;p&gt;Jumps, conditional jumps and subroutines were proposed by Alan Turing in 1945 as a means of organizing the logic of the code and the design of the memory crystals for his Automatic Computing Engine:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;We wish to be able to arrange that sequences of orders can divide at various points, continuing in different ways according to the outcome of the calculations to date...  We also wish to be able to arrange for the splitting up of operations into subsidiary operations... To start on a subsidiary operation we need only make a note of where we left off the major operation and then apply the first instruction of the subsidiary.  When the subsidiary is over we look up the note and continue with the major operation.&lt;&#x2F;p&gt;
&lt;p&gt;— Alan Turing — in B.E. Carpenter, R.W. Doran, &quot;The other Turing machine.&quot; The Computer Journal, Volume 20, Issue 3, January 1977.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In more contemporary terms, we have sequences of instructions, jumps and conditional jumps that divide sequences into blocks, subroutine calls, and a stack of addresses to return to.  The details vary, but similar facilities have proven their value across a long line of important machines over the last 75 years, including most all of the machines we have programmed or implemented -- physical machines including the Burroughs 5000, CDC 7600, IBM 360, DEC PDP-11 and VAX, Motorola 68000, Sun SPARC, and Intel x86s, as well as virtual machines for Scheme, Forth, Pascal, Java, Wasm, and others.&lt;&#x2F;p&gt;
&lt;p&gt;Unlike these machines, the Ethereum Virtual Machine &lt;em&gt;does not&lt;&#x2F;em&gt; provide subroutine operations. Instead, they must be synthesized using the dynamic &lt;code&gt;JUMP&lt;&#x2F;code&gt; instruction, which takes its destination on the stack. Further, the EVM provides &lt;em&gt;only&lt;&#x2F;em&gt; dynamic jumps, impeding the static analysis we need.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;efficient-control-flow&quot;&gt;Efficient control-flow.&lt;&#x2F;h3&gt;
&lt;p&gt;Efficient to write by hand, compile from high level labguages, validate at deploy time, interpret by VMs, and compile to machine code.&lt;&#x2F;p&gt;
&lt;p&gt;Static jumps, conditional jumps, and subroutines are sufficient and efficient in space and time, as shown by historical experience and as we will show for the EVM below.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;safe-control-flow&quot;&gt;Safe control-flow.&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM has unusually high requirements for safety.  Not only do many smart contracts control inordinately large amounts of valuable Ether, but once placed on the blockchain any defects are visible to attackers and cannot be repaired.  We propose to statically validate important safety constraints on code at initialization time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;static-control-flow&quot;&gt;Static control-flow.&lt;&#x2F;h3&gt;
&lt;p&gt;The EVM&#x27;s dynamic jumps cause two major problems. First, the need to synthesize static jumps and subroutines with dynamic jumps wastes space and gas with needlessly complex code, as we will show below.&lt;&#x2F;p&gt;
&lt;p&gt;Worse, jumps that can dynamically branch to any destination in the code can cause quadratic &quot;path explosions&quot; when traversing the flow of control. For Ethereum, this is a denial-of-service vulnerability that prevents us, at initialization time, from validating the safe use of EVM code and from compiling EVM code to machine code.&lt;&#x2F;p&gt;
&lt;p&gt;We &lt;em&gt;need&lt;&#x2F;em&gt; static control-flow to validate program safety and to compile EVM bytecode to machine code -- in time and space linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;opcodes&quot;&gt;Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rjumpsub-0x5f-relative-offset&quot;&gt;&lt;code&gt;RJUMPSUB (0x5f) relative_offset&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Transfers control to a subroutine.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Decode the &lt;code&gt;relative_offset&lt;&#x2F;code&gt; from the immediate data at &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Push the current &lt;code&gt;PC + 3&lt;&#x2F;code&gt; to the &lt;code&gt;return stack&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Set &lt;code&gt;PC&lt;&#x2F;code&gt; to &lt;code&gt;PC + relative_offset&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The &lt;code&gt;relative_offset&lt;&#x2F;code&gt; is relative to the current &lt;code&gt;PC&lt;&#x2F;code&gt;. The offset is encoded as a two-byte, twos-complement signed integer, stored MSB-first.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost is &lt;em&gt;low&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;returnsub-0x5e&quot;&gt;&lt;code&gt;RETURNSUB (0x5e)&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Returns control to the caller of a subroutine.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; to &lt;code&gt;PC&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost is &lt;em&gt;verylow&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Notes:&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Values popped off the &lt;code&gt;return stack&lt;&#x2F;code&gt; do not need to be validated, since they are alterable only by &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;.&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;The description above lays out the semantics of these instructions in terms of a &lt;code&gt;return stack&lt;&#x2F;code&gt;.  But the actual state of the &lt;code&gt;return stack&lt;&#x2F;code&gt; is not observable by EVM code or consensus-critical to the protocol.  (For example, a node implementer may code &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; to unobservably push &lt;code&gt;PC&lt;&#x2F;code&gt; on the &lt;code&gt;return stack&lt;&#x2F;code&gt; rather than &lt;code&gt;PC + 1&lt;&#x2F;code&gt;, which is allowed so long as &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; observably returns control to the &lt;code&gt;PC + 3&lt;&#x2F;code&gt; location.)&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;em&gt;Execution&lt;&#x2F;em&gt; is defined in the Yellow Paper as a sequence of changes in the EVM state.  The conditions on valid code are preserved by state changes.  At runtime, if execution of an instruction would violate a condition the execution is in an exceptional halting state.  The Yellow Paper defines six such states.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Insufficient gas&lt;&#x2F;li&gt;
&lt;li&gt;More than 1024 stack items&lt;&#x2F;li&gt;
&lt;li&gt;State modification during a static call&lt;&#x2F;li&gt;
&lt;li&gt;Insufficient stack items&lt;&#x2F;li&gt;
&lt;li&gt;Invalid jump destination&lt;&#x2F;li&gt;
&lt;li&gt;Invalid instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;We would like to consider EVM code valid iff no execution of the program can lead to an exceptional halting state.  In practice, we must test at runtime for the first three conditions.  We don’t know how much gas there will be, we don’t know how deep a recursion may go, analysis of stack depth even for non-recursive programs is nontrivial, and we don&#x27;t know whether a call will be static.  All of the remaining conditions MUST be validated statically, in time and space quasi-linear in the size of the code.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;static-constraints-on-valid-code&quot;&gt;Static Constraints on Valid Code&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Every instruction MUST be valid:
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions ARE NOT valid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Every jump MUST be valid:
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt;, or &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; instructions MUST NOT address immediate data or addresses outside of their code section.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The stacks MUST be valid:
&lt;ul&gt;
&lt;li&gt;The number of items on the &lt;code&gt;data stack&lt;&#x2F;code&gt; MUST always be positive.&lt;&#x2F;li&gt;
&lt;li&gt;The number of items on the &lt;code&gt;return stack &lt;&#x2F;code&gt;MUST always be positive.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The data stack MUST be consistently aligned:
&lt;ul&gt;
&lt;li&gt;The data stack height is
&lt;ul&gt;
&lt;li&gt;the absolute difference between the current &lt;code&gt;stack pointer&lt;&#x2F;code&gt; and the &lt;code&gt;stack pointer&lt;&#x2F;code&gt; on entry to the current subroutine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It MUST be the same for every reachable path through a given &lt;code&gt;PC&lt;&#x2F;code&gt; and&lt;&#x2F;li&gt;
&lt;li&gt;MUST NOT exceed 1024.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This is a purely semantic specification, placing no constraints on the syntax of code sections beyond being a sequence of opcodes and immediate data – a subroutine is not a contiguous sequence of bytecode, it is a subgraph of the bytecode&#x27;s control-flow graph.  The EVM is a simple state machine.  We only promise that valid code will not, as it were, jam up the gears of the machine.&lt;&#x2F;p&gt;
&lt;p&gt;By avoiding syntactic constraints we allow for optimizations like tail call elimination, multiple-entry subroutines, moving &quot;cold&quot; code out of line, and other ways of reducing redundancy and keeping &quot;hot&quot; code in cache.   Since we wish to support one-pass compilation of EVM code to machine code it is crucial that the EVM code be as well optimized as possible up front.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Rather than enforce constraints via syntax, we enforce them via validation.&lt;&#x2F;p&gt;
&lt;p&gt;The constraints on valid code cover all of the exceptional halting states that we can validate and allow code to be validated and compiled in time and space quasi-linear in the size of the code.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;RJUMP&lt;&#x2F;code&gt;, &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; and &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; instructions take their &lt;em&gt;relative_offset&lt;&#x2F;em&gt; as immediate arguments, which cannot change at runtime.  Having constant destinations for all jumps means that all jump destinations can be validated at initialization time, not runtime.  Dynamic jumps can branch to any destination in the code, so exploitable quadratic &quot;path explosions&quot; are possible when traversing the control flow graph. Deprecating &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; prevents this.&lt;&#x2F;p&gt;
&lt;p&gt;Requiring a consistently aligned &lt;code&gt;data stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;prevents stack underflow&lt;&#x2F;li&gt;
&lt;li&gt;ensures that all calls to a subroutine have the same number of inputs and the same number of outputs and&lt;&#x2F;li&gt;
&lt;li&gt;ensures that stack height is bounded in the absence of recursion.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Requiring a consistently aligned &lt;code&gt;data stack&lt;&#x2F;code&gt; also allows some algorithms that traverse the control-flow graph -- including code validation and compilation -- to break cycles at joins, again preventing quadratic path explosion.  When a traversal gets to a &lt;code&gt;PC&lt;&#x2F;code&gt; it has visited before it is either at the beginning of a loop or the entry to a function.  Since the stack height at that &lt;code&gt;PC&lt;&#x2F;code&gt; is constant we know that loops will not grow stack, and that the number of arguments to a subroutine will always be the same -- there may be no need to traverse that path again.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: The JVM and Wasm enforce similar constraints for similar reasons.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternative-designs&quot;&gt;Alternative Designs&lt;&#x2F;h3&gt;
&lt;p&gt;There are a few major designs for a subroutine facility, two of which are considered here.  The others are mostly not appropriate for the EVM, such as the Wheeler Jump -- self-modifying code that writes return addresses into called subroutines.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;1. Keep return addresses on a dedicated return stack.&lt;&#x2F;em&gt; Turing&#x27;s design is often used by stack machines, including those for Forth, Java, Wasm, and others.  The data stack is used for computation, with a dedicated stack for return addresses.  A single instruction suffices to call, and another to return from a routine.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;2. Keep return addresses on the data stack.&lt;&#x2F;em&gt;  This design is often used by register machines, including those from CDC, IBM, DEC, Intel, and ARM.  The registers are used primarily for computation, and the stack maintains call frames for return addresses, arguments, and local variables.  On the EVM there are no registers for computation, so using the stack for both purposes can cause the sort of inefficiencies we see below.  Pascal p-code does use this design, but as part of a complex calling convention with dedicated registers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;we-prefer-the-dedicated-return-stack&quot;&gt;We prefer the dedicated return stack.&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;It maintains a clear separation between calculation and flow of control:
&lt;ul&gt;
&lt;li&gt;the data stack is free of vulnerable return addresses and&lt;&#x2F;li&gt;
&lt;li&gt;it&#x27;s impossible to overwrite the return stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It improves efficiency:
&lt;ul&gt;
&lt;li&gt;it uses native arithmetic rather than 256-bit EVM instructions for the return address,&lt;&#x2F;li&gt;
&lt;li&gt;doesn&#x27;t use up a &lt;code&gt;data stack&lt;&#x2F;code&gt; slot for the return address and&lt;&#x2F;li&gt;
&lt;li&gt;needs less motion of 256-bit data on the stack.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;efficiency&quot;&gt;Efficiency&lt;&#x2F;h3&gt;
&lt;p&gt;We illustrate here how subroutine instructions can be used to reduce the complexity and gas costs of both ordinary and optimized subroutine calls compared to using &lt;code&gt;JUMP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;simple-subroutine-call&quot;&gt;&lt;strong&gt;Simple Subroutine Call&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Consider these examples of a fairly minimal subroutine, including the code to call it.&lt;&#x2F;p&gt;
&lt;p&gt;Subroutine call, using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    returnsub       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rjumpsub SQUARE ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total gas: 19&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Subroutine call, using &lt;code&gt;JUMP&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push RTN_CALL:  ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE     ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;RTN_CALL:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total: 41 gas&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; versus &lt;code&gt;JUMP&lt;&#x2F;code&gt; saves &lt;em&gt;41 - 19 = 22 gas&lt;&#x2F;em&gt; — a &lt;em&gt;54%&lt;&#x2F;em&gt; improvement.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tail-call-optimization&quot;&gt;&lt;strong&gt;Tail Call Optimization&lt;&#x2F;strong&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;Of course in cases like this one we can optimize the tail call, so that the return from &lt;code&gt;SQUARE&lt;&#x2F;code&gt; actually returns from &lt;code&gt;TEST_SQUARE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Tail call optimization, using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    returnsub       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rjump SQUARE    ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total: 17 gas&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Tail call optimization, using &lt;code&gt;JUMP&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap1           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dup1            ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    mul             ; 5 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    swap2           ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;CALL_SQUARE:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jumpdest        ; 1 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push 0x02       ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    push SQUARE     ; 3 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    jump            ; 8 gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;Total: 38 gas&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; versus &lt;code&gt;JUMP&lt;&#x2F;code&gt; saves &lt;em&gt;38 - 17 = 21 gas&lt;&#x2F;em&gt; — a &lt;em&gt;55%&lt;&#x2F;em&gt; improvement.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;efficiency-caveats&quot;&gt;Efficiency Caveats&lt;&#x2F;h4&gt;
&lt;p&gt;We can see that these instructions provide a simpler and more gas-efficient subroutine mechanism than using &lt;code&gt;JUMP&lt;&#x2F;code&gt; — in our examples they cut gas use by about half.&lt;&#x2F;p&gt;
&lt;p&gt;Clearly, the benefits of this efficiency are greater for programs that have been factored into smaller subroutines.  How small?  Wrapping code in a subroutine costs only &lt;em&gt;8 gas&lt;&#x2F;em&gt; using &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; versus &lt;em&gt;30 gas&lt;&#x2F;em&gt; using &lt;code&gt;JUMP&lt;&#x2F;code&gt;, &lt;code&gt;PUSH&lt;&#x2F;code&gt; and &lt;code&gt;SWAP&lt;&#x2F;code&gt; as above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;costs&quot;&gt;Costs&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;em&gt;low&lt;&#x2F;em&gt; cost of &lt;code&gt;RJUMPSUB&lt;&#x2F;code&gt; versus the &lt;em&gt;mid&lt;&#x2F;em&gt; cost of &lt;code&gt;JUMP&lt;&#x2F;code&gt; is justified by needing only to decode the immediate two byte destination to the &lt;code&gt;PC&lt;&#x2F;code&gt; and push the return address on the &lt;code&gt;return stack&lt;&#x2F;code&gt;, all using native arithmetic, versus using the data stack with emulated 256-bit instructions.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;em&gt;verylow&lt;&#x2F;em&gt; cost of &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; is justified by needing only to pop the &lt;code&gt;return stack&lt;&#x2F;code&gt; into the &lt;code&gt;PC&lt;&#x2F;code&gt;.  Benchmarking will be needed to tell if the costs are well-balanced.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes affect the semantics of existing EVM code: bytes that would have been interpreted as valid jump destinations may now be interpreted as immediate data.  Since this proposal depends on the Ethereum Object Format to signal the change this is not a practical issue.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;simple-routine&quot;&gt;Simple routine&lt;&#x2F;h3&gt;
&lt;p&gt;This should jump into a subroutine, back out and stop.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5f0003005e&lt;&#x2F;code&gt; (&lt;code&gt;RJUMPSUB 3, RETURNSUB, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Output: 0x
Consumed gas: &lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;two-levels-of-subroutines&quot;&gt;Two levels of subroutines&lt;&#x2F;h3&gt;
&lt;p&gt;This should execute fine, going into one two depths of subroutines&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5f00045F00025200&lt;&#x2F;code&gt; (&lt;code&gt;RJUMPSUB 4, RJUMPSUB 2, RETURNSUB, RETURNSUB, STOP&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;failure-1-invalid-jump&quot;&gt;Failure 1: invalid jump&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail, since the given location is outside of the code-range.&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0X5fff&lt;&#x2F;code&gt;(&lt;code&gt;RJUMPSUB -1&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=0, op=RJUMPSUB: invalid jump destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;failure-2-shallow-return-stack&quot;&gt;Failure 2: shallow &lt;code&gt;return stack&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This should fail at first opcode, due to shallow &lt;code&gt;return_stack&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5e&lt;&#x2F;code&gt; (&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Error: at pc=0, op=RETURNSUB: invalid retsub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;subroutine-at-end-of-code&quot;&gt;Subroutine at end of code&lt;&#x2F;h3&gt;
&lt;p&gt;In this example the RJUMPSUB is on the last byte of code. When the subroutine returns, it should hit the &#x27;virtual stop&#x27; &lt;em&gt;after&lt;&#x2F;em&gt; the bytecode, and not exit with error&lt;&#x2F;p&gt;
&lt;p&gt;Bytecode: &lt;code&gt;0x5c00045e5fffff&lt;&#x2F;code&gt; (&lt;code&gt;RJUMP 4, RETURNSUB, RJUMPSUB -1&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pc&lt;&#x2F;th&gt;&lt;th&gt;Op&lt;&#x2F;th&gt;&lt;th&gt;Cost&lt;&#x2F;th&gt;&lt;th&gt;Stack&lt;&#x2F;th&gt;&lt;th&gt;RStack&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;RJUMP&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;RETURNSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;RJUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;td&gt;STOP&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;td&gt;[]&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Consumed gas: &lt;code&gt;15&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following is a pseudo-Python implementation of an algorithm for predicating code validity.  An equivalent algorithm must be run at initialization time.&lt;&#x2F;p&gt;
&lt;p&gt;This algorithm performs a symbolic execution of the program that recursively traverses the &lt;em&gt;code&lt;&#x2F;em&gt;, emulating its control flow and stack use and checking for violations of the rules above.&lt;&#x2F;p&gt;
&lt;p&gt;It runs in time equal to &lt;code&gt;O(vertices + edges)&lt;&#x2F;code&gt; in the program&#x27;s control-flow graph, where edges represent control flow and the vertices represent &lt;em&gt;basic blocks&lt;&#x2F;em&gt; — thus the algorithm takes time proportional to the size of the &lt;em&gt;code&lt;&#x2F;em&gt;. It maintains a stack of continuations for conditional jumps, the size of which is at most proportional to the size of the &lt;em&gt;code&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation-function&quot;&gt;Validation Function&lt;&#x2F;h3&gt;
&lt;p&gt;** Note: this function is known to be incomplete and incorrect. **&lt;&#x2F;p&gt;
&lt;p&gt;For simplicity&#x27;s sake we assume that all jumpdest analysis and prior validation has been done, including EIP-3540, EIP-3670, and EIP-4200, so EOF headers and sections are well-formed, and there are no invalid instructions or jumps.  In practice, all passes of validation can be folded into a single loop no recursion.&lt;&#x2F;p&gt;
&lt;p&gt;We also assume some helper functions.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;is_valid(opcode)&lt;&#x2F;code&gt; returns true iff opcode is valid.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;is_terminator(opcode)&lt;&#x2F;code&gt; returns true iff opcode is terminator.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;is_valid_jumpdest(pc)&lt;&#x2F;code&gt; returns true iff &lt;code&gt;pc&lt;&#x2F;code&gt; is a valid jump destination.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediate_data(pc)&lt;&#x2F;code&gt; returns the immediate data for the instruction at &lt;code&gt;pc&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;immediate_size(opcode)&lt;&#x2F;code&gt; returns the size of the immediate data for an opcode.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;removed_items(opcode)&lt;&#x2F;code&gt; returns the number of items removed from the &lt;code&gt;data_stack&lt;&#x2F;code&gt; by the &lt;code&gt;opcode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;added_items(opcode)&lt;&#x2F;code&gt; returns the number of items added to the &lt;code&gt;data_stack&lt;&#x2F;code&gt; by the &lt;code&gt;opcode&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# returns true iff code is valid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def validate_code(code: bytes, pc: int, sp: int, bp: int) -&amp;gt; boolean:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    continuations = []&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    do&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while pc &amp;lt; len(code):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            opcode = code[pc]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if !is_valid(opcode):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if is_terminator(opcode):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # check stack height and return if we have been here before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stack_height = sp - bp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if stack_height &amp;gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if pos in stack_heights:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if stack_height != stack_heights[pos]:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            else:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                stack_heights[pos] = stack_height&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if opcode == RJUMP:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # reset pc to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = immediate_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc += jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !is_valid_jumpdest(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RJUMPI:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = pc + immediate_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !is_valid_jumpdest(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # continue true side of conditional later&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continations.push((jumpdest, sp, bp))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # continue false side of conditional now&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RJUMPSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # will enter subroutine at destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bp = sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # push return address and reset pc to destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                jumpdest = pc + immediate_data(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if !is_valid_jumpdest(pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                push(return_stack, pc + 3)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = jumpdest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            elif opcode == RETURNSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # will return to subroutine at destination&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bp = sp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                # pop return address and check for preceding call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                pc = pop(return_stack)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if code[pc - 3] != RJUMPSUB:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                   return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # apply instructions to stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp -= removed_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if sp &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sp += added_items(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            # Skip opcode and immediate data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            pc += 1 + immediate_size(opcode)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while (pc, sp, bp) = continuations.pop()&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;These changes introduce new flow control instructions.  They do not introduce any new security considerations. This EIP is intended to improve security by validating a higher level of safety for EVM code deployed on the blockchain.  The validation algorithm must be quasi-linear in time and space to not be a denial of service vulnerability.  The algorithm here makes one linear-time pass of the bytecode, and uses a stack of continuations that cannot exceed the number of &lt;code&gt;RJUMPI&lt;&#x2F;code&gt; instructions in the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction Postdata</title>
        <published>2019-08-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>John Adler</name><uri>https://github.com/adlerjohn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2242/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2242-transaction-postdata/3557" />
        

        <id>https://wg-eips.ritovision.com/2242/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2242"
            label="EIP-2242" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2242/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;An additional, optional transaction field is added for &quot;postdata,&quot; data that is posted on-chain but that cannot be read from the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A paradigm shift in how blockchains are used has been seen recently in Eth 2.0, with the rise of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;w1Pn2iMmSTqCmVUTGV4T5A?view&quot;&gt;&lt;em&gt;Execution Environments&lt;&#x2F;em&gt;&lt;&#x2F;a&gt; (EEs), and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;the-stateless-client-concept&#x2F;172&quot;&gt;&lt;em&gt;stateless clients&lt;&#x2F;em&gt;&lt;&#x2F;a&gt;. This shift involves blockchains serving as a secure data availability and arbitration layer, &lt;em&gt;i.e.&lt;&#x2F;em&gt;, they provide a globally-accepted source of available data, and process fraud&#x2F;validity and data availability proofs. This same paradigm can be applied on Eth 1.x, replacing EEs with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;building-scalable-decentralized-payment-systems-request-for-feedback&#x2F;5312&quot;&gt;trust-minimized side chains&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt; provides a reduction in gas cost of calldata, and is a step in the right direction of encouraging use of history rather than state, the EVM does not actually need to see all data that is posted on-chain. Following the principle of &quot;don&#x27;t pay for what you don&#x27;t use,&quot; a distinct way of posting data on-chain, but without actually being usable within the EVM, is needed.&lt;&#x2F;p&gt;
&lt;p&gt;For &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;minimal-viable-merged-consensus&#x2F;5617&quot;&gt;trust-minimized side chains with fraud proofs&lt;&#x2F;a&gt;, we simply need to ensure that the side chain block proposer has attested that &lt;em&gt;some&lt;&#x2F;em&gt; data is available. Authentication can be performed as part of a fraud proof should that data end up invalid. Note that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;on-chain-scaling-to-potentially-500-tx-sec-through-mass-tx-validation&#x2F;3477&quot;&gt;trust-minimized side chains with validity proofs&lt;&#x2F;a&gt; can&#x27;t make use of the changes proposed in this EIP, as they required immediate authentication of the posted data. This will be &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;multi-threaded-data-availability-on-eth-1&#x2F;5899&quot;&gt;the topic of a future EIP&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We propose a consensus modification, beginning at &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;p&gt;An additional optional field, &lt;code&gt;postdata&lt;&#x2F;code&gt;, is added to transactions. Serialized transactions now have the format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;from&amp;quot;: bytes20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;to&amp;quot;: bytes20,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;startGas&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;gasPrice&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;value&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;data&amp;quot;: bytes,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;quot;nonce&amp;quot;: uint256,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&amp;quot;postdata&amp;quot;: bytes],&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with witnesses signing over the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;RLP&quot;&gt;RLP encoding&lt;&#x2F;a&gt; of the above. &lt;code&gt;postdata&lt;&#x2F;code&gt; is data that is posted on-chain, for later historical retrieval by layer-2 systems.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;postdata&lt;&#x2F;code&gt; is an RLP-encoded twople &lt;code&gt;(version: uint64, data: bytes)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;version&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&lt;&#x2F;code&gt; is an RLP-encoded list of binary data. This EIP does not interpret the data in any way, simply considering it as a binary blob, though future EIPs may introduce different interpretation schemes for different values of &lt;code&gt;version&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost of the posted data is &lt;code&gt;1 gas per byte&lt;&#x2F;code&gt;. This cost is deducted from the &lt;code&gt;startGas&lt;&#x2F;code&gt;; if the remaining gas is non-positive the transaction immediately reverts with an out of gas exception.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The changes proposed are as minimal and non-disruptive to the existing EVM and transaction format as possible while also supporting possible &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;multi-threaded-data-availability-on-eth-1&#x2F;5899&quot;&gt;future extensions&lt;&#x2F;a&gt; through a version code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The new transaction format is backwards compatible, as the new &lt;code&gt;postdata&lt;&#x2F;code&gt; field is optionally appended to existing transactions.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed changes are not forwards-compatible, and will require a hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Structured Definitions for Net Gas Metering</title>
        <published>2019-07-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2200/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/sorpaas/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/2200/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:2200"
            label="EIP-2200" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2200/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This is an EIP that implements net gas metering. It&#x27;s a combined
version of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1706&#x2F;&quot;&gt;EIP-1706&lt;&#x2F;a&gt;, with a structured definition so as
to make it interoperable with other gas changes such as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP provides a structured definition of net gas metering changes
for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode, enabling new usages for contract storage, and
reducing excessive gas costs where it doesn’t match how most
implementation works.&lt;&#x2F;p&gt;
&lt;p&gt;This is a combination of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1706&#x2F;&quot;&gt;EIP-1706&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a way for gas metering on &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, using information
that is more universally available to most implementations, and
require as little change in implementation structures as possible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Storage slot’s original value.&lt;&#x2F;li&gt;
&lt;li&gt;Storage slot’s current value.&lt;&#x2F;li&gt;
&lt;li&gt;Refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Usages that benefits from this EIP’s gas reduction scheme includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subsequent storage write operations within the same call frame. This
includes reentry locks, same-contract multi-send, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Exchange storage information between sub call frame and parent call
frame, where this information does not need to be persistent outside
of a transaction. This includes sub-frame error codes and message
passing, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The original definition of EIP-1283 created a danger of a new kind of
reentrancy attacks on existing contracts as Solidity by default grants
a &quot;stipend&quot; of 2300 gas to simple transfer calls. This danger is
easily mitigated if &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is not allowed in low gasleft state,
without breaking the backward compatibility and the original intention
of EIP-1283.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP also replaces the original EIP-1283 value definitions of gas
by parameters, so that it&#x27;s more structured, and easier to define
changes in the future.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Define variables &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; and
&lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt;. The old and new values for those variables
are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;: changed from &lt;code&gt;200&lt;&#x2F;code&gt; to &lt;code&gt;800&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt;: &lt;code&gt;20000&lt;&#x2F;code&gt;, not changed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt;: &lt;code&gt;5000&lt;&#x2F;code&gt;, not changed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt;: &lt;code&gt;15000&lt;&#x2F;code&gt;, not changed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Change the definition of EIP-1283 using those variables. The new
specification, combining EIP-1283 and EIP-1706, will look like
below. The terms &lt;em&gt;original value&lt;&#x2F;em&gt;, &lt;em&gt;current value&lt;&#x2F;em&gt; and &lt;em&gt;new value&lt;&#x2F;em&gt; are
defined in EIP-1283.&lt;&#x2F;p&gt;
&lt;p&gt;Replace &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode gas cost calculation (including refunds) with
the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;gasleft&lt;&#x2F;em&gt; is less than or equal to gas stipend, fail the current
call frame with &#x27;out of gas&#x27; exception.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this is a no-op), &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt;
is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; does not equal &lt;em&gt;new value&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage slot has
not been changed by the current execution context)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, &lt;code&gt;SSTORE_SET_GAS&lt;&#x2F;code&gt; is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, &lt;code&gt;SSTORE_RESET_GAS&lt;&#x2F;code&gt; gas is deducted. If &lt;em&gt;new value&lt;&#x2F;em&gt; is
0, add &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; does not equal &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage
slot is dirty), &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; gas is deducted. Apply both of the
following clauses.
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;new value&lt;&#x2F;em&gt; is not
0), remove &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas from refund
counter.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;new value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;current value&lt;&#x2F;em&gt; is not
0), add &lt;code&gt;SSTORE_CLEARS_SCHEDULE&lt;&#x2F;code&gt; gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this storage slot is
reset)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, add &lt;code&gt;SSTORE_SET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; to
refund counter.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, add &lt;code&gt;SSTORE_RESET_GAS - SLOAD_GAS&lt;&#x2F;code&gt; gas to refund
counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;An implementation should also note that with the above definition, if
the implementation uses call-frame refund counter, the counter can go
negative. If the implementation uses transaction-wise refund counter,
the counter always stays positive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP mostly achieves what a transient storage tries to do
(&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1087&#x2F;&quot;&gt;EIP-1087&lt;&#x2F;a&gt; and &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1153&#x2F;&quot;&gt;EIP-1153&lt;&#x2F;a&gt;), but without the complexity of introducing the
concept of &quot;dirty maps&quot;, or an extra storage struct.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We don&#x27;t suffer from the optimization limitation of
EIP-1087. EIP-1087 requires keeping a dirty map for storage changes,
and implicitly makes the assumption that a transaction&#x27;s storage
changes are committed to the storage trie at the end of a
transaction. This works well for some implementations, but not for
others. After &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;658&#x2F;&quot;&gt;EIP-658&lt;&#x2F;a&gt;, an efficient storage cache implementation
would probably use an in-memory trie (without RLP encoding&#x2F;decoding)
or other immutable data structures to keep track of storage changes,
and only commit changes at the end of a block. For them, it is
possible to know a storage&#x27;s original value and current value, but
it is not possible to iterate over all storage changes without
incurring additional memory or processing costs.&lt;&#x2F;li&gt;
&lt;li&gt;It never costs more gas compared with the current scheme.&lt;&#x2F;li&gt;
&lt;li&gt;It covers all usages for a transient storage. Clients that are easy
to implement EIP-1087 will also be easy to implement this
specification. Some other clients might require a little bit extra
refactoring on this. Nonetheless, no extra memory or processing cost
is needed on runtime.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Regarding &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas cost and refunds, see Appendix for proofs of
properties that this EIP satisfies.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;em&gt;absolute gas used&lt;&#x2F;em&gt; (that is, actual &lt;em&gt;gas used&lt;&#x2F;em&gt; minus &lt;em&gt;refund&lt;&#x2F;em&gt;),
this EIP is equivalent to EIP-1087 for all cases.&lt;&#x2F;li&gt;
&lt;li&gt;For one particular case, where a storage slot is changed, reset to
its original value, and then changed again, EIP-1283 would move more
gases to refund counter compared with EIP-1087.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examine examples provided in EIP-1087&#x27;s Motivation (with &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; being
&lt;code&gt;200&lt;&#x2F;code&gt;):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0,
it will be charged &lt;code&gt;20000 + 200 - 19800 = 400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be
charged &lt;code&gt;20000 + 5 * 200 = 21000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a
transfer from B to C, with all accounts having nonzero starting and
ending balances, it will cost &lt;code&gt;5000 * 3 + 200 - 4800 = 10400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In order to keep in place the implicit reentrancy protection of
existing contracts, transactions should not be allowed to modify state
if the remaining gas is lower than the gas stipend given to
&quot;transfer&quot;&#x2F;&quot;send&quot; in Solidity. These are other proposed remediations
and objections to implementing them:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Drop EIP-1283 and abstain from modifying &lt;code&gt;SSTORE&lt;&#x2F;code&gt; cost
&lt;ul&gt;
&lt;li&gt;EIP-1283 is an important update&lt;&#x2F;li&gt;
&lt;li&gt;It was accepted and implemented on test networks and in clients.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add a new call context that permits LOG opcodes but not changes to state.
&lt;ul&gt;
&lt;li&gt;Adds another call type beyond existing regular&#x2F;staticcall&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Raise the cost of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; to dirty slots to &amp;gt;=2300 gas
&lt;ul&gt;
&lt;li&gt;Makes net gas metering much less useful.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the gas stipend
&lt;ul&gt;
&lt;li&gt;Makes the stipend almost useless.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Increase the cost of writes to dirty slots back to 5000 gas, but add
4800 gas to the refund counter
&lt;ul&gt;
&lt;li&gt;Still doesn’t make the invariant explicit.&lt;&#x2F;li&gt;
&lt;li&gt;Requires callers to supply more gas, just to have it refunded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add contract metadata specifying per-contract EVM version, and only
apply &lt;code&gt;SSTORE&lt;&#x2F;code&gt; changes to contracts deployed with the new version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement. No gas cost increase is
anticipated, and many contracts will see gas reduction.&lt;&#x2F;p&gt;
&lt;p&gt;Performing &lt;code&gt;SSTORE&lt;&#x2F;code&gt; has never been possible with less than 5000 gas, so
it does not introduce incompatibility to the Ethereum Mainnet. Gas
estimation should account for this requirement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;19200&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;4200&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;4200&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5812&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;1612&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40818&lt;&#x2F;td&gt;&lt;td&gt;19200&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10818&lt;&#x2F;td&gt;&lt;td&gt;19200&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-proof&quot;&gt;Appendix: Proof&lt;&#x2F;h2&gt;
&lt;p&gt;Because the &lt;em&gt;storage slot&#x27;s original value&lt;&#x2F;em&gt; is defined as the value
when a reversion happens on the &lt;em&gt;current transaction&lt;&#x2F;em&gt;, it&#x27;s easy to
see that call frames won&#x27;t interfere &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas calculation. So
although the below proof is discussed without call frames, it applies
to all situations with call frames. We will discuss the case
separately for &lt;em&gt;original value&lt;&#x2F;em&gt; being zero and not zero, and use
&lt;em&gt;induction&lt;&#x2F;em&gt; to prove some properties of &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Final value&lt;&#x2F;em&gt; is the value of a particular storage slot at the end of
a transaction. &lt;em&gt;Absolute gas used&lt;&#x2F;em&gt; is the absolute value of &lt;em&gt;gas used&lt;&#x2F;em&gt;
minus &lt;em&gt;refund&lt;&#x2F;em&gt;. We use &lt;code&gt;N&lt;&#x2F;code&gt; to represent the total number of &lt;code&gt;SSTORE&lt;&#x2F;code&gt;
operations on a storage slot. For states discussed below, refer to
&lt;em&gt;State Transition&lt;&#x2F;em&gt; in &lt;em&gt;Explanation&lt;&#x2F;em&gt; section.&lt;&#x2F;p&gt;
&lt;p&gt;Below we do the proof under the assumption that all parameters are
unchanged, meaning &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is &lt;code&gt;200&lt;&#x2F;code&gt;. However, note that the proof
still applies no matter how &lt;code&gt;SLOAD_GAS&lt;&#x2F;code&gt; is changed.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;original-value-being-zero&quot;&gt;Original Value Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up still being 0, we want to charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a non-zero value, we want to
charge &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt; gas, because it requires writing this
slot to disk.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state A. The first &lt;code&gt;SSTORE&lt;&#x2F;code&gt; can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state A: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state B: 20000 gas is deducted. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because
&lt;code&gt;20000 + 200 * (N-1) == 20000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From A to A. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From A to B. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to B. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to A. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 - 19800 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;original-value-not-being-zero&quot;&gt;Original Value Not Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up unchanged, we want to
charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being zero, we want to
charge &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt; gas. Note that &lt;code&gt;15000&lt;&#x2F;code&gt; is the
refund in actual definition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case III&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a changed non-zero
value, we want to charge &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case-1&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state X. The first &lt;code&gt;SSTORE&lt;&#x2F;code&gt; can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state X: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Y: 5000 gas is deducted. We satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt; because
&lt;code&gt;5000 + 200 * (N-1) == 5000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Z: The absolute gas used is &lt;code&gt;5000 - 15000&lt;&#x2F;code&gt; where 15000
is the refund. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because &lt;code&gt;5000 - 15000 + 200 * (N-1) == 5000 - 15000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step-1&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From X to X. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Y. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Z. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
absolute gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to X. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
absolute current gas cost is &lt;code&gt;200 - 4800 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Y. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Z. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current absolute gas cost is &lt;code&gt;200 - 15000 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to X. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 10200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Y. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 15000 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Z. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Particle gas costs for EVM opcodes</title>
        <published>2019-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Casey Detrio</name><uri>https://github.com/cdetrio</uri>
	</author>
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2045/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2045-fractional-gas-costs/3311" />
        

        <id>https://wg-eips.ritovision.com/2045/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2045"
            label="EIP-2045" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2045/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;According to recent benchmarks, EVM opcodes for computation (&lt;code&gt;ADD&lt;&#x2F;code&gt;, &lt;code&gt;SUB&lt;&#x2F;code&gt;, &lt;code&gt;MUL&lt;&#x2F;code&gt;, etc.) are generally overpriced relative to opcodes for storage I&#x2F;O (&lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, etc.). Currently the minimum gas cost is 1 (i.e. one unit of gas), and most computational opcodes have a cost near to 1 (e.g. 3, 5, or 8), so the range in possible cost reduction is limited. A new minimum unit of gas, called a &quot;particle&quot;, which is a fraction of 1 gas, would expand the range of gas costs and thus enable reductions below the current minimum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The transaction capacity of an Ethereum block is determined by the gas cost of transactions relative to the block gas limit. One way to boost the transaction capacity is to raise the block gas limit. Unfortunately, raising the block gas limit would also increase the rate of state growth, unless the costs of state-expanding storage opcodes (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, etc.) are simultaneously increased to the same proportion. Increasing the cost of storage opcodes may have adverse side effects, such as shifting the economic assumptions around gas fees of deployed contracts, or possibly breaking invariants in current contract executions (as mentioned in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2035&#x2F;&quot;&gt;EIP-2035&lt;&#x2F;a&gt;&lt;sup&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;#eip2035&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;, more research is needed on the potential effects of increasing the cost of storage opcodes).&lt;&#x2F;p&gt;
&lt;p&gt;Another way to boost the transaction capacity of a block is to reduce the gas cost of transactions. Reducing the gas costs of computational opcodes while keeping the cost of storage opcodes the same, is effectively equivalent to raising the block gas limit and simultaneously increasing the cost of storage opcodes. However, reducing the cost of computational opcodes might avoid the adverse side effects of an increase in cost of storage opcodes (again, more research is needed on this topic).&lt;&#x2F;p&gt;
&lt;p&gt;Currently, computational opcode costs are already too close to the minimum unit of 1 gas to achieve the large degree of cost reductions that recent benchmarks&lt;sup&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;#evmbenchmarks&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; indicate would be needed to tune opcode gas costs to the performance of optimized EVM implementations. A smaller minimum unit called a &quot;particle&quot;, which is a fraction (or subdivision) of 1 gas, would enable large cost reductions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new gas counter &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; is added to the EVM, in addition to the existing gas counter &lt;code&gt;gasUsed&lt;&#x2F;code&gt;. The unit 1 gas is equal to 10000 particles (&lt;code&gt;PARTICLES_PER_GAS&lt;&#x2F;code&gt;). The &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; counter is only increased for opcodes priced in particles (i.e. opcodes that cost less than 1 gas). If increasing &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; results in an excess of 1 gas, then 1 gas is added to &lt;code&gt;gasUsed&lt;&#x2F;code&gt; (and deducted from &lt;code&gt;particlesUsed&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Where the current gas logic looks like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vm_execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;ext&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize stack, memory, program counter, etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    compustate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Compustate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    codelen&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; codelen&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out of gas error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasLimit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; vm_exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OUT OF GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STOP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; peaceful_exit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SUB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The new gas logic using particles might look like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;PARTICLES_PER_GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; vm_execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;ext&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize stack, memory, program counter, etc&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    compustate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Compustate&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    codelen&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;code&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    while&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; codelen&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        opcode&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; code&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_fee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particle_fee&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; opcode&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particle_fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PARTICLES_PER_GAS&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; particlesUsed will be between 1 and 2 gas (over 10000 but under 20000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;                #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; remainder stays in particle counter&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;particlesUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; PARTICLES_PER_GAS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; out of gas error&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasUsed&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; compustate&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gasLimit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; vm_exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OUT OF GAS&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;STOP&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;span&gt; peaceful_exit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ADD&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SUB&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        elif&lt;&#x2F;span&gt;&lt;span&gt; op&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MUL&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; stk&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The above pseudocode is written for clarity. A more performant implementation might instead keep a single &lt;code&gt;particlesUsed&lt;&#x2F;code&gt; counter by multiplying opcode gas costs by 10000 and the &lt;code&gt;gasLimit&lt;&#x2F;code&gt; by 10000, and convert particles back to gas with &lt;code&gt;ceil(particlesUsed &#x2F; PARTICLES_PER_GAS)&lt;&#x2F;code&gt; at the end of execution. It may also be more performant to use a &lt;code&gt;PARTICLES_PER_GAS&lt;&#x2F;code&gt; ratio that is a power of 2 (such as 8192 or 16384) instead of 10000; the spec above is a draft and updates in response to feedback are expected.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;opcode-cost-changes&quot;&gt;Opcode cost changes&lt;&#x2F;h4&gt;
&lt;p&gt;Many computational opcodes will undergo a cost reduction, with new costs suggested by benchmark analyses. For example, the cost of &lt;code&gt;DUP&lt;&#x2F;code&gt; and &lt;code&gt;SWAP&lt;&#x2F;code&gt; are reduced from 3 gas to 3000 particles (i.e. 0.3 gas). The cost of &lt;code&gt;ADD&lt;&#x2F;code&gt; and &lt;code&gt;SUB&lt;&#x2F;code&gt; are reduced from 3 gas to 6000 particles. The cost of &lt;code&gt;MUL&lt;&#x2F;code&gt; is reduced from 5 gas to 5000 particles (i.e. 0.5 gas).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Adoption of fractional gas costs should only be an implementation detail inside the EVM, and not alter the current user experience around transaction gas limits and block gas limits. The concept of &lt;code&gt;particles&lt;&#x2F;code&gt; need not be exposed to Ethereum users nor most contract authors, but only to EVM implementers and contract developers concerned with optimized gas usage. Furthermore, only the EVM logic for charging gas per opcode executed should be affected by this change. All other contexts dealing with gas and gas limits, such as block headers and transaction formats, should be unaffected.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ewasm&quot;&gt;Ewasm&lt;&#x2F;h3&gt;
&lt;p&gt;The term &quot;particles&quot; was first introduced for Ewasm&lt;sup&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2045&#x2F;#particle&quot;&gt;3&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; to enable gas accounting for low cost wasm instructions, while remaining compatible with EVM gas costs. This EIP proposes introducing particles as a new minimum gas unit for EVM opcodes, and is not related to Ewasm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires a hard fork to be activated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a name=&quot;eip2035&quot;&gt;1&lt;&#x2F;a&gt;. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2035&#x2F;&quot;&gt;EIP-2035&lt;&#x2F;a&gt;: Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;evmbenchmarks&quot;&gt;2&lt;&#x2F;a&gt;. https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;benchmarking&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a name=&quot;particle&quot;&gt;3&lt;&#x2F;a&gt;. The term &quot;particle&quot; was inspired by a proposal for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;design&#x2F;blob&#x2F;e77d8e3de42784f40a803a23f58ef06881142d9f&#x2F;determining_wasm_gas_costs.md&quot;&gt;Ewasm gas costs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduced gas cost for static calls made to precompiles</title>
        <published>2019-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2046/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2046-reduced-gas-cost-for-static-calls-made-to-precompiles/3291" />
        

        <id>https://wg-eips.ritovision.com/2046/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2046"
            label="EIP-2046" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2046/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This change reduces the gas cost of using precompiled contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the base gas cost of calling precompiles using &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; from 700 to 40. This should allow more efficient use of precompiles as well as precompiles with a total cost below 700.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Spurious Dragon hard fork increased the cost of calls significantly to account for loading contract code from the state without making an exception for precompiles, whose &quot;code&quot; is always loaded.&lt;&#x2F;p&gt;
&lt;p&gt;This made use of certain precompiles impractical.&lt;&#x2F;p&gt;
&lt;p&gt;FIXME: extend this with recent reasoning about ECC repricings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After block &lt;code&gt;HF&lt;&#x2F;code&gt; the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; (&lt;code&gt;0xfa&lt;&#x2F;code&gt;) instruction charges different basic gas cost (G&lt;sub&gt;call&lt;&#x2F;sub&gt; in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;&#x27;s notation) depending on the destination address provided:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;for precompiles (address range as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1352&#x2F;&quot;&gt;EIP-1352&lt;&#x2F;a&gt;) the cost is &lt;code&gt;40&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;for every other address the cost remains unchanged (&lt;code&gt;700&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Only the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; instruction was changed to reduce the impact of the change. This should not be a limiting factor, given precompiles (currently) do not have a state and cannot change the state.
However, contracts created and deployed before Byzantium likely will not use &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and as a result this change will not reduce their costs.&lt;&#x2F;p&gt;
&lt;p&gt;Contrary to EIP-1109 gas reduction to &lt;code&gt;0&lt;&#x2F;code&gt; is not proposed. The cost &lt;code&gt;40&lt;&#x2F;code&gt; is kept as a cost representing the context switching needed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP should be backwards compatible. The only effect is that the cost is reduced. Since the cost is not reduced to zero, it should not be possible for a malicious proxy contract, when deployed before
the &lt;code&gt;HF&lt;&#x2F;code&gt;, to do any state changing operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This has been previously suggested as part of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1109&#x2F;&quot;&gt;EIP-1109&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1231&quot;&gt;EIP-1231&lt;&#x2F;a&gt;.
However EIP-1109 was later changed to a very different approach. The author &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1109-remove-call-costs-for-precompiled-contracts&#x2F;447&#x2F;7&quot;&gt;has suggested to change EIP-1109&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;acknowledgements&quot;&gt;Acknowledgements&lt;&#x2F;h2&gt;
&lt;p&gt;Jordi Baylina (@jbaylina) and Matthew Di Ferrante (@mattdf) who have proposed this before.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs</title>
        <published>2019-05-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2035/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2035-stateless-clients-repricing-sload-and-sstore-to-pay-for-block-proofs/3284" />
        

        <id>https://wg-eips.ritovision.com/2035/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2035"
            label="EIP-2035" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2035/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The gas cost of EVM opcodes &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; increases in order to accommodate extra bandwidth required to propagate block proof together with the block
headers and block bodies, as explained &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;data-from-the-ethereum-stateless-prototype-8c69479c8abc&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It is part of the State Rent roadmap. This particular change prepares Ethereum for introduction of the block proofs (current understanding is that they
can be introuced without a hard fork). The introduction of the block proofs allows any Ethereum node that wishes to receive them, to process transactions
in the blocks without needing to access the Ethereum state. All necessary information for the execution (and the proof of validity) is continued in the
block proofs. In most Ethereum nodes, it will speed up the block processing and reduce the memory footprint of such processing. For mining nodes, however,
there will be more work to do to construct and transmit the block proofs. Therefore, the extra charge (payable to the miners) is introduced. In the first
phase, only contract storage will be covered by the block proofs. It means that the Ethereum nodes will still need access to the accounts in the state,
but block proofs will make it optional to have access to contract storage for executing transactions. Therefore, only &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcodes are
affected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;vmstats&#x2F;blob&#x2F;master&#x2F;README.md&quot;&gt;empirical analysis&lt;&#x2F;a&gt; showing that &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcode is currently underpriced in terms
of execution latency it adds to the block processing. The hypothesis is that it is due to the latency of the database accesses. In the same
analysis, &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is not considered, because its effect on the database accesses can be (and are in many implementations) delayed until the end of
the block. Stateless clients approach to the contract storage will largely negate that latency because no database accesses will be required.
Instead, bandwidth consumption goes up. There is emprical analysis (unpublished, but will be) suggesting that 1 uncached &lt;code&gt;SSTORE&lt;&#x2F;code&gt; or &lt;code&gt;SLOAD&lt;&#x2F;code&gt; adds
at most 1 kB to the block proofs. At the current cost of data transmission (68 gas per byte), this translates to the increase of gas cost of both
operations by 69k gas. However, in light of proposal in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt;, the increase can be made much smaller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Not very formal at the moment, but will be formalised with more research and prototyping. Gas of operations &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; increases by &lt;code&gt;X&lt;&#x2F;code&gt; gas when the storage slots accessed (read by &lt;code&gt;SLOAD&lt;&#x2F;code&gt; or written by &lt;code&gt;SSTORE&lt;&#x2F;code&gt;) were not previously accessed (by another &lt;code&gt;SLOAD&lt;&#x2F;code&gt; or &lt;code&gt;SSTORE&lt;&#x2F;code&gt;) during the same transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Future variant (will be possible after the implementation of the &lt;em&gt;Gross contract size acccounting&lt;&#x2F;em&gt;) is researched, where the increase is varied
depending on the size of the contract storage, i.e. &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; for smaller contracts will be cheaper.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;&quot;&gt;EIP-1884&lt;&#x2F;a&gt; seeks to increase the gas cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; but using a different justification
(latency of the execution as described in the Motivation). This EIP is likely to increase the cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; by a larger amount, therefore partially
(because EIP-1884 also proposed other increases) supersedes EIP-1884.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2028&#x2F;&quot;&gt;EIP-2028&lt;&#x2F;a&gt; describes the model that can be used for deciding the gas cost of data transmission. It is relevant
because in the stateless client regime &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; operations add more data to be transmitted (as well as computation to verify the proofs).&lt;&#x2F;p&gt;
&lt;p&gt;The main alternate design is the rent proportional to the size of the contract storage, which unfortunately introduces a serious griefing
vulnerability problem, and so far the solution seems to be in redesigning and rewriting smart contracts in a way, which makes them not vulnerable.
However, this approach is likely to be very expensive on the non-technical (ecosystem) level.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.
There might also be an adverse effect of this change on the already deployed contract. It is expected that after this EIP and
&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2026&#x2F;&quot;&gt;EIP-2026&lt;&#x2F;a&gt; (rent prepayment for accounts), the recommendation will be made to raise the gas limit. This can somewhat dampen the
adverse effect of EIP. The most problematic cases would be with the contracts that assume certain gas costs of &lt;code&gt;SLOAD&lt;&#x2F;code&gt;
and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and hard-code them in their internal gas computations. For others, the cost of interacting with the contract
storage will rise and may make some dApps based on such interactions, non-viable. This is a trade off to avoid even bigger
adverse effect of the rent proportional to the contract storage size. However, more research is needed to more fully
analyse the potentially impacted contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent A - State counters contract</title>
        <published>2019-05-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2029/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2029-state-counters-contract-change-a-from-state-rent-v3-proposal/3279" />
        

        <id>https://wg-eips.ritovision.com/2029/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:2029"
            label="EIP-2029" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2029/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A smart contract is deployed on all Ethereum networks, at a pre-determined address, with the code that simply reads the slot in its storage specified by the
only parameter. Later, this contract becomes &quot;special&quot; in that Ethereum start writing state counters (number of total transactions, number of accounts,
etc.) into that contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is part of the State Rent roadmap. This particular change introduces a place in the Ethereum state where various state counters can be stored. At this
point, the most important counter is the total number of transactions happened, and this counter will be used to populate the nonces of newly created
non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently does not have a special place in the state for tracking state counters such as number of transactions or number of accounts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Prior to the block A, a contract is deployed with the following code:
&lt;code&gt;0x60 0x20 0x60 0x00 0x80 0x80 0x35 0x54 0x90 0x52 0xF3&lt;&#x2F;code&gt;, which corresponds to this assembly:
&lt;code&gt;PUSH1 32 PUSH1 0 DUP1 DUP1 CALLDATALOAD SLOAD SWAP1 MSTORE RETURN&lt;&#x2F;code&gt;
Call to this contract accepts one 32-byte argument, &lt;code&gt;x&lt;&#x2F;code&gt;, and returns the value of the storage item [&lt;code&gt;x&lt;&#x2F;code&gt;].&lt;&#x2F;p&gt;
&lt;p&gt;This contract is deployed using &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcode in such a way that it has the same address on any network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two alternative solutions were considered so far:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Extending the structure of the Ethereum state to introduce more fields, and hence change the way the state root is constructed. The main downside of this
approach is the impact on the software what is currently coupled with the particular way the state root is constructed. Particularly it affects the software
that deals with merkle proofs derived from the state root.&lt;&#x2F;li&gt;
&lt;li&gt;Extended State Oracle (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2014&#x2F;&quot;&gt;EIP-2014&lt;&#x2F;a&gt;). Under such proposal, there will be a precompile contract with standardised interface, capable of returning
current values of the counters. However, the actual data being returned by such oracle is not explicitly in the state, and is not Merkelised. It means that all the counters need to be added to the snapshots when the snapshot sync is perform, so they still present in the state, but implicitly.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is backwards compatible and does not require hard fork to be activated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be created to ensure that the state counter contract returns its storage items correctly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation is envisaged as a transaction that can be posted from any Ethereum address and will cause the deployment of the state counter contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent B - Net transaction counter</title>
        <published>2019-05-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2031/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2031-net-transaction-counter-change-b-from-state-rent-v3-proposal/3283" />
        

        <id>https://wg-eips.ritovision.com/2031/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2031"
            label="EIP-2031" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2031/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum starts to track the number of transactions inside its state (for now, only number of transactions after this change is introduced, therefore
it is called &lt;em&gt;Net&lt;&#x2F;em&gt; transaction count).
It is done by incrementing a storage slot in the special contract, called &lt;em&gt;State counter contract&lt;&#x2F;em&gt; (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2029&#x2F;&quot;&gt;EIP-2029&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;It is part of the State Rent roadmap. This particular change makes any Ethereum transaction increment the transaction counter, which is a special storage slot
in the &lt;em&gt;State counter contract&lt;&#x2F;em&gt;. This counter will be used to populate the nonces of newly created
non-contract accounts. This way of populating nonce ensures replay protection for accounts that were evicted and then brought back by sending ether to them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently does not have a special place in the state for tracking number of transactions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new field, with the location 0 (that means it resides in the storage slot 0 in the state counter contract, and can
be read by calling that contract with argument being 32 zero bytes), is added to the state counter contract. It will eventually contain &lt;code&gt;txCount&lt;&#x2F;code&gt;, the total number of transactions processed up until that point.
On an after block B, or after the deployment of the state counter contract (which comes first), the field &lt;code&gt;txCount&lt;&#x2F;code&gt; is incremented after each transaction. Updating &lt;code&gt;txCount&lt;&#x2F;code&gt; means updating the storage of state counter contract at the location 0. These changes are never reverted.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Two main alternatives were proposed for the replay protection of the accounts that were evicted by subsequently brought back by sending ether to them:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Temporal replay protection. The nonce of the new accounts (and those brought back) is still zero, but a new &lt;code&gt;valid-until&lt;&#x2F;code&gt; field is introduced, making
transactions invalid for inclusion after the time specified in this field. This, however, has unwanted side effected related to the fact that account
nonces are not only used for replay protection, but also for computing the addresses of the deployed contracts (except those created by &lt;code&gt;CREATE2&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;Setting nonce of new accounts (and those brought back) to something depending on the current block number. This approach requires coming up with
an arbitrary parameter, which is the maximum number of transaction in the block, so that the new nonces never clash with the existing nonces.
This is mostly a concern for private networks at the moment, because they will potentially have significantly more transactions in a block.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent H - Fixed Prepayment for accounts</title>
        <published>2019-05-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2026/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2026-fixed-rent-prepayment-for-all-accounts-change-h-from-state-rent-v3-proposal/3273" />
        

        <id>https://wg-eips.ritovision.com/2026/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2026"
            label="EIP-2026" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2026/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Creation of new accounts (both contracts and non-contracts) requires a fixed one-off rent prepayment. Pre-existed accounts require the same prepayment upon
the first modification. The act of rent prepayment causes the addition of an extra field to accounts, called &lt;code&gt;rentbalance&lt;&#x2F;code&gt;. This field becomes part of state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is part of the State Rent roadmap. This particular change introduces a fixed charge for state expansion that comes from adding new accounts to the state. Theoretically, it puts a bound on the number of accounts that can be ever created, because that fixed charge cannot be recycled via mining.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The penalty is levied to the transaction sender. Rather than raising the gas cost of account creation (that would direct levy towards the miner), this change directs prepayment into the account&#x27;s special field, &lt;code&gt;rentbalance&lt;&#x2F;code&gt;. It addresses several shortcomings of the simple raising of the gas cost:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Prepayments cannot be recycled via mining, which puts a theoretical bound on number of accounts in the state (though it is unlikely to ever be reached).&lt;&#x2F;li&gt;
&lt;li&gt;It is not possible for miners to circumvent the penalty or to extend such circumventions onto other users (via private fee rebates, for example).&lt;&#x2F;li&gt;
&lt;li&gt;This prepayment will be used to cover state rent in the future, and it will allow newly created contracts with 0 endowment not to be evicted in the same block.&lt;&#x2F;li&gt;
&lt;li&gt;It makes is possible to refund &lt;code&gt;rentbalance&lt;&#x2F;code&gt; upon self-destruction - when contract is self-destructed, both &lt;code&gt;balance&lt;&#x2F;code&gt; and &lt;code&gt;rentbalance&lt;&#x2F;code&gt; are returned.&lt;&#x2F;li&gt;
&lt;li&gt;Prepayments on pre-existing accounts are necessary to prevent hoarding of accounts ahead of this change.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;On and after block &lt;code&gt;H&lt;&#x2F;code&gt;, every newly created account gets a new field &lt;code&gt;rentbalance&lt;&#x2F;code&gt; of type unsigned 256-bit integer.
On and after block &lt;code&gt;H&lt;&#x2F;code&gt;, any operation that leads to the creation of a new account, deducts the amount &lt;code&gt;ACCOUNT_PREPAYMENT&lt;&#x2F;code&gt; from &lt;code&gt;tx.origin&lt;&#x2F;code&gt;. This amount is added to the &lt;code&gt;rentbalance&lt;&#x2F;code&gt; field of the created account.
On and after block &lt;code&gt;H&lt;&#x2F;code&gt;, any operation that modifies an account that does not yet have &lt;code&gt;rentbalance&lt;&#x2F;code&gt; field, deducts the amount &lt;code&gt;ACCOUNT_PREPAYEMENT&lt;&#x2F;code&gt; from &lt;code&gt;tx.origin&lt;&#x2F;code&gt;. This amount is added to the &lt;code&gt;rentbalance&lt;&#x2F;code&gt; field of the modified account. This is an anti-hoarding measure.&lt;&#x2F;p&gt;
&lt;p&gt;Operations leading to the creations of a new account:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Creation of a non-contract account by sending non-zero ETH to an address with no associated account&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a non-contract account by the block with &lt;code&gt;coinbase&lt;&#x2F;code&gt; pointing to an address with no associated account&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a non-contract account by &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; with the argument being an address with no associated account&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a contract by transaction without destination but with data. This can result in either converting a non-countract account into a contract account, or creation of a contract account.&lt;&#x2F;li&gt;
&lt;li&gt;Creation of a contract by execution of &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt;. This can result in either converting a non-countract account into a contract account, or creation of a contract account.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;After prepayments are introduced, there can be two reasons for ether to be deducted from &lt;code&gt;tx.origin&lt;&#x2F;code&gt;: purchasing and spending gas, and spending gas for prepayments. Gaslimit of a transaction currently plays a role of safety limit, where &lt;code&gt;gaslimit&lt;&#x2F;code&gt;  * &lt;code&gt;gasprice&lt;&#x2F;code&gt; represents the maximum amount of wei the sender (&lt;code&gt;tx.origin&lt;&#x2F;code&gt;) authorises the transaction to deduct from its account.
After prepayments are introduced, &lt;code&gt;gaslimit&lt;&#x2F;code&gt; * &lt;code&gt;gasprice&lt;&#x2F;code&gt; will still represent the maximum amount of wei spend, but it will be used for both gas purchases and prepayments, as necessary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Prior to rent prepayments, other alternatives were considered:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Simple raising of the gas cost - discussed in the Motivation section.&lt;&#x2F;li&gt;
&lt;li&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ledgerwatch&#x2F;eth_state&#x2F;blob&#x2F;master&#x2F;State_rent.pdf&quot;&gt;first version of State Rent proposal&lt;&#x2F;a&gt;, there was no notion of extra levy upon account creation. It created a slight usability issue, where newly created contracts with 0 endowment would be evicted in the same block (when rent is introduced). It delays the benefits of the State Rent programme until the actual introduction of rent (in second or third hard-fork).&lt;&#x2F;li&gt;
&lt;li&gt;In the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ledgerwatch&#x2F;eth_state&#x2F;blob&#x2F;master&#x2F;State_Rent_2.pdf&quot;&gt;second version of State Rent proposal&lt;&#x2F;a&gt;, there was a notion of lock-up. It is very similar to rent prepayment, with the different that lock-up would not be covering future rent payments.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;An alternative approach to limiting the prepayments (instead of the using &lt;code&gt;gaslimit&lt;&#x2F;code&gt; * &lt;code&gt;gasprice&lt;&#x2F;code&gt; as the limit) is to introduce a new dedicated field &lt;code&gt;prepaymenlimit&lt;&#x2F;code&gt; into the transaction. This field would only limit prepayments. Such approach would require changes in the transaction format, as well as changes in the user interface for transaction sender, and having two counters during the transaction execution - one for gas, and one for prepayments.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.
It might have some adverse effects on the existing contracts, due to more gas needed to be allocated for the creation of new accounts. These adverse effects need to analysed in more detail.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State Rent C - Net contract size accounting</title>
        <published>2019-05-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2027/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2027-net-contract-size-accounting-change-c-from-state-rent-v3-proposal/3275" />
        

        <id>https://wg-eips.ritovision.com/2027/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:2027"
            label="EIP-2027" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2027/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum starts counting the number of storage slots filled and emptied in the contracts. Since the number of pre-existing slots is not currently accounted
in the state, effectively, only net change in the number of slots is tracked. In the subsequent change, called &lt;em&gt;Gross contract size accounting&lt;&#x2F;em&gt;, the total
number of storage slots starts being tracked.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This is part of the State Rent roadmap. This particular change introduces initial, net accounting of the number of the contract storage slots. Though not very
useful on its own, it makes it possible to introduce gross accounting of the number of storage slots, which is useful for number of things:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Gas cost of operations suchs as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; will need to be increased to compensate for extra bandwidth consumed by the block proofs. Although in
the beginning the cost would be fixed, it will later be automatically calibrated depending on the size of the contract &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operate on.&lt;&#x2F;li&gt;
&lt;li&gt;Snapshot sync protocols, like &lt;em&gt;fast sync&lt;&#x2F;em&gt;, &lt;em&gt;warp sync&lt;&#x2F;em&gt;, &lt;em&gt;firehose&lt;&#x2F;em&gt;, &lt;em&gt;red queen&lt;&#x2F;em&gt;, and perhaps others, will benefit from having the correct size of the
contract storage present in the state (and therefore being provable via Merkle proofs).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently does not track the number of contract storage slots at all, and producing such number given the downloaded state cannot be done in
constant &lt;em&gt;O(1)&lt;&#x2F;em&gt; time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Each contract (account with &lt;code&gt;codeHash&lt;&#x2F;code&gt; field not equal to 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470, which the hash of the empty code) gets a new uint64 field, called &lt;code&gt;storagesize&lt;&#x2F;code&gt;. On and after block &lt;code&gt;C&lt;&#x2F;code&gt;, the semantics of the operation &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;location&lt;&#x2F;code&gt;, &lt;code&gt;value&lt;&#x2F;code&gt;) changes as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If previous value of the [&lt;code&gt;location&lt;&#x2F;code&gt;] is 0, and value is not 0, &lt;em&gt;increment&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt; (semantics of &lt;em&gt;increment&lt;&#x2F;em&gt; described below)&lt;&#x2F;li&gt;
&lt;li&gt;If previous value of the [&lt;code&gt;location&lt;&#x2F;code&gt;] is not 0, and value is 0, &lt;em&gt;decrement&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt; (semantics of &lt;em&gt;decrement&lt;&#x2F;em&gt; described below)&lt;&#x2F;li&gt;
&lt;li&gt;As with other state changes, changes of &lt;code&gt;storagesize&lt;&#x2F;code&gt; get reverted when the execution frame reverts, i.e. it needs to use the same techniques as storage values, like journalling (in Geth), and substates (in Parity).
Value of &lt;code&gt;storagesize&lt;&#x2F;code&gt; is not observable from contracts at this point.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;semantics-of-increment-storagesize&quot;&gt;Semantics of &lt;em&gt;increment&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is not present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt; + 1.
If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;storagesize&lt;&#x2F;code&gt; + 1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics-of-decrement-storagesize&quot;&gt;Semantics of &lt;em&gt;decrement&lt;&#x2F;em&gt; &lt;code&gt;storagesize&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is not present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt; - 1.
If &lt;code&gt;storagesize&lt;&#x2F;code&gt; is present, &lt;code&gt;storagesize&lt;&#x2F;code&gt; = &lt;code&gt;storagesize&lt;&#x2F;code&gt; - 1.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;note-of-huge-number&quot;&gt;Note of &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;There is a constant &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt;. It needs to be large enough so that no real metrics (contract storage size, number of accounts, number of contracts, total size of code, total size of storage) will never reach that number, and small enough that it fits in an unsigned 64-bit integer.
Current suggestion is to have &lt;code&gt;HUGE_NUMBER&lt;&#x2F;code&gt; = 2^63, which is binary representation is the a single bit in a 64-bit number.&lt;&#x2F;p&gt;
&lt;p&gt;The idea is to make it decidable later whether the storagesize was ever incremented&#x2F;decremented (presence of the field), and whether it has been converted from net to gross (by value being smaller than &lt;code&gt;HUGE_NUMBER&#x2F;2&lt;&#x2F;code&gt; - because it will not be possible for any contract be larger than 2^62 at the block &lt;code&gt;C&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism for estimation of contract storage size has been proposed &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;estimation-approximate-of-the-size-of-contracst-in-ethereum-4642fe92d6fe&quot;&gt;here&lt;&#x2F;a&gt;. But it does have a big drawback of introducing a lot of complexity into the consensus
(in the form of estimation algorithm, which has quite a few edge cases to cater for different sizes of the storage).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated. Since the newly introduced field is not observable, this change does not impact any operations of the existing smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests cases will be generated out of a reference implementation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be proof of concept implementation to refine and clarify the specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Extended State Oracle</title>
        <published>2019-05-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2014/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2014-extended-state-oracle/3301" />
        

        <id>https://wg-eips.ritovision.com/2014/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2014"
            label="EIP-2014" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2014/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new system contract with an extensible interface following the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;abi-spec.html&quot;&gt;Contract ABI Encoding&lt;&#x2F;a&gt; to access extended data sets, such as chain identifiers, block hashes, etc.&lt;&#x2F;p&gt;
&lt;p&gt;This allows Ethereum contract languages to interact with this contract as if it were a regular contract and not needing any language support.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Over the past couple of years several proposals were made to extend the EVM with more data. Some examples include extended access to block hashes (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;210&#x2F;&quot;&gt;EIP-210&lt;&#x2F;a&gt;) and chain identifiers (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Adding them as EVM opcodes seems to be using the scarce opcode space for relatively less frequently used features, while adding them as precompiles is perceived as more complicated due to an interface
needs to be defined and agreed on for every case.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal tries to solve both issues with defining an extensible standard interface.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new system contract (&quot;precompile&quot;) is introduced at address &lt;code&gt;0x0000000000000000000000000000000000000009&lt;&#x2F;code&gt; called ESO (Extended State Oracle).&lt;&#x2F;p&gt;
&lt;p&gt;It can be queried using &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; and follows the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;solidity.readthedocs.io&#x2F;en&#x2F;latest&#x2F;abi-spec.html&quot;&gt;Contract ABI Encoding&lt;&#x2F;a&gt; for the inputs and outputs. Using elementary types in the ABI encoding is encouraged to keep complexity low.&lt;&#x2F;p&gt;
&lt;p&gt;In the future it could be possible to extend ESO to have a state and accept transactions from a system address to store the passed data -- similarly to what &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;210&#x2F;&quot;&gt;EIP-210&lt;&#x2F;a&gt; proposed.&lt;&#x2F;p&gt;
&lt;p&gt;Proposals wanting to introduce more data to the state, which is not part of blocks or transactions, should aim to extend the ESO.&lt;&#x2F;p&gt;
&lt;p&gt;At this time it is not proposed to make the ESO into a contract existing in the state, but to include it as a precompile and leave the implementation details to the client.
In the future if it is sufficiently extended and a need arises to have a state, it would make sense to move it from being a precompile and have actual code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;chain-identifier&quot;&gt;Chain identifier&lt;&#x2F;h3&gt;
&lt;p&gt;Initially, a feature to read the current chain identifier is introduced: &lt;code&gt;getCurrentChainId()&lt;&#x2F;code&gt; returns the current chain identifier as a &lt;code&gt;uint64&lt;&#x2F;code&gt; encoded value.
It should be a non-payable function, which means sending any value would revert the transaction as described in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;140&#x2F;&quot;&gt;EIP-140&lt;&#x2F;a&gt;.
This has been proposed as &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The contract ABI JSON is the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getCurrentChainId&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;		&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;stateMutability&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;pure&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This will be translated into sending the bytes &lt;code&gt;5cf0e8a4&lt;&#x2F;code&gt; to the ESO and returning the bytes &lt;code&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt; for Ethereum mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;&#x2F;strong&gt; It should be possible to introduce another interface checking the validity of a chain identifier in the chain history or for a given block (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1959&quot;&gt;EIP-1959&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1965&quot;&gt;EIP-1965&lt;&#x2F;a&gt;).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transaction data gas cost reduction</title>
        <published>2019-05-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	<author>
		<name>Eli Ben Sasson</name><email>eli@starkware.co</email>
	</author>
	
	<author>
		<name>Tom Brand</name><email>tom@starkware.co</email>
	</author>
	
	<author>
		<name>Louis Guthmann</name><email>louis@starkware.co</email>
	</author>
	
	<author>
		<name>Avihu Levy</name><email>avihu@starkware.co</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2028/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-2028-calldata-gas-cost-reduction/3280" />
        

        <id>https://wg-eips.ritovision.com/2028/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2028"
            label="EIP-2028" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2028/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;We propose to reduce the gas cost of Calldata (&lt;code&gt;GTXDATANONZERO&lt;&#x2F;code&gt;) from its current value of 68 gas per byte to 16 gas per byte, to be backed by mathematical modeling and empirical estimates. The mathematical model is the one used in the works of Sompolinsky and Zohar [1] and Pass, Seeman and Shelat [2], which relates network security to network delay. We shall (1) evaluate the theoretical impact of lower Calldata gas cost on network delay using this model, (2) validate the model empirically, and (3) base the proposed gas cost on our findings.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are a couple of main benefits to accepting this proposal and lowering gas cost of Calldata
On-Chain Scalability: Generally speaking, higher bandwidth of Calldata improves scalability, as more data can fit within a single block.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Layer two scalability: Layer two scaling solutions can improve scalability by moving storage and computation off-chain, but often introduce data transmission instead.
&lt;ul&gt;
&lt;li&gt;Proof systems such as STARKs and SNARKs use a single proof that attests to the computational integrity of a large computation, say, one that processes a large batch of transactions.&lt;&#x2F;li&gt;
&lt;li&gt;Some solutions use fraud proofs which requires a transmission of merkle proofs.&lt;&#x2F;li&gt;
&lt;li&gt;Moreover, one optional data availability solution to layer two is to place data on the main chain, via Calldata.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Stateless clients: The same model will be used to determine the price of the state access for the stateless client regime, which will be proposed in the State Rent (from version 4). There, it is expected that the gas cost of state accessing operation will increase roughly proportional to the extra bandwidth required to transmit the “block proofs” as well as extra processing required to verify those block proofs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The gas per non-zero byte is reduced from 68 to 16. Gas cost of zero bytes is unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Roughly speaking, reducing the gas cost of Calldata leads to potentially larger blocks, which increases the network delay associated with data transmission over the network. This is only part of the full network delay, other factors are block processing time (and storage access, as part of it). Increasing network delay affects security by lowering the cost of attacking the network, because at any given point in time fewer nodes are updated on the latest state of the blockchain.&lt;&#x2F;p&gt;
&lt;p&gt;Yonatan Sompolinsky and Aviv Zohar suggested in [1] an elegant model to relate network delay to network security, and this model is also used in the work of Rafael Pass, Lior Seeman and Abhi Shelat [2]. We briefly explain this model below, because we shall study it theoretically and validate it by empirical measurements to reach the suggested lower gas cost for Calldata.&lt;&#x2F;p&gt;
&lt;p&gt;The model uses the following natural parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;lambda&lt;&#x2F;em&gt;  denotes the block creation rate [1&#x2F;s]: We treat the process of finding a PoW
solution as a poisson process with rate &lt;em&gt;lambda&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;beta&lt;&#x2F;em&gt; - chain growth rate [1&#x2F;s]: the rate at which new blocks are added to
the heaviest chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;D&lt;&#x2F;em&gt; - block delay [s]: The time that elapses between the mining of a new block and its acceptance by all the miners (all miners switched to mining on top of that block).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;beta-lower-bound&quot;&gt;&lt;em&gt;Beta&lt;&#x2F;em&gt; Lower Bound&lt;&#x2F;h3&gt;
&lt;p&gt;Notice that &lt;em&gt;lambda&lt;&#x2F;em&gt; =&amp;gt; &lt;em&gt;beta&lt;&#x2F;em&gt;, because not all blocks that are found will enter the main chain (as is the case with uncles). In [1] it was shown that for a blockchain using the longest chain rule, one may bound &lt;em&gt;beta&lt;&#x2F;em&gt; from below by &lt;em&gt;lambda&lt;&#x2F;em&gt;&#x2F; (1+ D * &lt;em&gt;lambda&lt;&#x2F;em&gt;). This lower bound holds in the extremal case where the topology of the network is a clique in which the delay between each pair of nodes is D, the maximal possible delay. Recording both the lower and upper bounds on &lt;em&gt;beta&lt;&#x2F;em&gt; we get&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_lambda_ &amp;gt;= _beta_ &amp;gt;= _lambda_ &#x2F; (1 + D * _lambda_)               (*)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice, as a sanity check, that when there is no delay (D=0) then &lt;em&gt;beta&lt;&#x2F;em&gt; equals &lt;em&gt;lambda&lt;&#x2F;em&gt;, as expected.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security-of-the-network&quot;&gt;Security of the network&lt;&#x2F;h3&gt;
&lt;p&gt;An attacker attempting to reorganize the main chain needs to generate blocks at a rate that is greater than &lt;em&gt;beta&lt;&#x2F;em&gt;.
Fixing the difficulty level of the PoW puzzle, the total hash rate in the system is correlated to &lt;em&gt;lambda&lt;&#x2F;em&gt;. Thus, &lt;em&gt;beta&lt;&#x2F;em&gt; &#x2F; &lt;em&gt;lambda&lt;&#x2F;em&gt; is defined as the &lt;em&gt;efficiency&lt;&#x2F;em&gt; of the system, as it measures the fraction of total hash power that is used to generate the main chain of the network.&lt;&#x2F;p&gt;
&lt;p&gt;Rearranging (*) gives the following lower bound on efficiency in terms of delay:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_beta_ &#x2F; _lambda_ &amp;gt;= 1 &#x2F; (1 + D * _lambda_)                 (**)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;the-delay-parameter-d&quot;&gt;The &lt;em&gt;delay&lt;&#x2F;em&gt; parameter D&lt;&#x2F;h3&gt;
&lt;p&gt;The network delay depends on the location of the mining node within the network and on the current network topology (which changes dynamically), and consequently is somewhat difficult to measure directly.
Previously, Christian Decker and Roger Wattenhofer [3] showed that propagation time scales with blocksize,  and Vitalik Buterin showed that uncle rate, which is tightly related to efficiency (**) measure, also scales with block size [4].&lt;&#x2F;p&gt;
&lt;p&gt;However, the delay function can be decomposed into two parts D = &lt;em&gt;D_t&lt;&#x2F;em&gt; + &lt;em&gt;D_p&lt;&#x2F;em&gt;, where &lt;em&gt;D_t&lt;&#x2F;em&gt; is the delay caused by the transmission of the block and &lt;em&gt;D_p&lt;&#x2F;em&gt; is the delay caused by the processing of the block by the node. Our model and tests will examine the effect of Calldata on each of &lt;em&gt;D_t&lt;&#x2F;em&gt; and &lt;em&gt;D_p&lt;&#x2F;em&gt;, postulating that their effect is different. This may be particularly relevant for Layer 2 Scalability and for Stateless Clients (Rationales 2, 3 above) because most of the Calldata associated with these goals are Merkle authentication paths that have a large &lt;em&gt;D_t&lt;&#x2F;em&gt; component but relatively small &lt;em&gt;D_p&lt;&#x2F;em&gt; values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To suggest the gas cost of calldata we shall conduct two types of tests:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Network tests, conducted on the Ethereum mainnet, used to estimate the effect on increasing block size on &lt;em&gt;D_p&lt;&#x2F;em&gt; and &lt;em&gt;D_t&lt;&#x2F;em&gt;, on the overall network delay D and the efficiency ratio (**), as well as delays between different mining pools. Those tests will include regression tests on existing data, and stress tests to introduce extreme scenarios.&lt;&#x2F;li&gt;
&lt;li&gt;Local tests, conducted on a single node and measuring the processing time as a function of Calldata amount and general computation limits.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;liorgold2&#x2F;parity-ethereum&#x2F;pull&#x2F;1&quot;&gt;Parity&lt;&#x2F;a&gt;
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;liorgold2&#x2F;go-ethereum&#x2F;pull&#x2F;1&quot;&gt;Geth&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;[1] Yonatan Sompolinsky, Aviv Zohar: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2013&#x2F;881.pdf&quot;&gt;Secure High-Rate Transaction Processing in Bitcoin&lt;&#x2F;a&gt;. Financial Cryptography 2015: 507-527&lt;&#x2F;p&gt;
&lt;p&gt;[2] Rafael Pass, Lior Seeman, Abhi Shelat: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;454.pdf&quot;&gt;Analysis of the Blockchain Protocol in Asynchronous Networks&lt;&#x2F;a&gt;, ePrint report 2016&#x2F;454&lt;&#x2F;p&gt;
&lt;p&gt;[3] Christian Decker, Roger Wattenhofer: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.gsd.inesc-id.pt&#x2F;~ler&#x2F;docencia&#x2F;rcs1314&#x2F;papers&#x2F;P2P2013_041.pdf&quot;&gt;Information propagation in the Bitcoin network&lt;&#x2F;a&gt;. P2P 2013: 1-10&lt;&#x2F;p&gt;
&lt;p&gt;[4] Vitalik Buterin: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.ethereum.org&#x2F;2016&#x2F;10&#x2F;31&#x2F;uncle-rate-transaction-fee-analysis&#x2F;&quot;&gt;Uncle Rate and Transaction Fee Analysis&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EC arithmetic and pairings with runtime definitions</title>
        <published>2019-04-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Vlasov</name><uri>https://github.com/shamatar</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1962/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/generalised-precompile-for-elliptic-curve-arithmetics-and-pairings-working-group/3208/2" />
        

        <id>https://wg-eips.ritovision.com/1962/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1962"
            label="EIP-1962" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1962/">&lt;h1 id=&quot;simple-summary&quot;&gt;Simple summary&lt;&#x2F;h1&gt;
&lt;p&gt;This proposal is an extension and formalization of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; with an inclusion of pairings. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1109&#x2F;&quot;&gt;EIP-1109&lt;&#x2F;a&gt; is required due to low cost of some operations compared to the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcode (more information in the corresponding section below).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a new precompile to bring cryptographic functionality desired for privacy and scaling solutions. Functionality of such precompile will require the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Implementation the following operations over elliptic curves in the Weierstrass form with curve parameters such as base field, A, B coefficients defined in runtime:
&lt;ul&gt;
&lt;li&gt;Point addition&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication of a single point over a scalar&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Implementation pairing operation over elliptic curves from the following &quot;families&quot; with parameters such as base field, extension tower structure, coefficients defined in runtime:
&lt;ul&gt;
&lt;li&gt;BLS12&lt;&#x2F;li&gt;
&lt;li&gt;BN&lt;&#x2F;li&gt;
&lt;li&gt;MNT4&#x2F;6 (Ate pairing)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Full functionality of the precompile is described below in &lt;code&gt;Specification&lt;&#x2F;code&gt; section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;There is a pending proposal to implement base elliptic curve arithmetic is covered by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; and will allow to implement various privacy-preserving protocols with a reasonable gas costs per operation.&lt;&#x2F;li&gt;
&lt;li&gt;Pairings are an important extension for basic arithmetic and so this new precompile is proposed with the following benefits:
&lt;ul&gt;
&lt;li&gt;Extended set of curves will be available to allow Ethereum users to choose their security parameters and required functionality.&lt;&#x2F;li&gt;
&lt;li&gt;Generic approach of this precompile will allow Ethereum users to experiment with newly found curves of their choice and new constructions constructions without waiting for new forks.&lt;&#x2F;li&gt;
&lt;li&gt;EC arithmetic is indeed re-implemented in this precompile, but it&#x27;s strictly required. Most of the pairing-based protocols still need to perform standard EC multiplications or additions and thus such operations must be available on generic set of curves.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Gas costs - this EIP is designed to estimate gas-cost of performed operation as early as possible during the call and base if solely on specified parameters and operation type. This is a strict requirement for any precompile to allow Ethereum nodes to efficiently reject transactions and operations as early as possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Functionality of this newly proposed precompile is different from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; in the following aspects:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Operation on arbitrary-length modulus (up to some upper-limit) for a base field and scalar field of the curve&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operations are introduced&lt;&#x2F;li&gt;
&lt;li&gt;Different ABI due to variable parameter length&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= XXXXX&lt;&#x2F;code&gt;, define a set of &lt;code&gt;10&lt;&#x2F;code&gt; new precompiles with an addresses &lt;code&gt;[0x.., 0x.., ...]&lt;&#x2F;code&gt; and the following functionality.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Addition of points on the curve defined over base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication of a point on the curve defined over base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation for &lt;code&gt;N&lt;&#x2F;code&gt; pairs of &lt;code&gt;(scalar, point)&lt;&#x2F;code&gt; on the curve defined over base field&lt;&#x2F;li&gt;
&lt;li&gt;Addition of points on the curve defined over quadratic or cubic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiplication of a point on the curve defined over quadratic or cubic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation for &lt;code&gt;N&lt;&#x2F;code&gt; pairs of &lt;code&gt;(scalar, point)&lt;&#x2F;code&gt; on the curve defined over quadratic or cubic extension of the base field&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;BLS12&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;BN&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;MNT4&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;li&gt;Pairing operation on the curve of &lt;code&gt;MNT6&lt;&#x2F;code&gt; family&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Due to actuve development of the precompile and a lot of ongoing changes there is a single &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;eip1962&#x2F;tree&#x2F;master&#x2F;documentation&quot;&gt;source of truth&lt;&#x2F;a&gt;. It covers binary interface, gas schedule, integration guide for existing implementations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-simplifications&quot;&gt;Possible simplifications&lt;&#x2F;h3&gt;
&lt;p&gt;Due to high complexity of the proposed operations in the aspects of implementation, debugging and evaluation of the factors for gas costs it may be appropriate to either limit the set of curves at the moment of acceptance to some list and then extend it. Another approach (if it&#x27;s technically possible) would be to have the &quot;whilelist&quot; contract that can be updated without consensus changes (w&#x2F;o fork).&lt;&#x2F;p&gt;
&lt;p&gt;In the case of limited set of curve the following set is proposed as a minimal:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BN254 curve from the current version of Ethereum&lt;&#x2F;li&gt;
&lt;li&gt;BN curve from DIZK with 2^32 roots of unity&lt;&#x2F;li&gt;
&lt;li&gt;BLS12-381&lt;&#x2F;li&gt;
&lt;li&gt;BLS12-377 from ZEXE with large number of roots of unity&lt;&#x2F;li&gt;
&lt;li&gt;MNT4&#x2F;6 cycle from the original &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;595.pdf&quot;&gt;paper&lt;&#x2F;a&gt;. It&#x27;s not too secure, but may give some freedom for experiments.&lt;&#x2F;li&gt;
&lt;li&gt;MNT4&#x2F;6 cycle from Coda if performance allows&lt;&#x2F;li&gt;
&lt;li&gt;Set of CP generated curves that would allow embedding of BLS12-377 and may be some BN curve that would have large power of two divisor for both base field and scalar field modulus (example of CP curve for BLS12-377 can be found in ZEXE).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Only the largest design decisions will be covered:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;While there is no arithmetic over the scalar field (which is modulo size of the main group) of the curve, it&#x27;s required for gas estimation purposes.&lt;&#x2F;li&gt;
&lt;li&gt;Multiexponentiation is a separate operation due to large cost saving&lt;&#x2F;li&gt;
&lt;li&gt;There are no point decompressions due to impossibility to get universal gas estimation of square root operation. For a limited number of &quot;good&quot; cases prices would be too different, so specifying the &quot;worst case&quot; is expensive and inefficient, while introduction of another level if complexity into already complicated gas costs formula is not worth is.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;this-precompile-and-eip-1109&quot;&gt;This precompile and EIP 1109&lt;&#x2F;h3&gt;
&lt;p&gt;While there is no strict requirement of EIP 1109 for functionality, here is an example why it would be desired:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;BLS12-381 curve, 381 bit modulus, 255 bit scalar field, no native arithmetic is available in EVM for this&lt;&#x2F;li&gt;
&lt;li&gt;Point addition would take 5000ns (quite overestimated)&lt;&#x2F;li&gt;
&lt;li&gt;Point multiplication would take roughly 150000ns&lt;&#x2F;li&gt;
&lt;li&gt;Crude gas schedule 15 Mgas&#x2F;second from ECRecover precompile&lt;&#x2F;li&gt;
&lt;li&gt;Point addition would cost 75 gas, with &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; adding another 700&lt;&#x2F;li&gt;
&lt;li&gt;Point multiplication would cost 2250 gas&lt;&#x2F;li&gt;
&lt;li&gt;One should also add the cost of memory allocation that is at least &lt;code&gt;1 + 1 + 48 + 48 + 48 + 1 + 32 + 2*48 + 2*48 = 371 byte&lt;&#x2F;code&gt; that is around 12 native Ethereum &quot;words&quot; and will require extra 36 gas (with negligible price for memory extension)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Based on these quite crude estimations one can see that &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; price will dominate the total cost (in case of addition) or bring significant overhead (in case of multiplication operation) in case of calls to this precompile.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change is not backwards compatible and requires hard fork to be activated.&lt;&#x2F;p&gt;
&lt;p&gt;Functionality of the new precompile itself does not affect any existing functionality of Ethereum or EVM.&lt;&#x2F;p&gt;
&lt;p&gt;This precompile may serve as a complete replacement of the current set of &lt;code&gt;ECADD&lt;&#x2F;code&gt;, &lt;code&gt;ECMUL&lt;&#x2F;code&gt; and pairing check precompiles (&lt;code&gt;0x06&lt;&#x2F;code&gt;, &lt;code&gt;0x07&lt;&#x2F;code&gt;, &lt;code&gt;0x08&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases are the part of the implementation with a link below.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There is an ongoing implementation effort &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;eip1829&quot;&gt;here&lt;&#x2F;a&gt;. Right now:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Non-pairing operations are implemented and tested.&lt;&#x2F;li&gt;
&lt;li&gt;BLS12 family is completed and tested for BLS12-381 and BLS12-377 curves.&lt;&#x2F;li&gt;
&lt;li&gt;BN family is completed and tested with BN254 curve.&lt;&#x2F;li&gt;
&lt;li&gt;Cocks-Pinch method curve is tested for k=6 curve from ZEXE.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;preliminary-benchmarks&quot;&gt;Preliminary benchmarks&lt;&#x2F;h2&gt;
&lt;p&gt;cp6 in benchmarks is a Cocks-Pinch method curve that embeds BLS12-377. Machine: Core i7, 2.9 GHz.&lt;&#x2F;p&gt;
&lt;p&gt;Multiexponentiation benchmarks take 100 pairs &lt;code&gt;(generator, random scalar)&lt;&#x2F;code&gt; as input. Due to the same &quot;base&quot; it may be not too representative benchmark and will be updated.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test pairings::bls12::tests::bench_bls12_381_pairing    ... bench:   2,348,317 ns&#x2F;iter (+&#x2F;- 605,340)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test pairings::cp::tests::bench_cp6_pairing             ... bench:  86,328,825 ns&#x2F;iter (+&#x2F;- 11,802,073)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_addition_bn254                        ... bench:         388 ns&#x2F;iter (+&#x2F;- 73)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_doubling_bn254                        ... bench:         187 ns&#x2F;iter (+&#x2F;- 4)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_field_inverse                         ... bench:       2,478 ns&#x2F;iter (+&#x2F;- 167)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_field_mont_inverse                    ... bench:       2,356 ns&#x2F;iter (+&#x2F;- 51)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_multiplication_bn254                  ... bench:      81,744 ns&#x2F;iter (+&#x2F;- 6,984)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_multiplication_bn254_into_affine      ... bench:      81,925 ns&#x2F;iter (+&#x2F;- 3,323)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_multiplication_bn254_into_affine_wnaf ... bench:      74,716 ns&#x2F;iter (+&#x2F;- 4,076)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_naive_multiexp_bn254                  ... bench:  10,659,911 ns&#x2F;iter (+&#x2F;- 559,790)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_peppinger_bn254                       ... bench:   2,678,743 ns&#x2F;iter (+&#x2F;- 148,914)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;test tests::bench_wnaf_multiexp_bn254                   ... bench:   9,161,281 ns&#x2F;iter (+&#x2F;- 456,137)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New Opcode to check if a chainID is part of the history of chainIDs</title>
        <published>2019-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1959/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1959-valid-chainid-opcode/3170" />
        

        <id>https://wg-eips.ritovision.com/1959/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1959"
            label="EIP-1959" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1959/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;To protect off-chain messages from being reused across different chain, a mechanism need to be given to smart contract to only accept messages for that chain. Since a chain can change its chainID, the mechanism should consider old chainID valid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds an opcode that returns whether the specific number passed in has been a valid chainID (EIP-155 unique identifier) in the history of the chain (including the current chainID).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; proposes to use the chain ID to prevent replay attacks between different chains. It would be a great benefit to have the same possibility inside smart contracts when handling signatures, especially for Layer 2 signature schemes using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; is attempting to solve this by giving smart contract access to the tip of the chainID history. This is insufficient as such value is changing. Hence why EIP-1344 describes a contract based solution to work around the problem. It would be better to solve it in a simpler, cheaper and safer manner, removing the potential risk of misuse present in EIP-1344.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new opcode &lt;code&gt;VALID_CHAINID&lt;&#x2F;code&gt; at 0x46, which uses 1 stack argument : a 32 bytes value that represent the chainID to test. It will push &lt;code&gt;0x1&lt;&#x2F;code&gt; onto the stack if the uint256 value is part of the history (since genesis) of chainIDs of that chain, &lt;code&gt;0x0&lt;&#x2F;code&gt; otherwise.&lt;&#x2F;p&gt;
&lt;p&gt;The operation costs &lt;code&gt;G_blockhash&lt;&#x2F;code&gt; to execute.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the operation might need to be adjusted later as the number of chainID in the history of the chain grows.&lt;&#x2F;p&gt;
&lt;p&gt;Note though that the alternative to keep track of old chainID is to implement a smart contract based caching solution as EIP-1344 proposes comes with an overall higher gas cost. As such the gas cost is simply a necessary cost for the feature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The only approach available today is to specify the chain ID at compile time. Using this approach will result in problems after a contentious hardfork as the contract can&#x27;t accept message signed with a new chainID.&lt;&#x2F;p&gt;
&lt;p&gt;The approach proposed by EIP-1344 is to give access to the latest chainID. This is in itself not sufficient and pose the opposite of the problem mentioned above since as soon as a hardfork that change the chainID happens, every L2 messages signed as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt; (with the previous chainID) will fails to be accepted by the contracts after the fork.&lt;&#x2F;p&gt;
&lt;p&gt;That&#x27;s why in the rationale of EIP-1344 it is mentioned that users need to implement&#x2F;use a mechanism to verify the validity of past chainID via a trustless cache implemented via smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;While this works (except for a temporary gap where the immediately previous chainID is not considered valid), this is actually a required procedure for all contracts that want to accept L2 messages since without it, messages signed before a hardfork that updated the chainID would be rejected. In other words, EIP-1344 expose such risk and it is easy for contract to not consider it by simply checking &lt;code&gt;chainID == CHAIN_ID()&lt;&#x2F;code&gt; without considering past chainIDs.&lt;&#x2F;p&gt;
&lt;p&gt;Indeed letting contracts access the latest chainID for L2 message verification is dangerous. The latest chainID is only the tip of the chainID history. As a changing value, the latest chainID is thus not appropriate to ensure the validity of L2 messages.&lt;&#x2F;p&gt;
&lt;p&gt;Users signing off-chain messages expect their messages to be valid from the time of signing and do not expect these message to be affected by a future hardfork. If the contract use the latest chainID as is for verification, the messages would be invalid as soon as a hardfork that update the chainID happens. For some applications, this will require users to resubmit a new message (think meta transaction), causing them potential loss (or some inconvenience during the hardfork transition), but for some other applications (think state channel) the whole off-chain state become inaccessible, resulting in potentially disastrous situations.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, we should consider all off-chain messages (with valid chainID) as part of the chain&#x27;s offchain state. The opcode proposed here, offer smart contracts a simple and safe method to ensure that the offchain state stay valid across fork.&lt;&#x2F;p&gt;
&lt;p&gt;As for replay protection, the idea of considering all of the off-chain messages signed with valid chainID as part of the chain&#x27;s offchain-state means that all of these off-chain messages can be reused on the different forks which share a common chainID history (up to where they differ). This is actually an important feature since as mentioned, users expect their signed messages to be valid from the time of signing. From that time onwards these messages should be considered as part of the chain&#x27;s offchain state. A hardfork should not thus render them invalid. This is similar to how the previous on-chain state is shared between 2 hardforks.&lt;&#x2F;p&gt;
&lt;p&gt;The wallets will make sure that at any time, a signing message request use the latest chainID of the chain being used. This prevent replay attack onto chain that have different chainID histories (they would not have the same latest chainID).&lt;&#x2F;p&gt;
&lt;p&gt;Now it is argued in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1344-add-chain-id-opcode&#x2F;1131&quot;&gt;EIP1344 discussion&lt;&#x2F;a&gt; that when a contentious hardfork happen and one side of the fork decide to not update its chainID, that side of the chain would be vulnerable to replays since users will keep signing with a chainID that is also valid in the chain that forked. An issue also present in EIP-1344.&lt;&#x2F;p&gt;
&lt;p&gt;This is simply a natural consequence of using chainID as the only anti-replay information for L2 messages. But this can indeed be an issue if the hardfork is created by a small minority. In that case if the majority ignore the fork and do not update its chainID, then all new message from the majority chain (until they update their chainID) can be replayed on the minority-led hardfork since the majority&#x27;s current chainID is also part of the minority-led fork&#x27;s chainID history.&lt;&#x2F;p&gt;
&lt;p&gt;To fix this, every message could specify the block number representing the time it was signed. The contract could then verify that chainID specified as part of that message was valid at that particular block.&lt;&#x2F;p&gt;
&lt;p&gt;While EIP-1344 can&#x27;t do that accurately as the caching system might leave a gap, this proposal can solve it if it is modified to return the blockNumber at which a chainID become invalid. Unfortunately, this would be easy for contracts to not perform that check. And since it suffice of only one important applications to not follow this procedure to put the minority-led fork at a disadvantage, this would fail to achieve the desired goal of protecting the minority-led fork from replay.&lt;&#x2F;p&gt;
&lt;p&gt;Since a minority-led fork ignored by the majority means that the majority will not keep track of the messages to be submitted (state channel, ...), if such fork get traction later, this would be at the expense of majority users who were not aware of it. As such this proposal assume that minority-led fork will not get traction later and thus do not require to be protected.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with all chains which implement EIP-155 chain ID domain separator for transaction signing. Existing contract are not affected.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly to EIP-1344, it might be beneficial to update EIP-712 (still in Draft) to deal with chainID separately from the domain separator. Indeed since chainID is expected to change, if the domain separator include chainID, it would have to be dynamically computed. A caching mechanism could be used by smart contract instead though.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This was previously suggested as part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1344-add-chain-id-opcode&#x2F;1131&#x2F;39&quot;&gt;EIP-1344 discussion&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Method to check if a chainID is valid at a specific block Number</title>
        <published>2019-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1965/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1965-valid-chainid-for-specific-blocknumber-protect-all-forks/3181" />
        

        <id>https://wg-eips.ritovision.com/1965/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1965"
            label="EIP-1965" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1965/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds a precompile that returns whether a specific chainID (EIP-155 unique identifier) is valid at a specific blockNumber. ChainID are assumed to be valid up to the blockNumber at which they get replaced by a new chainID.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; proposes to use the chain ID to prevent the replay of transactions between different chains. It would be a great benefit to have the same possibility inside smart contracts when handling off-chain message signatures, especially for Layer 2 signature schemes using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1344&#x2F;&quot;&gt;EIP-1344&lt;&#x2F;a&gt; is attempting to solve this by giving smart contract access to the tip of the chainID history. This is insufficient as such value is changing. Hence why EIP-1344 describes a contract based solution to work around the problem. It would be better to solve it in a simpler, cheaper and safer manner, removing the potential risk of misuse present in EIP-1344. Furthermore EIP-1344 can&#x27;t protect replay properly for minority-led hardfork as the caching system cannot guarantee accuracy of the blockNumber at which the new chainID has been introduced.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1959&#x2F;&quot;&gt;EIP-1959&lt;&#x2F;a&gt; solves the issue of EIP-1344 but does not attempt to protect from minority-led hardfork as mentioned in the rationale. We consider this a mistake, since it removes some freedom to fork. We consider that all fork should be given equal opportunities. And while there will always be issues we can&#x27;t solve for the majority that ignore a particular fork, &lt;strong&gt;users that decide to use both the minority-fork and the majority-chain should be protected from replay without having to wait for the majority chain to update its chainID.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new precompile which uses 2 arguments : a 32 bytes value that represents the chainID to test and a 32 bytes value representing the blockNumber at which the chainID is tested. It returns 0x1  if the chainID is valid at the specific blockNumber, 0x0 otherwise. Note that chainID are considered valid up to the blockNumber at which they are replaced. So they are valid for every blockNumber past their replacement.&lt;&#x2F;p&gt;
&lt;p&gt;The operation will costs no more than &lt;code&gt;G_blockhash&lt;&#x2F;code&gt; + &lt;code&gt;G_verylow&lt;&#x2F;code&gt; to execute. This could be lower as chainID are only introduced during hardfork.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the operation might need to be adjusted later as the number of chainID in the history of the chain grows.&lt;&#x2F;p&gt;
&lt;p&gt;Note though that the alternative to keep track of old chainID is to implement a smart contract based caching solution as EIP-1344 proposes comes with an overall higher gas cost and exhibit issues for minority-led hardfork (see Rationale section below). As such the gas cost is simply a necessary cost for the feature.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rationale at EIP-1959 applies here as well too :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;An opcode is better than a caching system for past chainID, It is cheaper, safer and does not include gaps.&lt;&#x2F;li&gt;
&lt;li&gt;Direct access to the latest chainID is dangerous since it makes it easy for contracts to use it as a replay protection mechanism while preventing otherwise valid old messages to be valid after a fork that changes the chainID. This can have disastrous consequences on users.&lt;&#x2F;li&gt;
&lt;li&gt;all off-chain messages signed before a fork should be valid across all side of the fork.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The only difference is that this current proposal proposes a solution to protect hardfork led by a minority.&lt;&#x2F;p&gt;
&lt;p&gt;To summarize there is 2 possible fork scenario :&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The majority decide to make a hardfork but a minority disagree with it (ETC is such example). The fork is planned for block X. If the majority is not taking any action to automate the process of assigning a different chainID for both, the minority has plenty of time to plan for a chainID upgrade to happen at that same block X. Now if they do not do it, their users will face the problem that their messages will be replayable on the majority chain (Note that this is not true the other way around as we assume the majority decided to change the chainID). As such there is no reason that they will leave it that way.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;A minority decide to create a hardfork that the majority disagree with (or simply ignore). Now, the same as above can happen but since we are talking about a minority there is a chance that the majority does not care about the minority. In that case, there would be no incentive for the majority to upgrade the chainID. This means that users of both sides of the fork will have the messages meant for the majority chain replayable on the minority-chain (even if this one changed its chainID) unless extra precaution is taken.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The solution is to add the blockNumber representing the time at which the message was signed and use it as an argument to the opcode proposed here. This way, when the minority forks with a new chainID, the previous chainID become invalid from that time onward. So new messages destined to the majority chain can&#x27;t be replayed on the minority fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-712 is still in draft but would need to be updated to include the blockNumber as part of the values that wallets need to verify for the protection of their users.&lt;&#x2F;p&gt;
&lt;p&gt;Since chainID and blockNumber will vary, they should not be part of the domain separator (meant to be generated once) but another part of the message.&lt;&#x2F;p&gt;
&lt;p&gt;While the pair could be optional for contract that do not care about replays or have other ways to prevent them, if chainID is present, the blockNumber must be present too. And if any of them is present, wallet need to ensure that the chainID is indeed the latest one of the chain being used, while the blockNumber is the latest one at the point of signing. During fork transition, the wallet can use the blockNumber to know which chainID to use.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This was previously suggested as part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;eip-1959-valid-chainid-opcode&#x2F;3170&quot;&gt;EIP1959 discussion&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Block Rewards Proposal for funding Eth1.x</title>
        <published>2019-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Hancock</name><uri>https://github.com/madeoftin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2025/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/MadeofTin/EIPs/issues" />
        

        <id>https://wg-eips.ritovision.com/2025/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2025"
            label="EIP-2025" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2025/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add &lt;code&gt;0.0055 ETH&lt;&#x2F;code&gt; per block for 18 months (A total of 17050 ETH) as a developer block reward reserved for funding specific Ethereum1.X working groups. The working groups are State rent (750k), Better sync (360k), Finality gadget (360k), Fee market (360k), Testing infrastructure (360k). Governance of the funds will be through a multisig of trusted individuals from the ecosystem including client teams, the foundation, and the community.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1890&#x2F;&quot;&gt;EIP-1890&lt;&#x2F;a&gt; proposes a mechanism to capture a portion of block rewards for sustainably funding ongoing network development. That EIP sets values and addresses to zero and so does not actually collect any rewards. This proposal is to explicitly set those values and begin collecting a portion of block rewards for 18 months in order to fund Ethereum 1.X working groups and organization efforts. This funding will be used to repay an initial loan provided by investors in the community funding this work with a small amount of interest. After 18 months the block reward would again reduce to zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP extends the mechanism established in EIP-1890 to add &lt;code&gt;0.0055 ETH&lt;&#x2F;code&gt; to the block reward for a specific distribution period of &lt;code&gt;3,100,000 BLOCKS&lt;&#x2F;code&gt;(≈ 18 months). The &lt;code&gt;RECIPIENT_ADDRESS&lt;&#x2F;code&gt; is set to a smart contract with hardcoded denominations that distributes incoming ETH to a set of addresses for the purpose of Eth1.X development. The emission schedule would start at the hard fork block number and continue for &lt;code&gt;3,100,000 BLOCKS&lt;&#x2F;code&gt; (≈ 18 months) at which point the address and amount would again return to 0. Any further distribution would require a future hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The context for this proposal came from attending the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Au1Qll-86v0&quot;&gt;Core Dev Eth1.X Meeting&lt;&#x2F;a&gt; in Berlin. Development is needed to move Eth1.X forward, and I observed that a lack of funding is the primary barrier to this work. This work can only be effectively conducted by working groups forming around these issues, and these working groups need funding in order to pay dedicated contractors and project managers. This proposal is a plan for funding these groups and supporting their operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two constants will be introduced:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt;, which specifies the number of blocks after &lt;code&gt;ISTANBUL_BLOCK_HEIGHT&lt;&#x2F;code&gt; when the reward collection will terminate (i.e., at block &lt;code&gt;ISTANBUL_BLOCK_HEIGHT + REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BENEFICIARY_ADDRESSES&lt;&#x2F;code&gt;, a list of tuples containing the address and the amount to be transferred to this address per block. These amounts will be determined as the loan is collected from participating organizations and the addresses for repayment will be specified by them. The total of the amounts will sum to 0.0055. At the end of &lt;code&gt;REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt; the loan will be completely repaid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;REWARD_DURATION_IN_BLOCKS = 3100000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;DEVFUND_BLOCK_REWARD = 0.0055&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BENEFICIARY_ADDRESSES = [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (&amp;lt;address&amp;gt;, &amp;lt;amount_in_eth&amp;gt;),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; (&amp;lt;address&amp;gt;, &amp;lt;amount_in_eth&amp;gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Beginning with block &lt;code&gt;ISTANBUL_BLOCK_HEIGHT&lt;&#x2F;code&gt;, the reward is added to the participating addresses within &lt;code&gt;BENEFICIARY_ADDRESSES&lt;&#x2F;code&gt; at each block until the end of the &lt;code&gt;REWARD_DURATION_IN_BLOCKS&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;IF (CURRENT_BLOCK - ISTANBUL_BLOCK_HEIGHT &amp;lt;= REWARD_DURATION_IN_BLOCKS)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FOR BENEFICIARY in BENEFICIARY_ADDRESSES:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  BENEFICIARY[0].balance += BENEFICIARY[1]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;rewards-distribution-rationale&quot;&gt;Rewards Distribution Rationale&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Development loan repayment: 0.005 ETH per block: 15500 ETH total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Development loan interest (10% total over the period, simple interest): 0.0005 ETH per block: 1550 ETH total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; Total Block Reward Increase = `0.0055` ETH per block: 17050 ETH Total&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;em&gt;With a price of Ethereum at $150.00 this will raise approx USD $2,325,000.00 for developing Eth1.X over the next 18 months.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;.&#x2F;assets&#x2F;block_rewards_distribution.png&quot; alt=&quot;Block Rewards Distribution&quot; &#x2F;&gt; *Specific Addresses to be determined&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;#why-hardcoded-values&quot;&gt;FAQ - Why hardcoded values?&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There has been great public debate concerning EIP-1890, and one of the primary concerns is that it is difficult to evaluate the proposal without more complete information on how funds would be raised, how they would be administered, and how they would be used. There is a need for funding Eth1.x development and it is currently unclear where those funds will come from. This proposal is intended to give a more comprehensive proposal for its funding. In the case that ETH1.x is fully funded before the Istanbul upgrade I will withdraw this EIP. Until that point I intend to continue championing this proposal as a valid funding mechanism for this work.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-a-loan&quot;&gt;Why a loan?&lt;&#x2F;h3&gt;
&lt;p&gt;The Eth1x initiative needs funding now, not in 18 months. A loan is necessary to complete certain stages of work before the funding mechanism begins to provide funds. A loan would provide this necessary funding today, and the investors willing to front this cost can recoup their contribution + a reward of &lt;em&gt;a fixed interest rate&lt;&#x2F;em&gt; for the risk on their loan. This arrangement will make it easier to find investors willing to participate who have sufficient funds.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;loan-repayment&quot;&gt;Loan Repayment&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;.&#x2F;assets&#x2F;loan_state.png&quot; alt=&quot;Loan State Diagram&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There is a risk that the investors lose part of their contribution in the case that this EIP is rejected by the community between the time the funds have been collected and the beginning of the payout schedule. In this case all remaining funds will be returned to the contributors. The interest on the loan is an incentive for investors to participate in spite of this risk. Their downside is limited to the amount of funds spent before this EIP is accepted or rejected, which should be no more than about 5%, while their upside consists of the 10% simple interest paid over the period.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;development-loan&quot;&gt;Development Loan&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;Development Loan: 0.005&lt;&#x2F;code&gt; over 3.1 Million blocks = 15500 ETH&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Funding Working Groups on 1.X&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Funding Contractors, Coordinators, and project managers&lt;&#x2F;li&gt;
&lt;li&gt;Working Groups defined with clear mandates&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Budget&lt;&#x2F;p&gt;
&lt;p&gt;Working groups&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;State rent (750k)&lt;&#x2F;li&gt;
&lt;li&gt;Better sync (360k)&lt;&#x2F;li&gt;
&lt;li&gt;finality gadget (360k)&lt;&#x2F;li&gt;
&lt;li&gt;Fee market (360k)&lt;&#x2F;li&gt;
&lt;li&gt;testing infrastructure (360k)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;ETH1.X Core Dev Gatherings&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Funding hosting, traveling, and accommodations for necessary in-person gatherings of ETH1.X core developers similar to the Stanford and Berlin ETH1.X Core Dev Meeting held earlier this year.&lt;&#x2F;p&gt;
&lt;p&gt;At the end of the 18 Months, the whole process would be torn down to prevent any internal tyranny of structurelessness forming within.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2025&#x2F;#how-will-funding-the-devs-be-organized&quot;&gt;FAQ - How will the funding of the devs be organized?&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;accountability&quot;&gt;Accountability&lt;&#x2F;h2&gt;
&lt;p&gt;The funds will be transferred into DAI and secured in a multi-sig comprised of members of the community. Representatives from the following groups will receive a key.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;EIP Editors&lt;&#x2F;li&gt;
&lt;li&gt;Geth&lt;&#x2F;li&gt;
&lt;li&gt;Parity&lt;&#x2F;li&gt;
&lt;li&gt;ConsenSys&#x2F;PegaSys (PegaSys)&lt;&#x2F;li&gt;
&lt;li&gt;The Ethereum Foundation (Hudson Jameson)&lt;&#x2F;li&gt;
&lt;li&gt;Community&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;personal-notes-and-disclosure&quot;&gt;Personal Notes and Disclosure&lt;&#x2F;h2&gt;
&lt;p&gt;I want to address any concerns about conflicts of interests directly. My participation with Eth1.X currently has been as a volunteer. I am in talks about a possible funded role helping with testing and coordination. If my work for with Eth1.x is funded, I will accept no additional funding collected by the mechanism proposed in this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;Eth1.X is the now of Ethereum and I would like to see it succeed. This is the intent of my proposal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;coi&quot;&gt;COI&lt;&#x2F;h3&gt;
&lt;p&gt;Previously I was PM for Tennagraph, a signalling solution for Ethereum. An Aragon grant funded this project and was distributed through Giveth and an AragonDAO. I have not received any funding from the project beyond this grant. All of this is verifiable on-chain. I am stepping down from any paid role on the project to continue as an advisor. I am also stepping down as a moderator for stances as there is a COI moderating stances for EIPs I am working with directly.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;disclaimer&quot;&gt;Disclaimer&lt;&#x2F;h3&gt;
&lt;p&gt;I do not claim to represent the community with my views; any members who wish to join supporting me with this proposal are free to do so. This is as fair of a proposal as I can personally conceive.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no impact on backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Not Implemented&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not Implemented&lt;&#x2F;p&gt;
&lt;h2 id=&quot;faq&quot;&gt;FAQ&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-hardcoded-values&quot;&gt;Why Hardcoded Values?&lt;&#x2F;h3&gt;
&lt;p&gt;Why not use a smart contract with some governance mechanism to allow changing the distribution of funds? Wouldn’t that be more flexible and effective?&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;TLDR: This EIP is not about governance reform&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;First, the payment of the loan will be hardcoded. Once agreed, the terms must be kept to give the lenders confidence in the repayment of the loan. As long as blocks are created the debt will be paid back. This is the essence of a trustless smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;After the loan, there is the option to allow the amounts (limited to less than .05ETH), and the locations (orgs that receive ecosystem funding) to be changed throughout the emission schedule. It is pretty easy to imagine a smart contract or DAO fulfilling this role. However, there are three classes of options available today we can consider when governing changes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Give the Keys to the Hands of the Few (Oligarchy)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Create a multisig that allows a group of individuals to update the smart contract. The most likely candidates for this are the Core Devs themselves, but it could also be a trusted few from the community&#x2F;stakeholders. No matter how you slice it, there is a fundamental issue in deciding who gets to decide. There currently is not a trusted&#x2F;adopted governance mechanism to make these decisions within the Ethereum ecosystem. Also, preventing changing the contract in self interest is difficult without a well-engineered governance system of checks and balances. This EIP does not claim nor aim to solve these issues.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Give the Keys to the Hands of the Many (Plutarchy)&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Allow ethereum holders with coin votes to update the smart contract. Using holographic consensus could overcome the issue of voter turnout as it scales as participation scales, even to the size of the whole network. This has some benefits as the entire network can participate. However, the problem is that some individuals in the network are over represented -- the wealthy. Without a solution to identity that has been agreed to and implemented by the entire Ethereum Network, there is no way around giving more power in votes to the rich. This EIP does not claim, nor aim to solve these issues.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Use Ethereum Governance as it is Today&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Criticisms or support aside, there is a system that governs Ethereum today. It is a mix of rough consensus among core devs, miners running nodes, clients implementing changes, and stakeholders adopting those changes. It includes yelling or not yelling on twitter and reddit. It is complicated and I don’t claim to understand it. Even without a clear view of how it works, there is evidence of its existence. This evidence is there are changes that have allowed to be implemented, and changes that have not allowed to be implemented in Ethereum.&lt;&#x2F;p&gt;
&lt;p&gt;I do not aim to change Ethereum governance. Because this EIP has hardcoded values, it must go through the existing governance process, whatever that is, before it is implemented. It will then continue to operate until the end of the emission schedule. This is intentional. This makes it uncapturable. No party other then the ecosystem itself can modify the contract once it has been deployed.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP is not about governance reform.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-not-allow-current-client-implementors-fund-this-work-ef-consensys-parity-etc&quot;&gt;Why not allow current client implementors fund this work? (EF, Consensys, Parity, etc...)&lt;&#x2F;h3&gt;
&lt;p&gt;Historically there has been a precedent that the Ethereum Foundation is solely responsible for funding the development of Ethereum. This process has evolved as the development has become more distributed. Aya Miyaguchi observed in a recent &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.coindesk.com&#x2F;ethereum-foundation-director-sets-new-vision-for-blockchain-non-profit&quot;&gt;Coindesk article&lt;&#x2F;a&gt;, “it really is not only Ethereum Foundation people who are building [Ethereum]”. Yes, we could rely on the Ethereum Foundation to fund Eth1.X. But, why should we? This is a call for the network to come together and fund its own development. Ethereum &lt;em&gt;the network&lt;&#x2F;em&gt; is not owned by any one organization or group of people. We are lucky to have the EF and I consider this EIP in support of their coordination efforts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-will-funding-the-devs-be-organized&quot;&gt;How Will Funding the Devs be Organized&lt;&#x2F;h3&gt;
&lt;p&gt;I do not profess to know the best way to organize these funds. There is work already in progress to organize these efforts championed by Alexey Akhunov. The following is a quote from a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@akhounov&#x2F;ethereum-1x-as-an-attempt-to-change-the-process-783efa23cf60&quot;&gt;recent medium article&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Going from funding a few implementation teams continuously and letting them do &#x27;their stuff&#x27; to funding more specific and temporary initiatives requires looking at funding through different lenses. How much &#x27;due diligence&#x27; and oversight is too much (in terms of overhead), who can decide whether working groups actually deliver, etc. This is also solvable, and also more on this will come later (not in this post).&quot;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;My suggestion would be to create an Eth1.X core developer DAO using &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;daostack.io&#x2F;&quot;&gt;DaoStack&lt;&#x2F;a&gt; to coordinate membership and payment of the Core Devs, but ultimately they are capable of determining the system that works best for them. As long as the system is transparent and mature enough to distribute funds when the time comes, this is sufficient for now.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;isn-t-a-loan-considered-a-security-or-is-it&quot;&gt;Isn&#x27;t a loan considered a security, or is it?&lt;&#x2F;h3&gt;
&lt;p&gt;I am not a lawyer and will seek further guidance from lawyers in the field on this point in particular. From the research I have done and conversations I have had there is a very good argument that a loan of this nature will not be considered a security by the US Supreme Court.
As the result of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;casetext.com&#x2F;case&#x2F;reves-v-ernst-young&quot;&gt;REVES ET AL. v . ERNST YOUNG 1990&lt;&#x2F;a&gt;, the court stated that a home loan, consumer financing, a loan secured by a lien on a small business or some assets of a small business, short term notes, or notes that formalize a debt incurred in the ordinary course of business are not securities. If the note resembles the items listed above (home loans, etc.) then the note will not be deemed a security. The Supreme Court provided four factors to determine if a note sufficiently resembles the types of notes that are not classified as securities. (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.invigorlaw.com&#x2F;loan-subject-securities-regulations&#x2F;&quot;&gt;source&lt;&#x2F;a&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Family Resemblance Test&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The intentions of the company and the individual—if the company raised money for general use in a business enterprise, then the note is more likely to be a security; if the individual agreed to the loan primarily for the profit the note was expected to generate, the note is more likely to be a security.&lt;&#x2F;li&gt;
&lt;li&gt;The plan of distribution—the more widely the note is offered, the more likely it is to be found a security.&lt;&#x2F;li&gt;
&lt;li&gt;The expectations of the investing public—if the investors thought they were investing in a business to make a profit on their investment, the note is more likely to be found a security.&lt;&#x2F;li&gt;
&lt;li&gt;Other risk-reducing factor—if the note is collateralized or otherwise less risky than common notes, the note is less likely to be found to be a security.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The loan is for the specific use of supporting Eth1.X research and development. The distribution will not be widely offered and the note will be collateralized by the network itself, provided in ETH and repaid in ETH. In coordinating the collection of these funds recognise I may be legally liable for some of this work and I will do all of the due dilegence I can, seek legal counsel, and accept any legal repercussions resulting from this work.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Fee market change for ETH 1.0 chain</title>
        <published>2019-04-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	<author>
		<name>Eric Conner</name><uri>https://github.com/econoar</uri>
	</author>
	
	<author>
		<name>Rick Dudley</name><uri>https://github.com/AFDudley</uri>
	</author>
	
	<author>
		<name>Matthew Slipper</name><uri>https://github.com/mslipper</uri>
	</author>
	
	<author>
		<name>Ian Norden</name><uri>https://github.com/i-norden</uri>
	</author>
	
	<author>
		<name>Abdelhamid Bakhta</name><uri>https://github.com/abdelhamidbakhta</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1559/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1559-fee-market-change-for-eth-1-0-chain/2783" />
        

        <id>https://wg-eips.ritovision.com/1559/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1559"
            label="EIP-1559" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1559/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A transaction pricing mechanism that includes fixed-per-block network fee that is burned and dynamically expands&#x2F;contracts block sizes to deal with transient congestion.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction type, with the format &lt;code&gt;0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;There is a base fee per gas in protocol, which can move up or down each block according to a formula which is a function of gas used in parent block and gas target (block gas limit divided by elasticity multiplier) of parent block.
The algorithm results in the base fee per gas increasing when blocks are above the gas target, and decreasing when blocks are below the gas target.
The base fee per gas is burned.
Transactions specify the maximum fee per gas they are willing to give to miners to incentivize them to include their transaction (aka: priority fee).
Transactions also specify the maximum fee per gas they are willing to pay total (aka: max fee), which covers both the priority fee and the block&#x27;s network fee per gas (aka: base fee).
Senders will always pay the base fee per gas of the block their transaction was included in, and they will pay the priority fee per gas set in the transaction, as long as the combined amount of the two fees doesn&#x27;t exceed the transaction&#x27;s maximum fee per gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum historically priced transaction fees using a simple auction mechanism, where users send transactions with bids (&quot;gasprices&quot;) and miners choose transactions with the highest bids, and transactions that get included pay the bid that they specify. This leads to several large sources of inefficiency:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mismatch between volatility of transaction fee levels and social cost of transactions&lt;&#x2F;strong&gt;: bids to include transactions on mature public blockchains, that have enough usage so that blocks are full, tend to be extremely volatile. It&#x27;s absurd to suggest that the cost incurred by the network from accepting one more transaction into a block actually is 10x more when the cost per gas is 10 nanoeth compared to when the cost per gas is 1 nanoeth; in both cases, it&#x27;s a difference between 8 million gas and 8.02 million gas.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Needless delays for users&lt;&#x2F;strong&gt;: because of the hard per-block gas limit coupled with natural volatility in transaction volume, transactions often wait for several blocks before getting included, but this is socially unproductive; no one significantly gains from the fact that there is no &quot;slack&quot; mechanism that allows one block to be bigger and the next block to be smaller to meet block-by-block differences in demand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Inefficiencies of first price auctions&lt;&#x2F;strong&gt;: The current approach, where transaction senders publish a transaction with a bid a maximum fee, miners choose the highest-paying transactions, and everyone pays what they bid. This is well-known in mechanism design literature to be highly inefficient, and so complex fee estimation algorithms are required. But even these algorithms often end up not working very well, leading to frequent fee overpayment.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Instability of blockchains with no block reward&lt;&#x2F;strong&gt;: In the long run, blockchains where there is no issuance (including Bitcoin and Zcash) at present intend to switch to rewarding miners entirely through transaction fees. However, there are known issues with this that likely leads to a lot of instability, incentivizing mining &quot;sister blocks&quot; that steal transaction fees, opening up much stronger selfish mining attack vectors, and more. There is at present no good mitigation for this.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The proposal in this EIP is to start with a base fee amount which is adjusted up and down by the protocol based on how congested the network is. When the network exceeds the target per-block gas usage, the base fee increases slightly and when capacity is below the target, it decreases slightly. Because these base fee changes are constrained, the maximum difference in base fee from block to block is predictable. This then allows wallets to auto-set the gas fees for users in a highly reliable fashion. It is expected that most users will not have to manually adjust gas fees, even in periods of high network activity. For most users the base fee will be estimated by their wallet and a small priority fee, which compensates miners taking on orphan risk (e.g. 1 nanoeth), will be automatically set. Users can also manually set the transaction max fee to bound their total costs.&lt;&#x2F;p&gt;
&lt;p&gt;An important aspect of this fee system is that miners only get to keep the priority fee. The base fee is always burned (i.e. it is destroyed by the protocol). This ensures that only ETH can ever be used to pay for transactions on Ethereum, cementing the economic value of ETH within the Ethereum platform and reducing risks associated with miner extractable value (MEV). Additionally, this burn counterbalances Ethereum inflation while still giving the block reward and priority fee to miners. Finally, ensuring the miner of a block does not receive the base fee is important because it removes miner incentive to manipulate the fee in order to extract more fees from users.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Block validity is defined in the reference implementation below.
The &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; (&lt;code&gt;0x3a&lt;&#x2F;code&gt;) opcode &lt;strong&gt;MUST&lt;&#x2F;strong&gt; return the &lt;code&gt;effective_gas_price&lt;&#x2F;code&gt; as defined in the reference implementation below.&lt;&#x2F;p&gt;
&lt;p&gt;As of &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt;, a new &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; transaction is introduced with &lt;code&gt;TransactionType&lt;&#x2F;code&gt; 2.&lt;&#x2F;p&gt;
&lt;p&gt;The intrinsic cost of the new transaction is inherited from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2930&#x2F;&quot;&gt;EIP-2930&lt;&#x2F;a&gt;, specifically &lt;code&gt;21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;TransactionPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list, signature_y_parity, signature_r, signature_s])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;signature_y_parity, signature_r, signature_s&lt;&#x2F;code&gt; elements of this transaction represent a secp256k1 signature over &lt;code&gt;keccak256(0x02 || rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, amount, data, access_list]))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2718&#x2F;&quot;&gt;EIP-2718&lt;&#x2F;a&gt; &lt;code&gt;ReceiptPayload&lt;&#x2F;code&gt; for this transaction is &lt;code&gt;rlp([status, cumulative_transaction_gas_used, logs_bloom, logs])&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note: &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is integer division, round down.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; typing&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Union&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Dict&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Tuple&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Literal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; dataclasses&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; dataclass&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; abc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ABC&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransactionLegacy&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	v&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction2930Payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_y_parity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction2930Envelope&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Literal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction1559Payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	chain_id&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_y_parity&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; False&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_r&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signature_s&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Transaction1559Envelope&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	type&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Literal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction1559Payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Transaction1559Payload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Transaction2718&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction1559Envelope&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Envelope&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Union&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;TransactionLegacy&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction2718&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	max_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	destination&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	amount&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	payload&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	access_list&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Tuple&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; List&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	parent_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	uncle_hashes&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; field&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;default_factory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	author&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	state_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	transaction_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	transaction_receipt_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	logs_bloom&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	difficulty&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_limit&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; note the gas_limit is the gas_target * ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	gas_used&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	timestamp&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	extra_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	proof_of_work&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;dataclass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	nonce&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	balance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	storage_root&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	code_hash&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;INITIAL_BASE_FEE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;INITIAL_FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; World&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ABC&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; None&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; on the fork block, don&amp;#39;t account for the ELASTICITY_MULTIPLIER to avoid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; unduly halving the gas target.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITIAL_FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; ELASTICITY_MULTIPLIER&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the block used too much gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: too much gas used&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the block changed the gas limit too much&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: gas limit increased too much&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1024&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: gas limit decreased too much&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the gas limit is at least the minimum gas limit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the base fee is correct&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		if&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITIAL_FORK_BLOCK_NUMBER&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; INITIAL_BASE_FEE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; gas_used_delta&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; parent_gas_target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BASE_FEE_MAX_CHANGE_DENOMINATOR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; parent_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; base_fee_per_gas_delta&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; expected_base_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: base fee not correct&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; execute transactions and do gas accounting&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;		cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		for&lt;&#x2F;span&gt;&lt;span&gt; unnormalized_transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Note: this validates transaction signature and chain ID which must happen before we normalize below since normalized transactions don&amp;#39;t include signature or chain ID&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;validate_and_recover_signer_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unnormalized_transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			transaction&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;normalize_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;unnormalized_transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signer_address&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid transaction: signer does not have enough ETH to cover attached value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the signer must be able to afford the transaction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure that the user was willing to at least pay the base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevent impossibly large numbers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Prevent impossibly large numbers&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The total must be the larger of the two&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; priority fee is capped because the base fee is filled first&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signer pays both the priority fee and the base fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			effective_gas_price&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;base_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			assert&lt;&#x2F;span&gt;&lt;span&gt; signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid transaction: signer does not have enough ETH to cover gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; signer gets refunded for unused gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			signer&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_refund&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;			#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; miner only receives the priority fee; note that the base fee is not given to anyone (it is burned)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;			self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;author&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; priority_fee_per_gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; check if the block spent too much gas transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		assert&lt;&#x2F;span&gt;&lt;span&gt; cumulative_transaction_gas_used&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid block: gas_used does not equal total gas used in all transactions&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: verify account balances match block&amp;#39;s account balances (via state root comparison)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; TODO&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;: validate the rest of the block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; normalize_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; legacy transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; TransactionLegacy&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			return&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				destination&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2930 transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction2930Envelope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			return&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_price&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				destination&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;		#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1559 transactions&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; isinstance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;transaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; Transaction1559Envelope&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			return&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_address&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; signer_address&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				signer_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;signer_nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				gas_limit&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_limit&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_priority_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				max_fee_per_gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;max_fee_per_gas&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				destination&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;destination&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				amount&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;amount&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				payload&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;				access_list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;payload&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;access_list&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;			)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;		else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;			raise&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; Exception&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;invalid transaction: unexpected number of items&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; block_hash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; transactions&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; block&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Sequence&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;Transaction&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;	#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; effective_gas_price is the value returned by the GASPRICE (0x3a) opcode&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; execute_transaction&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; NormalizedTransaction&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; effective_gas_price&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; validate_and_recover_signer_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; transaction&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; Transaction&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;	@&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;abstractmethod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;	def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; account&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; address&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; -&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; Account&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Legacy Ethereum transactions will still work and be included in blocks, but they will not benefit directly from the new pricing system.  This is due to the fact that upgrading from legacy transactions to new transactions results in the legacy transaction&#x27;s &lt;code&gt;gas_price &lt;&#x2F;code&gt; entirely being consumed either by the &lt;code&gt;base_fee_per_gas&lt;&#x2F;code&gt; and the &lt;code&gt;priority_fee_per_gas&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;block-hash-changing&quot;&gt;Block Hash Changing&lt;&#x2F;h3&gt;
&lt;p&gt;The datastructure that is passed into keccak256 to calculate the block hash is changing, and all applications that are validating blocks are valid or using the block hash to verify block contents will need to be adapted to support the new datastructure (one additional item).  If you only take the block header bytes and hash them you should still correctly get a hash, but if you construct a block header from its constituent elements you will need to add in the new one at the end.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gasprice&quot;&gt;GASPRICE&lt;&#x2F;h3&gt;
&lt;p&gt;Previous to this change, &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; represented both the ETH paid by the signer per gas for a transaction as well as the ETH received by the miner per gas.  As of this change, &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; now only represents the amount of ETH paid by the signer per gas, and the amount a miner was paid for the transaction is no longer accessible directly in the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;increased-max-block-size-complexity&quot;&gt;Increased Max Block Size&#x2F;Complexity&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP will increase the maximum block size, which could cause problems if miners are unable to process a block fast enough as it will force them to mine an empty block.  Over time, the average block size should remain about the same as without this EIP, so this is only an issue for short term size bursts.  It is possible that one or more clients may handle short term size bursts poorly and error (such as out of memory or similar) and client implementations should make sure their clients can appropriately handle individual blocks up to max size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;transaction-ordering&quot;&gt;Transaction Ordering&lt;&#x2F;h3&gt;
&lt;p&gt;With most people not competing on priority fees and instead using a baseline fee to get included, transaction ordering now depends on individual client internal implementation details such as how they store the transactions in memory.  It is recommended that transactions with the same priority fee be sorted by time the transaction was received to protect the network from spamming attacks where the attacker throws a bunch of transactions into the pending pool in order to ensure that at least one lands in a favorable position.  Miners should still prefer higher gas premium transactions over those with a lower gas premium, purely from a selfish mining perspective.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;miners-mining-empty-blocks&quot;&gt;Miners Mining Empty Blocks&lt;&#x2F;h3&gt;
&lt;p&gt;It is possible that miners will mine empty blocks until such time as the base fee is very low and then proceed to mine half full blocks and revert to sorting transactions by the priority fee.  While this attack is possible, it is not a particularly stable equilibrium as long as mining is decentralized.  Any defector from this strategy will be more profitable than a miner participating in the attack for as long as the attack continues (even after the base fee reached 0).  Since any miner can anonymously defect from a cartel, and there is no way to prove that a particular miner defected, the only feasible way to execute this attack would be to control 50% or more of hashing power.  If an attacker had exactly 50% of hashing power, they would make no Ether from priority fee while defectors would make double the Ether from priority fees.  For an attacker to turn a profit, they need to have some amount over 50% hashing power, which means they can instead execute double spend attacks or simply ignore any other miners which is a far more profitable strategy.&lt;&#x2F;p&gt;
&lt;p&gt;Should a miner attempt to execute this attack, we can simply increase the elasticity multiplier (currently 2x) which requires they have even more hashing power available before the attack can even be theoretically profitable against defectors.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eth-burn-precludes-fixed-supply&quot;&gt;ETH Burn Precludes Fixed Supply&lt;&#x2F;h3&gt;
&lt;p&gt;By burning the base fee, we can no longer guarantee a fixed Ether supply.  This could result in economic instability as the long term supply of ETH will no longer be constant over time.  While a valid concern, it is difficult to quantify how much of an impact this will have.  If more is burned on base fee than is generated in mining rewards then ETH will be deflationary and if more is generated in mining rewards than is burned then ETH will be inflationary.  Since we cannot control user demand for block space, we cannot assert at the moment whether ETH will end up inflationary or deflationary, so this change causes the core developers to lose some control over Ether&#x27;s long term quantity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>CALLs with strict gas semantic. Revert if not enough gas available.</title>
        <published>2019-04-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ronan Sandford</name><uri>https://github.com/wighawag</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1930/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1930" />
        

        <id>https://wg-eips.ritovision.com/1930/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1930"
            label="EIP-1930" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1930/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Add the ability for smart contract to execute calls with a specific amount of gas. If this is not possible the execution should revert.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current CALL, DELEGATE_CALL, STATIC_CALL opcode do not enforce the gas being sent, they simply consider the gas value as a maximum. This pose serious problem for applications that require the call to be executed with a precise amount of gas.&lt;&#x2F;p&gt;
&lt;p&gt;This is for example the case for meta-transaction where the contract needs to ensure the call is executed exactly as the signing user intended.&lt;&#x2F;p&gt;
&lt;p&gt;But this is also the case for common use cases, like checking &quot;on-chain&quot; if a smart contract support a specific interface (via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;EIP-165&lt;&#x2F;a&gt; for example).&lt;&#x2F;p&gt;
&lt;p&gt;The solution presented here is to add new call semantic that enforce the amount of gas specified : the call either proceed with the exact amount of gas or do not get executed and the current call revert.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;There are 2 possibilities&lt;&#x2F;p&gt;
&lt;p&gt;a) one is to add opcode variant that have a stricter gas semantic&lt;&#x2F;p&gt;
&lt;p&gt;b) The other is to consider a specific gas value range (one that have never been used before) to have strict gas semantic, while leaving other values as before&lt;&#x2F;p&gt;
&lt;p&gt;Here are the details description&lt;&#x2F;p&gt;
&lt;h4 id=&quot;option-a&quot;&gt;option a)&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;add a new variant of the CALL opcode where the gas specified is enforced so that if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert&lt;&#x2F;li&gt;
&lt;li&gt;add a new variant of the DELEGATE_CALL opcode where the gas specified is enforced so that if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert&lt;&#x2F;li&gt;
&lt;li&gt;add a new variant of the STATIC_CALL opcode where the gas specified is enforced so that if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;rational-for-a&quot;&gt;Rational for a)&lt;&#x2F;h5&gt;
&lt;p&gt;This solution has the merit to avoid any possibility of old contract be affected by the change. On the other hand it introduce 3 new opcodes. With EIP-1702, we could render the old opcode obsolete though.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;option-b&quot;&gt;option b)&lt;&#x2F;h4&gt;
&lt;p&gt;For all opcode that allow to pass gas to another contract, do the following:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If the most significant bit is one, consider the 31 less significant bit as the amount of gas to be given to the receiving contract in the strict sense. SO like a) if the gas left at the point of call is not enough to give the specified gas to the destination, the current call revert.&lt;&#x2F;li&gt;
&lt;li&gt;If the 2nd most significant bit is zero, consider the whole value to behave like before, that is, it act as a maximum value, and even if not enough gas is present, the gas that can be given is given to the receiving contract&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;rational-for-b&quot;&gt;Rational for b)&lt;&#x2F;h5&gt;
&lt;p&gt;This solution relies on the fact that no contract would have given any value bigger or equal to 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;p&gt;
&lt;p&gt;Note that solidity for example do not use value like 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF as it is more expensive than passing the gasLeft.&lt;&#x2F;p&gt;
&lt;p&gt;Its main benefit though is that it does not require extra opcodes.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;strict-gas-semantic&quot;&gt;strict gas semantic&lt;&#x2F;h4&gt;
&lt;p&gt;To be precise, regarding the strict gas semantic, based on &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, the current call must revert unless G &amp;gt;= I x 64&#x2F;63 where G is gas left at the point of call (after deducing the cost of the call itself) and I is the gas specified.&lt;&#x2F;p&gt;
&lt;p&gt;So instead of&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;availableGas = availableGas - base&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas := availableGas - availableGas&#x2F;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if !callCost.IsUint64() || gas &amp;lt; callCost.Uint64() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return gas, nil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;see https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;blob&#x2F;7504dbd6eb3f62371f86b06b03ffd665690951f2&#x2F;core&#x2F;vm&#x2F;gas.go#L41-L48&lt;&#x2F;p&gt;
&lt;p&gt;we would have&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;availableGas = availableGas - base&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;gas := availableGas - availableGas&#x2F;64&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;if !callCost.IsUint64() || gas &amp;lt; callCost.Uint64() {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    return 0, errNotEnoughGas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Currently the gas specified as part of these opcodes is simply a maximum value. And due to the behavior of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; it is possible for an external call to be given less gas than intended (less than the gas specified as part of the CALL) while the rest of the current call is given enough to continue and succeed. Indeed since with EIP-150, the external call is given at max  &lt;code&gt;G - Math.floor(G&#x2F;64)&lt;&#x2F;code&gt; where G is the gasleft() at the point of the CALL, the rest of the current call is given &lt;code&gt;Math.floor(G&#x2F;64)&lt;&#x2F;code&gt; which can be plenty enough for the transaction to succeed. For example, when G = 6,400,000 the rest of the transaction will be given 100,000 gas plenty enough in many case to succeed.&lt;&#x2F;p&gt;
&lt;p&gt;This is an issue for contracts that require external call to only fails if they would fails with enough gas. This requirement is present in smart contract wallet and meta transaction in general, where the one executing the transaction is not the signer of the execution data. Because in such case, the contract needs to ensure the call is executed exactly as the signing user intended.&lt;&#x2F;p&gt;
&lt;p&gt;But this is also true for simple use case, like checking if a contract implement an interface via EIP-165. Indeed as specified by such EIP, the &lt;code&gt;supporstInterface&lt;&#x2F;code&gt; method is bounded to use 30,000 gas so that it is theoretically possible to ensure that the throw is not a result of a lack of gas. Unfortunately due to how the different CALL opcodes behave contracts can&#x27;t simply rely on the gas value specified. They have to ensure by other means that there is enough gas for the call.&lt;&#x2F;p&gt;
&lt;p&gt;Indeed, if the caller do not ensure that 30,000 gas or more is provided to the callee, the callee might throw because of a lack of gas (and not because it does not support the interface), and the parent call will be given up to 476 gas to continue. This would result in the caller interpreting wrongly that the callee is not implementing the interface in question.&lt;&#x2F;p&gt;
&lt;p&gt;While such requirement can be enforced by checking the gas left according to EIP-150 and the precise gas required before the call (see solution presented in that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.solidified.io&#x2F;contract&#x2F;5b4769b1e6c0d80014f3ea4e&#x2F;bug&#x2F;5c83d86ac2dd6600116381f9&quot;&gt;bug report&lt;&#x2F;a&gt; or after the call (see the native meta transaction implementation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pixowl&#x2F;thesandbox-contracts&#x2F;blob&#x2F;623f4d4ca10644dcee145bcbd9296579a1543d3d&#x2F;src&#x2F;Sand&#x2F;erc20&#x2F;ERC20MetaTxExtension.sol#L176&quot;&gt;here&lt;&#x2F;a&gt;, it would be much better if the EVM allowed us to strictly specify how much gas is to be given to the CALL so contract implementations do not need to follow &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; behavior and the current gas pricing so closely.&lt;&#x2F;p&gt;
&lt;p&gt;This would also allow the behaviour of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; to be changed without having to affect contract that require this strict gas behaviour.&lt;&#x2F;p&gt;
&lt;p&gt;As mentioned, such strict gas behaviour is important for smart contract wallet and meta transaction in general.
The issue is actually already a problem in the wild as can be seen in the case of Gnosis safe which did not consider the behavior of EIP-150 and thus fails to check the gas properly, requiring the safe owners to add otherwise unnecessary extra gas to their signed message to avoid the possibility of losing funds. See https:&#x2F;&#x2F;github.com&#x2F;gnosis&#x2F;safe-contracts&#x2F;issues&#x2F;100&lt;&#x2F;p&gt;
&lt;p&gt;As for EIP-165, the issue already exists in the example implementation presented in the EIP. Please see the details of the issue &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;881#issuecomment-491677748&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The same issue exists also on OpenZeppelin implementation, a library used by many. It does not for perform any check on gas before calling &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; with 30,000 gas (see &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;OpenZeppelin&#x2F;openzeppelin-solidity&#x2F;blob&#x2F;fa004a7f5de572b3dbcde1a8a81f9a87e353e799&#x2F;contracts&#x2F;introspection&#x2F;ERC165Checker.sol#L37&quot;&gt;here&lt;&#x2F;a&gt; and is thus vulnerable to the issue mentioned.&lt;&#x2F;p&gt;
&lt;p&gt;While such issue can be prevented today by checking the gas with EIP-150 in mind, a solution at the opcode level is more elegant.&lt;&#x2F;p&gt;
&lt;p&gt;Indeed, the two possible ways to currently enforce that the correct amount of gas is sent are as follow :&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;check done before the call&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint256 gasAvailable = gasleft() - E;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;require(gasAvailable - gasAvailable &#x2F; 64  &amp;gt;= `txGas`, &amp;quot;not enough gas provided&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to.call.gas(txGas)(data); &#x2F;&#x2F; CALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where E is the gas required for the operation between the call to &lt;code&gt;gasleft()&lt;&#x2F;code&gt; and the actual call PLUS the gas cost of the call itself.
While it is possible to simply over estimate &lt;code&gt;E&lt;&#x2F;code&gt; to prevent call to be executed if not enough gas is provided to the current call it would be better to have the EVM do the precise work itself. As gas pricing continue to evolve, this is important to have a mechanism to ensure a specific amount of gas is passed to the call so such mechanism can be used without having to relies on a specific gas pricing.&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;check done after the call:&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;to.call.gas(txGas)(data); &#x2F;&#x2F; CALL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;require(gasleft() &amp;gt; txGas &#x2F; 63, &amp;quot;not enough gas left&amp;quot;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This solution does not require to compute a &lt;code&gt;E&lt;&#x2F;code&gt; value and thus do not relies on a specific gas pricing (except for the behaviour of EIP-150) since if the call is given not enough gas and fails for that reason, the condition above will always fail, ensuring the current call will revert.
But this check still pass if the gas given was less AND the external call reverted or succeeded EARLY (so that the gas left after the call &amp;gt; txGas &#x2F; 63).
This can be an issue if the code executed as part of the CALL is reverting as a result of a check against the gas provided. Like a meta transaction in a meta transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly to the previous solution, an EVM mechanism would be much better.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;for specification a) : Backwards compatible as it introduce new opcodes.&lt;&#x2F;p&gt;
&lt;p&gt;for specification b) : Backwards compatible as it use value range outside of what is used by existing contract (to be verified)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;None fully implemented yet. But see Specifications for an example in geth.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;EIP-150, .&#x2F;00150.md&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Commitment to Sustainable Ecosystem Funding</title>
        <published>2019-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gregory Markou</name><email>greg@chainsafe.io</email>
	</author>
	
	<author>
		<name>Kevin Owocki</name><email>kevin@gitcoin.co</email>
	</author>
	
	<author>
		<name>Lane Rettig</name><email>lane@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1890/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://t.me/joinchat/DwEd_xahL5hHvzNYH2RnQA" />
        

        <id>https://wg-eips.ritovision.com/1890/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1890"
            label="EIP-1890" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1890/">&lt;h1 id=&quot;commitment-to-sustainable-ecosystem-funding&quot;&gt;Commitment to Sustainable Ecosystem Funding&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum currently provides a block reward to proof of work miners every block, but it does not capture any block rewards for ecosystem funding. This EIP adds a simple mechanism for capturing a portion of block rewards for ecosystem funding as a credible commitment to doing so in future, but it does not actually capture any such rewards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism that allows specification of two parameters, a beneficiary address and a per-block reward denominated in wei, that allows a portion of block rewards to be captured for the purpose of ecosystem funding. Both values are set to zero.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In order for Ethereum to succeed, it needs talented, motivated researchers and developers to continue to develop and maintain the platform. Those talented researchers and developers deserve to be paid fairly for their work. At present there is no mechanism in the Ethereum ecosystem that rewards R&amp;amp;D teams fairly for their work on the platform.&lt;&#x2F;p&gt;
&lt;p&gt;We recognize that, while technically trivial, the real challenge in inflation-based funding is social: how to fairly capture, govern, and distribute block rewards. It will take time to work out the answer to these questions. For this reason, this EIP only seeks to make a credible commitment on the part of core developers to securing the funding they need to keep Ethereum alive and healthy by adding a mechanism to do so, but the actual amount of rewards captured remains at zero, i.e., there is no change at present to Ethereum’s economics. Raising the amount captured above zero would require a future EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two new constants are introduced: BENEFICIARY_ADDRESS, an Address, and DEVFUND_BLOCK_REWARD, an amount denominated in wei. Both are set to zero.&lt;&#x2F;p&gt;
&lt;p&gt;Beginning with block ISTANBUL_BLOCK_HEIGHT, DEVFUND_BLOCK_REWARD wei is added to the balance of BENEFICIARY_ADDRESS at each block.&lt;&#x2F;p&gt;
&lt;p&gt;We may optionally add another constant, DECAY_FACTOR, which specifies a linear or exponenential decay factor that reduces the reward at every block &amp;gt; ISTANBUL_BLOCK_HEIGHT until it decays to zero. For simplicity, it has been omitted from this proposal.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We believe that the technical design of this EIP is straightforward. The social rationale is explained in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;gitcoin&#x2F;funding-open-source-in-the-blockchain-era-8ded753bf05f&quot;&gt;this article&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no impact on backwards compatibility.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP makes no changes to existing state transitions. Existing consensus tests should be sufficient.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Reference implementations are included for the Trinity, go-ethereum, and parity clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Repricing for trie-size-dependent opcodes</title>
        <published>2019-03-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1884/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/opcode-repricing/3024" />
        

        <id>https://wg-eips.ritovision.com/1884/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1884"
            label="EIP-1884" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1884/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes repricing certain opcodes, to obtain a good balance between gas expenditure and resource consumption.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The growth of the Ethereum state has caused certain opcodes to be more resource-intensive at this point than
they were previously. This EIP proposes to raise the &lt;code&gt;gasCost&lt;&#x2F;code&gt; for those opcodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An imbalance between the price of an operation and the resource consumption (CPU time, memory etc)
has several drawbacks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It could be used for attacks, by filling blocks with underpriced operations which causes excessive block processing time.&lt;&#x2F;li&gt;
&lt;li&gt;Underpriced opcodes cause a skewed block gas limit, where sometimes blocks finish quickly but other blocks with similar gas use finish slowly.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If operations are well-balanced, we can maximise the block gaslimit and have a more stable processing time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;At block &lt;code&gt;N&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) operation changes from &lt;code&gt;200&lt;&#x2F;code&gt; to &lt;code&gt;800&lt;&#x2F;code&gt; gas,&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;) operation changes from &lt;code&gt;400&lt;&#x2F;code&gt; to &lt;code&gt;700&lt;&#x2F;code&gt; gas,&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; (&lt;code&gt;0x3F&lt;&#x2F;code&gt;) operation changes from &lt;code&gt;400&lt;&#x2F;code&gt; to &lt;code&gt;700&lt;&#x2F;code&gt; gas,&lt;&#x2F;li&gt;
&lt;li&gt;A new opcode, &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is introduced at &lt;code&gt;0x47&lt;&#x2F;code&gt;.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; pops &lt;code&gt;0&lt;&#x2F;code&gt; arguments off the stack,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; pushes the &lt;code&gt;balance&lt;&#x2F;code&gt; of the current address to the stack,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is priced as &lt;code&gt;GasFastStep&lt;&#x2F;code&gt;, at &lt;code&gt;5&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Here are two charts, taken from a full sync using Geth. The execution time was measured for every opcode, and aggregated for 10K blocks. These bar charts show the top 25 &#x27;heavy&#x27; opcodes in the ranges 5M to 6M and 6M to 7M:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;run3.total-bars-5.png&quot; alt=&quot;bars1&quot; &#x2F;&gt;
&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;run3.total-bars-6.png&quot; alt=&quot;bars2&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Note: It can also be seen that the &lt;code&gt;SLOAD&lt;&#x2F;code&gt; moves towards the top position. The &lt;code&gt;GASPRICE&lt;&#x2F;code&gt; (&lt;code&gt;0x3a&lt;&#x2F;code&gt;) opcode has position one which I believe can be optimized away within the client -- which is not the case with &lt;code&gt;SLOAD&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Here is another chart, showing a full sync with Geth. It represents the blocks &lt;code&gt;0&lt;&#x2F;code&gt; to &lt;code&gt;5.7M&lt;&#x2F;code&gt;, and highlights what the block processing time is spent on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;geth_processing.png&quot; alt=&quot;geth&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It can be seen that &lt;code&gt;storage_reads&lt;&#x2F;code&gt; and &lt;code&gt;account_reads&lt;&#x2F;code&gt; are the two most significant factors contributing to the block processing time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;sload&quot;&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;SLOAD&lt;&#x2F;code&gt; was repriced at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt;, from &lt;code&gt;50&lt;&#x2F;code&gt; to &lt;code&gt;200&lt;&#x2F;code&gt;.
The following graph shows a go-ethereum full sync, where each data point represents
10K blocks. During those 10K blocks, the execution time for the opcode was aggregated.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;SLOAD-run3.png&quot; alt=&quot;graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It can be seen that the repricing at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; caused a steep drop, from around &lt;code&gt;67&lt;&#x2F;code&gt; to &lt;code&gt;23&lt;&#x2F;code&gt;.
Around block &lt;code&gt;5M&lt;&#x2F;code&gt;, it started reaching pre-&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; levels, and at block &lt;code&gt;7M&lt;&#x2F;code&gt;
it was averaging on around &lt;code&gt;150&lt;&#x2F;code&gt; - more than double pre-eip-150 levels.&lt;&#x2F;p&gt;
&lt;p&gt;Increasing the cost of &lt;code&gt;SLOAD&lt;&#x2F;code&gt; by &lt;code&gt;4&lt;&#x2F;code&gt; would bring it back down to around &lt;code&gt;40&lt;&#x2F;code&gt;.
It is to be expected that it will rise again in the future, and may need future repricing, unless
state clearing efforts are implemented before that happens.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;balance&quot;&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;BALANCE&lt;&#x2F;code&gt; (a.k.a &lt;code&gt;EXTBALANCE&lt;&#x2F;code&gt;) is an operation which fetches data from the state trie. It was repriced at &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;150&#x2F;&quot;&gt;EIP-150&lt;&#x2F;a&gt; from &lt;code&gt;20&lt;&#x2F;code&gt; to &lt;code&gt;400&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1884&#x2F;.&#x2F;assets&#x2F;BALANCE-run3.png&quot; alt=&quot;graph&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is comparable to &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; and &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, which are priced at &lt;code&gt;700&lt;&#x2F;code&gt; already.&lt;&#x2F;p&gt;
&lt;p&gt;It has a built-in high variance, since it is often used for checking the balance of &lt;code&gt;this&lt;&#x2F;code&gt;,
which is an inherently cheap operation, however, it can be used to lookup the balance of arbitrary account which often require trie (disk) access.&lt;&#x2F;p&gt;
&lt;p&gt;In hindsight, it might have been a better choice to have two
opcodes: &lt;code&gt;EXTBALANCE(address)&lt;&#x2F;code&gt; and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;, and have two different prices.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This EIP proposes to extend the current opcode set.
&lt;ul&gt;
&lt;li&gt;Unfortunately, the opcode span &lt;code&gt;0x3X&lt;&#x2F;code&gt; is already full, hence the suggestion to place &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; in the &lt;code&gt;0x4X&lt;&#x2F;code&gt; range.&lt;&#x2F;li&gt;
&lt;li&gt;As for why it is priced at &lt;code&gt;5&lt;&#x2F;code&gt; (&lt;code&gt;GasFastStep&lt;&#x2F;code&gt;) instead of &lt;code&gt;2&lt;&#x2F;code&gt; (&lt;code&gt;GasQuickStep&lt;&#x2F;code&gt;), like other similar operations: the EVM execution engine still needs a lookup into the (cached) trie, and &lt;code&gt;balance&lt;&#x2F;code&gt;, unlike &lt;code&gt;gasPrice&lt;&#x2F;code&gt; or &lt;code&gt;timeStamp&lt;&#x2F;code&gt;, is not constant during the execution, so it has a bit more inherent overhead.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;extcodehash&quot;&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; was introduced in Constantinople, with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1052&#x2F;&quot;&gt;EIP-1052&lt;&#x2F;a&gt;. It was priced at &lt;code&gt;400&lt;&#x2F;code&gt; with the reasoning:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The gas cost is the same as the gas cost for the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode because the execution of the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; requires the same account lookup as in &lt;code&gt;BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Ergo, if we increase &lt;code&gt;BALANCE&lt;&#x2F;code&gt;, we should also increase &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The changes require a hardfork. The changes have the following consequences:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Certain calls will become more expensive.&lt;&#x2F;li&gt;
&lt;li&gt;Default-functions which access the storage and may in some cases require more than&lt;code&gt;2300&lt;&#x2F;code&gt; gas (the minimum gas that is always available in calls).&lt;&#x2F;li&gt;
&lt;li&gt;Contracts that assume a certain fixed gas cost for calls (or internal sections) may cease to function.
&lt;ul&gt;
&lt;li&gt;A fixed gas cost is specified in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;165&#x2F;&quot;&gt;ERC-165&lt;&#x2F;a&gt; and implementations of this interface do use the affected opcodes.
&lt;ul&gt;
&lt;li&gt;The ERC-165 method &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; must return a &lt;code&gt;bool&lt;&#x2F;code&gt; and use at most &lt;code&gt;30,000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;The two example implementations from the EIP were, at the time of writing
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;586&lt;&#x2F;code&gt; gas for any input, and&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;236&lt;&#x2F;code&gt; gas, but increases linearly with a higher number of supported interfaces&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;It is unlikely that any ERC-165 &lt;code&gt;supportsInterface&lt;&#x2F;code&gt; implementation will go above &lt;code&gt;30.000&lt;&#x2F;code&gt; gas. That would require that the second variant is used, and thirty:ish interfaces are supported.&lt;&#x2F;li&gt;
&lt;li&gt;However, these operations have already been repriced earlier, so there is a historical precedent that &#x27;the gascost for these operations may change&#x27;, which should have prevented such fixed-gas-cost assumptions from being implemented.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I expect that certain patterns will be less used, for example the use of multiple modifiers which &lt;code&gt;SLOAD&lt;&#x2F;code&gt;s the same opcode will be merged into one. It may also lead to less &lt;code&gt;log&lt;&#x2F;code&gt; operations containing &lt;code&gt;SLOAD&lt;&#x2F;code&gt;ed values that are not strictly necessary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Testcases that should be implemented:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Test that &lt;code&gt;selfbalance == balance(address)&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;Test that &lt;code&gt;balance(this)&lt;&#x2F;code&gt; costs as before,&lt;&#x2F;li&gt;
&lt;li&gt;Test that &lt;code&gt;selfbalance&lt;&#x2F;code&gt; does not pop from stack&lt;&#x2F;li&gt;
&lt;li&gt;Gascost verification of &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; and &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Verify that &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt; is invalid before Istanbul&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Some testcases have been implemented as statetests at https:&#x2F;&#x2F;github.com&#x2F;holiman&#x2F;IstanbulTests&#x2F;tree&#x2F;master&#x2F;GeneralStateTests&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has not yet been implemented in any client.
Both these opcodes have been repriced before, and the client internals for managing reprices are already in place.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;selfbalance&quot;&gt;&lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;This is the implementation for the new opcode in go-ethereum:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;func&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; opSelfBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;pc&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint64&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; interpreter&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;EVMInterpreter&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Contract&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Memory&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; stack&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Stack&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;byte&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;	stack&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;intPool&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;interpreter&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;evm&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;StateDB&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;GetBalance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;	return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; nil&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;See backwards compatibility section.&lt;&#x2F;li&gt;
&lt;li&gt;There are no special edgecases regarding &lt;code&gt;SELFBALANCE&lt;&#x2F;code&gt;, if we define it as &lt;code&gt;BALANCE&lt;&#x2F;code&gt; with &lt;code&gt;address&lt;&#x2F;code&gt; instead of popping an address from the stack -- since &lt;code&gt;BALANCE&lt;&#x2F;code&gt; is already well-defined.&lt;&#x2F;li&gt;
&lt;li&gt;It should be investigated if Solidity contains any hardcoded expectations on the gas cost of these operations.&lt;&#x2F;li&gt;
&lt;li&gt;In many cases, a recipient of &lt;code&gt;ether&lt;&#x2F;code&gt; from a &lt;code&gt;CALL&lt;&#x2F;code&gt; will want to issue a &lt;code&gt;LOG&lt;&#x2F;code&gt;. The &lt;code&gt;LOG&lt;&#x2F;code&gt; operation costs &lt;code&gt;375&lt;&#x2F;code&gt; plus &lt;code&gt;375&lt;&#x2F;code&gt; per topic. If the &lt;code&gt;LOG&lt;&#x2F;code&gt; also wants to do an &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, this change may make some such transfers fail.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompile for Elliptic Curve Linear Combinations</title>
        <published>2019-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Remco Bloemen</name><email>Recmo@0x.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1829/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/ewasm-precompile-for-general-elliptic-curve-math/2581" />
        

        <id>https://wg-eips.ritovision.com/1829/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1829"
            label="EIP-1829" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1829/">&lt;h1 id=&quot;precompile-for-elliptic-curve-linear-combinations&quot;&gt;Precompile for Elliptic Curve Linear Combinations&lt;&#x2F;h1&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the EVM only supports &lt;em&gt;secp256k1&lt;&#x2F;em&gt; in a limited way through &lt;code&gt;ecrecover&lt;&#x2F;code&gt; and &lt;em&gt;altbn128&lt;&#x2F;em&gt; through two pre-compiles. There are draft proposals to add more curves. There are many more elliptic curves that have useful applications for integration with existing systems or newly developed curves for zero-knowledge proofs.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adds a precompile that allows whole classes of curves to be used.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;A precompile that takes a curve and computes a linear combination of curve points.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Given integers &lt;code&gt;m, α&lt;&#x2F;code&gt; and &lt;code&gt;β&lt;&#x2F;code&gt;, scalars &lt;code&gt;s_i&lt;&#x2F;code&gt;, and curve points &lt;code&gt;A_i&lt;&#x2F;code&gt; construct the elliptic curve&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;y² = x³ + α ⋅ x + β  mod  m&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and compute the following&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;C = s₀ ⋅ A₀ + s₁ ⋅ A₁ + ⋯ + s_n ⋅ A_n&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;aka &lt;em&gt;linear combination&lt;&#x2F;em&gt;, &lt;em&gt;inner product&lt;&#x2F;em&gt;, &lt;em&gt;multi-multiplication&lt;&#x2F;em&gt; or even &lt;em&gt;multi-exponentiation&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(Cx, Cy) := ecmul(m, α, β,  s0, Ax0, As0, s1, Ax1, As1, ...)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;BASE_GAS = ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ADD_GAS  = ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MUL_GAS  = ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The total gas cost is &lt;code&gt;BASE_GAS&lt;&#x2F;code&gt; plus &lt;code&gt;ADD_GAS&lt;&#x2F;code&gt; for each &lt;code&gt;s_i&lt;&#x2F;code&gt; that is &lt;code&gt;1&lt;&#x2F;code&gt; and &lt;code&gt;MUL_GAS&lt;&#x2F;code&gt; for each &lt;code&gt;s_i &amp;gt; 1&lt;&#x2F;code&gt; (&lt;code&gt;s_i = 0&lt;&#x2F;code&gt; is free).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encoding-of-points&quot;&gt;Encoding of points&lt;&#x2F;h3&gt;
&lt;p&gt;Encode as &lt;code&gt;(x, y&#x27;)&lt;&#x2F;code&gt; where &lt;code&gt;s&lt;&#x2F;code&gt; indicates whether &lt;code&gt;y&lt;&#x2F;code&gt; or &lt;code&gt;-y&lt;&#x2F;code&gt; is to be taken. It follows SEC 1 v 1.9 2.3.4, except uncompressed points (&lt;code&gt;y&#x27; = 0x04&lt;&#x2F;code&gt;) are not supported.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;y&#x27;&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;&lt;code&gt;(x, y)&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Point at infinity&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x02&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Solution with &lt;code&gt;y&lt;&#x2F;code&gt; even&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x03&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Solution with &lt;code&gt;y&lt;&#x2F;code&gt; odd&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Conversion from affine coordinates to compressed coordinates is trivial: &lt;code&gt;y&#x27; = 0x02 | (y &amp;amp; 0x01)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;special-cases&quot;&gt;Special cases&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;Coordinate recovery.&lt;&#x2F;strong&gt; Set &lt;code&gt;s₀ = 1&lt;&#x2F;code&gt;. The output will be the recovered coordinates of &lt;code&gt;A₀&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;On-curve checking.&lt;&#x2F;strong&gt; Do coordinate recovery and compare &lt;code&gt;y&lt;&#x2F;code&gt; coordinate.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Addition.&lt;&#x2F;strong&gt; Set &lt;code&gt;s₀ = s₁ = 1&lt;&#x2F;code&gt;, the output will be &lt;code&gt;A₀ + A₁&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Doubling.&lt;&#x2F;strong&gt; Set &lt;code&gt;s₀ = 2&lt;&#x2F;code&gt;. The output will be &lt;code&gt;2 ⋅ A₀&lt;&#x2F;code&gt;. (Note: under the current gas model, this may be more costly than self-addition!)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Scalar multiplication.&lt;&#x2F;strong&gt; Set only &lt;code&gt;s₀&lt;&#x2F;code&gt; and &lt;code&gt;A₀&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Modular square root.&lt;&#x2F;strong&gt; Set &lt;code&gt;α = s₀ = A = 0&lt;&#x2F;code&gt; the output will have &lt;code&gt;Cy² = β   mod  m&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edge-cases&quot;&gt;Edge cases&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Non-prime moduli or too small modulus&lt;&#x2F;li&gt;
&lt;li&gt;Field elements larger than modulus&lt;&#x2F;li&gt;
&lt;li&gt;Curve has singular points (&lt;code&gt;4 α³ + 27 β² = 0&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Invalid sign bytes&lt;&#x2F;li&gt;
&lt;li&gt;x coordinate not on curve&lt;&#x2F;li&gt;
&lt;li&gt;Returning the point at infinity&lt;&#x2F;li&gt;
&lt;li&gt;(Please add if you spot more)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Generic Field and Curve.&lt;&#x2F;strong&gt; Many important optimizations are independent of the field and curve used. Some missed specific optimizations are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Reductions specific to the binary structure of the field prime.&lt;&#x2F;li&gt;
&lt;li&gt;Precomputation of Montgomery factors.&lt;&#x2F;li&gt;
&lt;li&gt;Precomputation of multiples of certain popular points like the generator.&lt;&#x2F;li&gt;
&lt;li&gt;Special point addition&#x2F;doubling &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.hyperelliptic.org&#x2F;EFD&#x2F;g1p&#x2F;auto-shortw.html&quot;&gt;formulas&lt;&#x2F;a&gt; for &lt;code&gt;α = -3&lt;&#x2F;code&gt;, &lt;code&gt;α = -1&lt;&#x2F;code&gt;, &lt;code&gt;α = 0&lt;&#x2F;code&gt;, &lt;code&gt;β = 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;TODO: The special cases for &lt;code&gt;α&lt;&#x2F;code&gt; and &lt;code&gt;β&lt;&#x2F;code&gt; might be worth implementing and offering a gas discount.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Compressed Coordinates.&lt;&#x2F;strong&gt; Compressed coordinates allow contract to work with only &lt;code&gt;x&lt;&#x2F;code&gt; coordinates and sign bytes. It also prevents errors around points not being on-curve. Conversion to compressed coordinates is trivial.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Linear Combination.&lt;&#x2F;strong&gt; We could instead have a simple multiply &lt;code&gt;C = r ⋅ A&lt;&#x2F;code&gt;. In this case we would need a separate pre-compile for addition. In addition, a linear combination allows for optimizations that like Shamir&#x27;s trick that are not available in a single scalar multiplication. ECDSA requires &lt;code&gt;s₀ ⋅ A₀ + s₁ ⋅ A₁&lt;&#x2F;code&gt; and would benefit from this.&lt;&#x2F;p&gt;
&lt;p&gt;The BN254 (aka alt_bn8) multiplication operation introduced by the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt; precompile only handles a single scalar multiplication. The missed performance is such that for two or more points it is cheaper to use EVM, as practically demonstrated by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;aztec-protocol&#x2F;huffing-for-crypto-with-weierstrudel-9c9568c06901&quot;&gt;Weierstrudel&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Variable Time Math.&lt;&#x2F;strong&gt; When called during a transaction, there is no assumption of privacy and no mitigations for side-channel attacks are necessary.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Prime Fields.&lt;&#x2F;strong&gt; This EIP is for fields of large characteristic. It does not cover Binary fields and other fields of non-prime characteristic.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;256-bit modulus.&lt;&#x2F;strong&gt; This EIP is for field moduli less than &lt;code&gt;2^{256}&lt;&#x2F;code&gt;. This covers many of the popular curves while still having all parameters fit in a single EVM word.&lt;&#x2F;p&gt;
&lt;p&gt;TODO: Consider a double-word version. 512 bits would cover all known curves except E-521. In particular it will cover the NIST P-384 curve used by the Estonian e-Identity and the BLS12-381 curve used by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;z.cash&#x2F;blog&#x2F;new-snark-curve&#x2F;&quot;&gt;ZCash Sappling&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Short Weierstrass Curves.&lt;&#x2F;strong&gt; This EIP is for fields specified in short Weierstrass form. While any curve can be converted to short Weierstrass form through a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;safecurves.cr.yp.to&#x2F;equation.html&quot;&gt;substitution of variables&lt;&#x2F;a&gt;, this misses out on the performance advantages of those specific forms.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;There will be a reference implementation in Rust based on the existing libraries (in particular those by ZCash and The Matter Inc.).&lt;&#x2F;p&gt;
&lt;p&gt;The reference implementation will be production grade and compile to a native library with a C api and a webassembly version. Node developers are encouraged to use the reference implementation and can use either the rust library, the native C bindings or the webassembly module. Node developers can of course always decide to implement their own.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP overlaps in scope with&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt;: ecadd, ecmul for altbn128&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;603&quot;&gt;EIP issue 603&lt;&#x2F;a&gt;: ecadd, ecmul for SECP256k1.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;665&#x2F;&quot;&gt;EIP-665&lt;&#x2F;a&gt;: ECDSA verify for ED25519.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt;: Optimize ecadd and ecmul for altbn128.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Disable SSTORE with gasleft lower than call stipend</title>
        <published>2019-01-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Forshtat</name><email>alex@tabookey.com</email>
	</author>
	
	<author>
		<name>Yoav Weiss</name><email>yoav@tabookey.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1706/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/alex-forshtat-tbk/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1706/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        

        
        <category
            term="tag:eip:1706"
            label="EIP-1706" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1706/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The proposal that had been accepted changes security properties of a large portion of an existing contract code base that may be infeasible to update and validate. This proposal will make the old assumptions hold even after a network upgrade.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;&quot;&gt;EIP-1283&lt;&#x2F;a&gt; significantly lowers the gas costs of writing to contract&#x27;s storage. This created a danger of a new kind of reentrancy attacks on existing contracts as Solidity by default grants a &#x27;stipend&#x27; of 2300 gas to simple transfer calls.
This danger is easily mitigated if SSTORE is not allowed in low gasleft state, without breaking the backward compatibility and the original intention of this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;An attack that is described in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;chainsecurity&#x2F;constantinople-enables-new-reentrancy-attack-ace4088297d9&quot;&gt;this article&lt;&#x2F;a&gt;.
Explicitly specifying the call stipend as an invariant will have a positive effect on Ethereum protocol security:
https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;ethereum&#x2F;comments&#x2F;agdqsm&#x2F;security_alert_ethereum_constantinople&#x2F;ee5uvjt&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add the following condition to the SSTORE opcode gas cost calculation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;gasleft&lt;&#x2F;em&gt; is less than or equal to 2300, fail the current call frame
with &#x27;out of gas&#x27; exception.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In order to keep in place the implicit reentrancy protection of existing contracts, transactions should not be allowed to modify state if the remaining gas is lower then the 2300 stipend given to &#x27;transfer&#x27;&#x2F;&#x27;send&#x27; in Solidity.
These are other proposed remediations and objections to implementing them:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Drop EIP-1283 and abstain from modifying SSTORE cost
&lt;ul&gt;
&lt;li&gt;EIP-1283 is an important update&lt;&#x2F;li&gt;
&lt;li&gt;It was accepted and implemented on test networks and in clients.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add a new call context that permits LOG opcodes but not changes to state.
&lt;ul&gt;
&lt;li&gt;Adds another call type beyond existing regular&#x2F;staticcall&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Raise the cost of SSTORE to dirty slots to &amp;gt;=2300 gas
&lt;ul&gt;
&lt;li&gt;Makes net gas metering much less useful.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Reduce the gas stipend
&lt;ul&gt;
&lt;li&gt;Makes the stipend almost useless.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Increase the cost of writes to dirty slots back to 5000 gas, but add 4800 gas to the refund counter
&lt;ul&gt;
&lt;li&gt;Still doesn’t make the invariant explicit.&lt;&#x2F;li&gt;
&lt;li&gt;Requires callers to supply more gas, just to have it refunded&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Add contract metadata specifying per-contract EVM version, and only apply SSTORE changes to contracts deployed with the new version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Performing SSTORE has never been possible with less than 5000 gas, so it does not introduce incompatibility to the Ethereum mainnet. Gas estimation should account for this requirement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases for an implementation are mandatory for EIPs that are affecting consensus changes. Other EIPs can choose to include links to test cases if applicable.
TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Temporal Replay Protection</title>
        <published>2019-01-08T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1681/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/temporal-replay-protection/2355" />
        

        <id>https://wg-eips.ritovision.com/1681/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1681"
            label="EIP-1681" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1681/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes adding a &#x27;temporal&#x27; replay protection to transactions, in the form of a &lt;code&gt;valid-until&lt;&#x2F;code&gt; timestamp.
This EIP is very similar to https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;599 by Nick Johnson and Konrad Feldmeier, the main difference
being that this EIP is based on clock-time &#x2F; walltime instead of block numbers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There are a couple of different motivators for introducing a timebased transaction validity.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If any form of dust-account clearing is introduced, e.g. (https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;168), it will be necessary
to introduce a replay protection, such as https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;169 . Having temporal replay protection removes the need
to change nonce-behaviour in the state, since transactions would not be replayable at a later date than explicitly set by the user.&lt;&#x2F;li&gt;
&lt;li&gt;In many cases, such as during ICOs, a lot of people want their transactions to either become included soon (within a couple of hours) or not at all. Currently,
transactions are queued and may not execute for several days, at a cost for both the user (who ends up paying gas for a failing purchase) and the network, dealing with the large transaction queues.&lt;&#x2F;li&gt;
&lt;li&gt;Node implementations have no commonly agreed metric for which transactions to keep, discard or propagate. Having a TTL on transactions would make it easier to remove stale transactions from the system.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The roll-out would be performed in two phases, &lt;code&gt;X&lt;&#x2F;code&gt; (hardfork), and &lt;code&gt;Y&lt;&#x2F;code&gt; (softfork).&lt;&#x2F;p&gt;
&lt;p&gt;At block &lt;code&gt;X&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Add an optional field &lt;code&gt;valid-until&lt;&#x2F;code&gt; to the RLP-encoded transaction, defined as a &lt;code&gt;uint64&lt;&#x2F;code&gt; (same as &lt;code&gt;nonce&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;If the field is present in transaction &lt;code&gt;t&lt;&#x2F;code&gt;, then
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;t&lt;&#x2F;code&gt; is only eligible for inclusion in a block if &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; &amp;lt; &lt;code&gt;t.valid-until&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;At block &lt;code&gt;Y&lt;&#x2F;code&gt;,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Make &lt;code&gt;valid-until&lt;&#x2F;code&gt; mandatory, and consider any transaction without &lt;code&gt;valid-until&lt;&#x2F;code&gt; to be invalid.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;rationale-for-this-eip&quot;&gt;Rationale for this EIP&lt;&#x2F;h3&gt;
&lt;p&gt;For the dust-account clearing usecase,&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;This change is much less invasive in the consensus engine.
&lt;ul&gt;
&lt;li&gt;No need to maintain a consensus-field of &#x27;highest-known-nonce&#x27; or cap the number of transactions from a sender in a block.&lt;&#x2F;li&gt;
&lt;li&gt;Only touches the transaction validation part of the consensus engine&lt;&#x2F;li&gt;
&lt;li&gt;Other schemas which uses the &lt;code&gt;nonce&lt;&#x2F;code&gt; can have unintended side-effects,
&lt;ul&gt;
&lt;li&gt;such as inability to create contracts at certain addresses.&lt;&#x2F;li&gt;
&lt;li&gt;more difficult to integrate with offline signers, since more elaborate nonce-schemes requires state access to determine.&lt;&#x2F;li&gt;
&lt;li&gt;More intricate schemes like &lt;code&gt;highest-nonce&lt;&#x2F;code&gt; are a lot more difficult, since highest-known-nonce will be a consensus-struct that is incremented and possibly reverted during transaction execution, requiring one more journalled field.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale-for-walltime&quot;&gt;Rationale for walltime&lt;&#x2F;h3&gt;
&lt;p&gt;Why use walltime instead of block numbers, as proposed in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;599 ?&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The UTC time is generally available in most settings, even on a computer which is offline. This means that even a setup where blockchain information is unavailable, the party signing a transaction can generate a transaction with the desired properties.&lt;&#x2F;li&gt;
&lt;li&gt;The correlation between time and block number is not fixed; even though a 14s blocktime is &#x27;desired&#x27;, this varies due to both network hashrate and difficulty bomb progression.&lt;&#x2F;li&gt;
&lt;li&gt;The block number is even more unreliable as a timestamp for testnets and private networks.&lt;&#x2F;li&gt;
&lt;li&gt;UTC time is more user-friendly, a user can more easily decide on reasonable end-date for a transaction, rather than a suitalbe number of valid blocks.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP means that all software&#x2F;hardware that creates transactions need to add timestamps to the transactions, or will otherwise be incapable of signing transactions after block &lt;code&gt;Y&lt;&#x2F;code&gt;. Note: this EIP does not introduce any maximum &lt;code&gt;valid-until&lt;&#x2F;code&gt; date, so it would still be possible to create
transactions with near infinite validity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;todo&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;None yet&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The most notable security impact is that pre-signed transactions stored on paper backups, will become invalid as of block &lt;code&gt;Y&lt;&#x2F;code&gt;. There are a couple of cases where this might be used&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Pregenerated onetime &#x27;bootstrap&#x27; transactions, e.g. to onboard a user into Ethereum. Instead of giving a user a giftcard with actual ether on it, someone may instead give the person a one-time pregenerated transaction that will only send those ether to the card once the
user actively wants to start using it.&lt;&#x2F;li&gt;
&lt;li&gt;If a user has an offline paper-wallet, he may have pregenerated transactions to send value to e.g. an exchange. This is sometimes done to be able to send ether to an exchange without having to go through all the hoops of bringing the paper wallet back to &#x27;life&#x27;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Secondary security impacts are that the addition of a timestamp would make the transactions a little bit larger.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Storage Rent</title>
        <published>2018-11-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Felix J Lange</name><uri>https://github.com/fjl</uri>
	</author>
	
	<author>
		<name>Martin Holst Swende</name><uri>https://github.com/holiman</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1682/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/storage-rent-eip/2357" />
        

        <id>https://wg-eips.ritovision.com/1682/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1682"
            label="EIP-1682" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1682/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP describes a scheme to charge for data in state, and &#x27;archive&#x27; data which is no longer being paid for. It also describes how resurrection of &#x27;archived&#x27; data happens.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Ethereum blockchain in its current form is not sustainable because it grows
indefinitely. This is true of any blockchain, but Ethereum grows faster than most chains.
Many implementation strategies to slow down growth exist. A common strategy is &#x27;state
pruning&#x27; which discards historical state, keeping only the active copy of contract data
and a few recent versions to deal with short-range chain reorganizations. Several
implementations also employ compression techniques to keep the active copy of the state as
small as possible.&lt;&#x2F;p&gt;
&lt;p&gt;A full node participating in consensus today requires storing large amounts of data even
with advanced storage optimizations applied. Future storage requirements are unbounded
because any data stored in a contract must be retained forever as dictated by the
protocol. This EIP attempts to correct this by adding new consensus rules that put an
upper bound on the size of the Ethereum state.&lt;&#x2F;p&gt;
&lt;p&gt;Adding these new rules changes fundamental guarantees of the system and requires a hard
fork. Users of Ethereum already pay for the creation and modification of accounts and
their storage entries. Under the rules introduced in this EIP, users must also pay to keep
accounts accessible. A similar rent scheme was proposed in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;35&quot;&gt;EIP-103&lt;&#x2F;a&gt; but rejected
even back then because the proposal would&#x27;ve upset peoples expectations. As implementers
of Ethereum, we still feel that state rent is the right path to long-term sustainability
of the Ethereum blockchain and that its undesirable implications can be overcome with
off-protocol tooling and careful design.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The cost of storing an account over time is called &lt;code&gt;rent&lt;&#x2F;code&gt;. The amount of &lt;code&gt;rent&lt;&#x2F;code&gt; due depends
on the size of the account. The &lt;code&gt;ether&lt;&#x2F;code&gt; that is paid for &lt;code&gt;rent&lt;&#x2F;code&gt; is destroyed. The &lt;code&gt;rent&lt;&#x2F;code&gt; is deducted whenever an account is touched.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;rent&lt;&#x2F;code&gt; can be paid from the account&#x27;s regular &lt;code&gt;balance&lt;&#x2F;code&gt; or from its &#x27;rent balance&#x27;. Accounts
can be endowed with &lt;code&gt;rent balance&lt;&#x2F;code&gt; through a new EVM opcode. When &lt;code&gt;rent&lt;&#x2F;code&gt; is charged, it is
first taken from the &lt;code&gt;rent balance&lt;&#x2F;code&gt;. When &lt;code&gt;rent balance&lt;&#x2F;code&gt; is zero, it is instead charged from the account&#x27;s regular &lt;code&gt;balance&lt;&#x2F;code&gt; instead.&lt;&#x2F;p&gt;
&lt;p&gt;The reason to separate &lt;code&gt;balance&lt;&#x2F;code&gt; and &lt;code&gt;rent balance&lt;&#x2F;code&gt; is that certain contracts do not accept &lt;code&gt;ether&lt;&#x2F;code&gt; sends, or always send the entire balance off to some other destination. For these cases, a separate&lt;code&gt;rent balance&lt;&#x2F;code&gt; is required.&lt;&#x2F;p&gt;
&lt;p&gt;When an account&#x27;s &lt;code&gt;balance&lt;&#x2F;code&gt; is insufficient to pay rent, the account becomes &lt;code&gt;inactive&lt;&#x2F;code&gt;. Its
storage and contract code are removed. Inactive accounts cannot be interacted with, i.e.
it behaves as if it has no contract code.&lt;&#x2F;p&gt;
&lt;p&gt;Inactive accounts can be restored by re-uploading their storage. To restore an inactive
account &lt;code&gt;A&lt;&#x2F;code&gt;, a new account &lt;code&gt;B&lt;&#x2F;code&gt; is created with arbitrary code and its storage modified
with &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations until it matches the storage root of &lt;code&gt;A&lt;&#x2F;code&gt;. Account &lt;code&gt;B&lt;&#x2F;code&gt; can restore
&lt;code&gt;A&lt;&#x2F;code&gt; through the &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; opcode. This means the cost of restoring an account is
equivalent to recreating it via successive &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;changes-to-state&quot;&gt;Changes To State&lt;&#x2F;h3&gt;
&lt;p&gt;At the top level, a new key &lt;code&gt;size&lt;&#x2F;code&gt; is added to the accounts trie. This key tracks the
total number of trie nodes across all accounts, including storage trie nodes. To track
rent, the structure of account entries is changed as well.&lt;&#x2F;p&gt;
&lt;p&gt;Before processing the block in which this EIP becomes active, clients iterate the whole
state once to count the number of trie nodes and to change the representation of all
accounts to the new format.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;account-representation&quot;&gt;Account Representation&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;account = [nonce, balance, storageroot, codehash, rentbalance, rentblock, storagesize]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Each account gets three additional properties: &lt;code&gt;rentbalance&lt;&#x2F;code&gt;, &lt;code&gt;rentblock&lt;&#x2F;code&gt; and
&lt;code&gt;storagesize&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;rentbalace&lt;&#x2F;code&gt; field tracks the amount of &lt;code&gt;rent balance&lt;&#x2F;code&gt; available to the account. Upon
self-destruction any remaining &lt;code&gt;rent balance&lt;&#x2F;code&gt; is transferred to the beneficiary. Any
modification of the account recomputes its current &lt;code&gt;rent balance&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;rentblock&lt;&#x2F;code&gt; field tracks the block number in which the &lt;code&gt;rent balance&lt;&#x2F;code&gt; was last
recomputed. Upon creation, this field is initialized with the current block number.
&lt;code&gt;rentblock&lt;&#x2F;code&gt; is also updated with the current block number whenever the account is
modified.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;storagesize&lt;&#x2F;code&gt; field tracks the amount of storage related to the account. It is a
number containing the number of storage slots currently set. The &lt;code&gt;storagesize&lt;&#x2F;code&gt; of an
inactive account is zero.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;charging-rent&quot;&gt;Charging Rent&lt;&#x2F;h3&gt;
&lt;p&gt;There is a new protocol constant &lt;code&gt;MAX_STORAGE_SIZE&lt;&#x2F;code&gt; that specifies the upper bound on the
number of state tree nodes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_STORAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ~160GB of state&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;A &#x27;storage fee factor&#x27; for each block is derived from this constant such that fees
increase as the limit is approached.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; storagefee_factor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ramp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MAX_STORAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MAX_STORAGE_SIZE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; total_storage_size&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;22&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; ramp&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When a block is processed, &lt;code&gt;rent&lt;&#x2F;code&gt; is deducted from all accounts modified by transactions in
the block after the transactions have been processed. The amount due for each account is
based on the account&#x27;s storage size.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; rent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentblock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentblock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span&gt; storagefee_factor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; prestate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storagesize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; storagefee_factor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storagesize&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; charge_rent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; rent&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prestate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; currentblock&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;=&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        fee&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span&gt; poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentbalance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -=&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fee&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    poststate&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rentblock&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; currentblock&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;new-evm-opcodes&quot;&gt;New EVM Opcodes&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;payrent-amount-addr&quot;&gt;&lt;code&gt;PAYRENT &amp;lt;amount&amp;gt; &amp;lt;addr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;At any time, the &lt;code&gt;rent balance&lt;&#x2F;code&gt; of an account may be topped up by the &lt;code&gt;PAYRENT&lt;&#x2F;code&gt; opcode.
&lt;code&gt;PAYRENT&lt;&#x2F;code&gt; deducts the given amount of &lt;code&gt;ether&lt;&#x2F;code&gt; from the account executing the opcode and adds
it to the &lt;code&gt;rent balance&lt;&#x2F;code&gt; of the address specified as beneficiary.&lt;&#x2F;p&gt;
&lt;p&gt;Any participant can pay the rent for any other participant.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: TBD&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rentbalance-addr&quot;&gt;&lt;code&gt;RENTBALANCE &amp;lt;addr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;rent balance&lt;&#x2F;code&gt; of an account may be queried through the &lt;code&gt;RENTBALANCE&lt;&#x2F;code&gt; opcode. It pushes the
&lt;code&gt;rentbalance&lt;&#x2F;code&gt; field of the given address to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: like &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ssize-addr&quot;&gt;&lt;code&gt;SSIZE &amp;lt;addr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This opcode pushes the &lt;code&gt;storagesize&lt;&#x2F;code&gt; field of the given account to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: like &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;restoreto-addr-codeaddr&quot;&gt;&lt;code&gt;RESTORETO &amp;lt;addr&amp;gt; &amp;lt;codeaddr&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;This opcode restores the inactive account at the given address. This is a bit like
&lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; but has more specific semantics.&lt;&#x2F;p&gt;
&lt;p&gt;The account at &lt;code&gt;addr&lt;&#x2F;code&gt; must be &lt;code&gt;inactive&lt;&#x2F;code&gt; (i.e. have &lt;code&gt;storagesize&lt;&#x2F;code&gt; zero) and its
&lt;code&gt;storageroot&lt;&#x2F;code&gt; must match the &lt;code&gt;storageroot&lt;&#x2F;code&gt; of the contract executing &lt;code&gt;RESTORETO&lt;&#x2F;code&gt;. The
&lt;code&gt;codeaddr&lt;&#x2F;code&gt; specifies the address of a contract from which code is taken. The code of the
&lt;code&gt;codeaddr&lt;&#x2F;code&gt; account must match the &lt;code&gt;codehash&lt;&#x2F;code&gt; of &lt;code&gt;addr&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If all these preconditions are met, &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; transfers the storage of the account
executing the opcode to &lt;code&gt;addr&lt;&#x2F;code&gt; and resets its &lt;code&gt;storagesize&lt;&#x2F;code&gt; to the full size of the
storage. The code of &lt;code&gt;addr&lt;&#x2F;code&gt; is restored as well. &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; also transfers any remaining
balance and rent balance to &lt;code&gt;addr&lt;&#x2F;code&gt;. The contract executing &lt;code&gt;RESTORETO&lt;&#x2F;code&gt; is deleted.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost: TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;why-do-we-need-a-separate-rent-balance&quot;&gt;Why do we need a separate rent balance?&lt;&#x2F;h3&gt;
&lt;p&gt;Accounts need a separate rent balance because some contracts are non-payable, i.e. they
reject regular value transfers. Such contracts might not be able to keep themselves alive,
but users of those contracts can keep them alive by paying rent for them.&lt;&#x2F;p&gt;
&lt;p&gt;Having the additional balance also makes things easier for contracts that hold balance on
behalf of a user. Consider the canonical crowdfunding example, a contract which changes
behavior once a certain balance is reached and which tracks individual user&#x27;s balances.
Deducting rent from the main balance of the contract would mess up the contract&#x27;s
accounting, leaving it unable to pay back users accurately if the threshold balance isn&#x27;t
reached.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;why-restoration&quot;&gt;Why restoration?&lt;&#x2F;h3&gt;
&lt;p&gt;One of the fundamental guarantees provided by Ethereum is that changes to contract storage
can only be made by the contract itself and storage will persist forever. If you hold a
token balance in a contract, you&#x27;ll have those tokens forever. By adding restoration, we
can maintain this guarantee to a certain extent.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation-impact&quot;&gt;Implementation Impact&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed changes tries to fit within the existing state transition model. Note that
there is no mechanism for deactivating accounts the moment they can&#x27;t pay rent. Users must
touch accounts to ensure their storage is removed because we&#x27;d need to track all accounts
and their rent requirements in an auxlilary data structure otherwise.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>TEthashV1</title>
        <published>2018-11-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>trustfarm</name><email>trustfarm.info@gmail.com</email>
	</author>
	
	<author>
		<name>trustfarm</name><email>cpplover@trustfarm.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1485/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/anti-eth-asic-mining-eip-1488-pr/1807" />
        

        <id>https://wg-eips.ritovision.com/1485/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1485"
            label="EIP-1485" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1485/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies ethash in order to break ASIC miners specialized for the current ethash mining algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP pursue &quot;obsolete current ASIC miners&quot; by modifying PoW algorithm in a very low risk manner and update to latest hash algorithm from deprecated FNV Hash algorithms.&lt;&#x2F;p&gt;
&lt;p&gt;Following TEthashV1 algorithm suggests safe transition of PoW algorithms and secure the FNV Algorithm in MIX Parts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Provide original Ethash proof of work verification with minimal set of changes by updating FNV0 algorithm&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;1-reference-materials-on-ethash-fnv0&quot;&gt;1. Reference materials on ETHASH FNV0&lt;&#x2F;h4&gt;
&lt;h4 id=&quot;where-fnv-applied-on-ethash&quot;&gt;Where FNV Applied on ETHASH&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20200505215203&#x2F;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;wiki&#x2F;wiki&#x2F;Ethash&quot;&gt;ETHASH&lt;&#x2F;a&gt;, FNV Hash is used on&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;ol&gt;
&lt;li&gt;On data aggregation function, MIX parts.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Ethash Algorithm&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  Header + Nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      Keccak &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    **[MIX 0]**  --&amp;gt; **[DAG Page]**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |               |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       Mixing         &amp;lt;--|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    **[Mix 63]**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;         |-----&amp;gt; Mix64  [Process] ---&amp;gt; Mix Digest [32B]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;FNV used in DAG Generation
and Mixing for random access or DAG Page.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;2-current-applied-ethash-fnv-hash-implementation-is-deprecated-now&quot;&gt;2. Current applied Ethash FNV hash implementation is deprecated now.&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-0_hash_(deprecated)&quot;&gt;FNV-0_hash (deprecated)&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It is a simple way of hashing algorithm&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; hash = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; for each byte_of_data to be hashed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 	hash = hash × FNV_prime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; 	hash = hash XOR octet_of_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt; return hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;When analysed FNV-0 , there&#x27;s very weak &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;simple.wikipedia.org&#x2F;wiki&#x2F;Avalanche_effect&quot;&gt;avalanche effect&lt;&#x2F;a&gt;, when hash input changes on 1~2bits. refer &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tao-foundation&#x2F;FNV-Analysis#how-to-test-and-analysis-reference-test-code&quot;&gt;FNV-Analysis reference section&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;We need to research and apply newer FNV hash or short message hash algorithm.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-fnv1a-hash-algorithm-description&quot;&gt;3. FNV1A hash algorithm description&lt;&#x2F;h4&gt;
&lt;p&gt;Previous proposed algorithm based on FNV1 &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1355&#x2F;&quot;&gt;EIP-1355&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There&#x27;s an implementation that looks like &quot;Missing Offset Bias&quot; at &lt;strong&gt;FNV1A&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Quotation of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash&quot;&gt;original algorithm FNV1A&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;use hash offset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV-1a hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;The FNV-1a hash differs from the FNV-1 hash by only the order in which the multiply and XOR is performed:[8][10]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   hash = FNV_offset_basis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   for each byte_of_data to be hashed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   	hash = hash XOR byte_of_data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   	hash = hash × FNV_prime&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;   return hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;FNV_offset_basis and computation order change of xor and multiplication Makes one more xor and multiply computation, but more secure hash effects than FNV0.
and make dispersion boundary condition (0, even number, ..) by using of Prime Number.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;4-real-implementation-for-fnv1a&quot;&gt;4. Real Implementation for FNV1A&lt;&#x2F;h4&gt;
&lt;p&gt;Consider real computation resources, in TEthashV1 uses hash byte_of_data to 4bytes aligned data.&lt;&#x2F;p&gt;
&lt;p&gt;In TETHashV1, Adapts fully follow the FNV1A implementation.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TETHASHV1 FNV1A implementation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Following are reference implementation of FNV1A adapted in TETHashV1.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reference Pseudo c&#x2F;cpp implementation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01000193&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;811c9dc5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;         (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a_reduce&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;c&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Another Byte aligned implementation of FNV1A , call to FNV1c&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;   0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;01000193&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;  0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;811c9dc5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;U&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;           (&lt;&#x2F;span&gt;&lt;span&gt;  (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;                                          \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                                (&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt; )&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                            ^&lt;&#x2F;span&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;16&lt;&#x2F;span&gt;&lt;span&gt;  )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                            ^&lt;&#x2F;span&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;   )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                            ^&lt;&#x2F;span&gt;&lt;span&gt;   (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;      )&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;000000ff&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                            )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;define&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1c&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;x&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;            (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;fnv1i&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;x&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;y&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;5-fnv-analysis&quot;&gt;5. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tao-foundation&#x2F;FNV-Analysis&quot;&gt;FNV-Analysis&lt;&#x2F;a&gt;&lt;&#x2F;h4&gt;
&lt;p&gt;FNV Mix Algorithm Analysis for TEthashV1&lt;&#x2F;p&gt;
&lt;h4 id=&quot;how-to-test-and-analysis-reference-test-code&quot;&gt;How to test and analysis reference test code.&lt;&#x2F;h4&gt;
&lt;p&gt;You can compile it with simple in terminal.
No additional library needs,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;gcc&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;o&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; fnvtest&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; fnvcltest.c&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And You can execute it&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fnvtest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,00)::VEC(0, 0, ffffffff, 0)::      FNV  :00000000, DF=00000000(00) DS(00000000), FNV1 :00000000, DF=00000000(00) DS(00000000), FNV1a:117697cd, DF=117697cd(17) DS(117697cd), FNV1c:1210d00f, DF=127f8dbf(20) DS(11a1725f),         F___RC=efe1b9c4, DF:efe1b9c4(19) , F1__RC=deb68dfe, DF:deb68dfe(22) , F1A_RC=99bad28b, DF:99bad28b(17) , F1C_RC=e29fa497, DF:e29fa497(18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,01)::VEC(0, 1, ffffffff, 0)::      FNV  :00000001, DF=00000001(01) DS(00000001), FNV1 :01000193, DF=01000193(06) DS(01000193), FNV1a:1076963a, DF=010001f7(09) DS(01000193), FNV1c:1110ce7c, DF=03001e73(11) DS(01000193),         F___RC=fefffe6d, DF:111e47a9(14) , F1__RC=d9fd8597, DF:074b0869(12) , F1A_RC=72c287e0, DF:eb78556b(19) , F1C_RC=6b6991ef, DF:89f63578(17)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,02)::VEC(0, 2, ffffffff, 0)::      FNV  :00000002, DF=00000003(02) DS(00000001), FNV1 :02000326, DF=030002b5(08) DS(01000193), FNV1a:0f7694a7, DF=1f00029d(11) DS(01000193), FNV1c:1410d335, DF=05001d49(09) DS(030004b9),         F___RC=d8fd8404, DF:26027a69(13) , F1__RC=9b16d24c, DF:42eb57db(19) , F1A_RC=c17f0ecb, DF:b3bd892b(18) , F1C_RC=a5be8e78, DF:ced71f97(21)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,03)::VEC(0, 3, ffffffff, 0)::      FNV  :00000003, DF=00000001(01) DS(00000001), FNV1 :030004b9, DF=0100079f(10) DS(01000193), FNV1a:0e769314, DF=010007b3(09) DS(01000193), FNV1c:1310d1a2, DF=07000297(09) DS(01000193),         F___RC=b2fb099b, DF:6a068d9f(16) , F1__RC=5c301f01, DF:c726cd4d(17) , F1A_RC=94cf402e, DF:55b04ee5(16) , F1C_RC=aea1a025, DF:0b1f2e5d(17)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,04)::VEC(0, 4, ffffffff, 0)::      FNV  :00000004, DF=00000007(03) DS(00000001), FNV1 :0400064c, DF=070002f5(10) DS(01000193), FNV1a:0d769181, DF=03000295(07) DS(01000193), FNV1c:0e10c9c3, DF=1d001861(09) DS(050007df),         F___RC=8cf88f32, DF:3e0386a9(14) , F1__RC=1d496bb6, DF:417974b7(17) , F1A_RC=89401d59, DF:1d8f5d77(20) , F1C_RC=e4e96c7c, DF:4a48cc59(13)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,05)::VEC(0, 5, ffffffff, 0)::      FNV  :00000005, DF=00000001(01) DS(00000001), FNV1 :050007df, DF=01000193(06) DS(01000193), FNV1a:0c768fee, DF=01001e6f(11) DS(01000193), FNV1c:0d10c830, DF=030001f3(09) DS(01000193),         F___RC=66f614c9, DF:ea0e9bfb(20) , F1__RC=de62b86b, DF:c32bd3dd(19) , F1A_RC=346e222c, DF:bd2e3f75(21) , F1C_RC=502e5f82, DF:b4c733fe(20)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,06)::VEC(0, 6, ffffffff, 0)::      FNV  :00000006, DF=00000003(02) DS(00000001), FNV1 :06000972, DF=03000ead(10) DS(01000193), FNV1a:0b768e5b, DF=070001b5(09) DS(01000193), FNV1c:1010cce9, DF=1d0004d9(10) DS(030004b9),         F___RC=40f39a60, DF:26058ea9(13) , F1__RC=9f7c0520, DF:411ebd4b(16) , F1A_RC=b376a527, DF:8718870b(13) , F1C_RC=1241a9a4, DF:426ff626(17)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,07)::VEC(0, 7, ffffffff, 0)::      FNV  :00000007, DF=00000001(01) DS(00000001), FNV1 :07000b05, DF=01000277(08) DS(01000193), FNV1a:0a768cc8, DF=01000293(06) DS(01000193), FNV1c:0f10cb56, DF=1f0007bf(15) DS(01000193),         F___RC=1af11ff7, DF:5a028597(13) , F1__RC=609551d5, DF:ffe954f5(22) , F1A_RC=14293bea, DF:a75f9ecd(21) , F1C_RC=49d34bba, DF:5b92e21e(16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,08)::VEC(0, 8, ffffffff, 0)::      FNV  :00000008, DF=0000000f(04) DS(00000001), FNV1 :08000c98, DF=0f00079d(12) DS(01000193), FNV1a:09768b35, DF=030007fd(12) DS(01000193), FNV1c:1a10dca7, DF=150017f1(12) DS(0b001151),         F___RC=f4eea58e, DF:ee1fba79(21) , F1__RC=21ae9e8a, DF:413bcf5f(19) , F1A_RC=eeebb7a5, DF:fac28c4f(17) , F1C_RC=7da04f47, DF:347304fd(16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,09)::VEC(0, 9, ffffffff, 0)::      FNV  :00000009, DF=00000001(01) DS(00000001), FNV1 :09000e2b, DF=010002b3(07) DS(01000193), FNV1a:087689a2, DF=01000297(07) DS(01000193), FNV1c:1910db14, DF=030007b3(10) DS(01000193),         F___RC=ceec2b25, DF:3a028eab(14) , F1__RC=e2c7eb3f, DF:c36975b5(18) , F1A_RC=54e1aef8, DF:ba0a195d(15) , F1C_RC=d425e1af, DF:a985aee8(16)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0a)::VEC(0, a, ffffffff, 0)::      FNV  :0000000a, DF=00000003(02) DS(00000001), FNV1 :0a000fbe, DF=03000195(07) DS(01000193), FNV1a:0776880f, DF=0f0001ad(10) DS(01000193), FNV1c:1c10dfcd, DF=050004d9(08) DS(030004b9),         F___RC=a8e9b0bc, DF:66059b99(15) , F1__RC=a3e137f4, DF:4126dccb(15) , F1A_RC=213fcd63, DF:75de639b(20) , F1C_RC=7e1d2751, DF:aa38c6fe(18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0b)::VEC(0, b, ffffffff, 0)::      FNV  :0000000b, DF=00000001(01) DS(00000001), FNV1 :0b001151, DF=01001eef(12) DS(01000193), FNV1a:0676867c, DF=01000e73(09) DS(01000193), FNV1c:1b10de3a, DF=070001f7(11) DS(01000193),         F___RC=82e73653, DF:2a0e86ef(16) , F1__RC=64fa84a9, DF:c71bb35d(19) , F1A_RC=5598ce46, DF:74a70325(14) , F1C_RC=6400c630, DF:1a1de161(14)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0c)::VEC(0, c, ffffffff, 0)::      FNV  :0000000c, DF=00000007(03) DS(00000001), FNV1 :0c0012e4, DF=070003b5(10) DS(01000193), FNV1a:057684e9, DF=03000295(07) DS(01000193), FNV1c:1610d65b, DF=0d000861(07) DS(050007df),         F___RC=5ce4bbea, DF:de038db9(17) , F1__RC=2613d15e, DF:42e955f7(18) , F1A_RC=6a220ff1, DF:3fbac1b7(20) , F1C_RC=6e781da4, DF:0a78db94(15)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0d)::VEC(0, d, ffffffff, 0)::      FNV  :0000000d, DF=00000001(01) DS(00000001), FNV1 :0d001477, DF=01000693(07) DS(01000193), FNV1a:04768356, DF=010007bf(11) DS(01000193), FNV1c:1510d4c8, DF=03000293(07) DS(01000193),         F___RC=36e24181, DF:6a06fa6b(17) , F1__RC=e72d1e13, DF:c13ecf4d(18) , F1A_RC=168d4944, DF:7caf46b5(19) , F1C_RC=65bbcfa1, DF:0bc3d205(13)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0e)::VEC(0, e, ffffffff, 0)::      FNV  :0000000e, DF=00000003(02) DS(00000001), FNV1 :0e00160a, DF=0300027d(09) DS(01000193), FNV1a:037681c3, DF=07000295(08) DS(01000193), FNV1c:1810d981, DF=0d000d49(09) DS(030004b9),         F___RC=10dfc718, DF:263d8699(15) , F1__RC=a8466ac8, DF:4f6b74db(20) , F1A_RC=93e667bf, DF:856b2efb(19) , F1C_RC=76f80ee3, DF:1343c142(11)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,0f)::VEC(0, f, ffffffff, 0)::      FNV  :0000000f, DF=00000001(01) DS(00000001), FNV1 :0f00179d, DF=01000197(07) DS(01000193), FNV1a:02768030, DF=010001f3(08) DS(01000193), FNV1c:1710d7ee, DF=0f000e6f(13) DS(01000193),         F___RC=eadd4caf, DF:fa028bb7(17) , F1__RC=695fb77d, DF:c119ddb5(17) , F1A_RC=0f485682, DF:9cae313d(17) , F1C_RC=3667e8dc, DF:409fe63f(18)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;F(00,10)::VEC(0, 10, ffffffff, 0)::     FNV  :00000010, DF=0000001f(05) DS(00000001), FNV1 :10001930, DF=1f000ead(13) DS(01000193), FNV1a:01767e9d, DF=0300fead(14) DS(01000193), FNV1c:0210b6df, DF=15006131(09) DS(1500210f),         F___RC=c4dad246, DF:2e079ee9(17) , F1__RC=2a790432, DF:4326b34f(16) , F1A_RC=d10adebd, DF:de42883f(16) , F1C_RC=1ce48e12, DF:2a8366ce(15)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;F(00,01)&lt;&#x2F;code&gt; : is input x,y&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;VEC(0, 1, ffffffff, 0)&lt;&#x2F;code&gt;  : is &lt;code&gt;fnv_reduce&lt;&#x2F;code&gt; input vector (a,b,c,d)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;FNV  :00000001, DF=00000001(01) DS(00000001)&lt;&#x2F;code&gt; :&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FNV(00,01)&lt;&#x2F;code&gt; result is 00000001 ,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DF&lt;&#x2F;code&gt; : is changed bitcounts, compared with previous outputs, in this case prev[00,00] current[00,01] input is 1bit changed, and output result 1bit changed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DS&lt;&#x2F;code&gt; : is distances of previous result and current result , ABS(prev_fnvresult,current_fnvresult).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;** Basically, &lt;code&gt;DF&lt;&#x2F;code&gt; is higher is best on hash algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;F___RC=fefffe6d, DF:111e47a9(14)&lt;&#x2F;code&gt; : &lt;code&gt;fnv_reduce = fnv(fnv(fnv(a,b),c),d) &lt;&#x2F;code&gt; result is fefffe6d , and Different Bits counts are &lt;code&gt;14&lt;&#x2F;code&gt; bits.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;In case of ethash algorithm, it can&#x27;t prevent ASIC forever.&lt;&#x2F;p&gt;
&lt;p&gt;And, current ethash algorithm&#x27;s FNV function is deprecated.&lt;&#x2F;p&gt;
&lt;p&gt;So, It needs to be upgraded and it will make current ethash based ASICs obsolete.&lt;&#x2F;p&gt;
&lt;p&gt;And current TETHASHV1 FNV1A implementation is based on most of ethash , which is verified for a long time.&lt;&#x2F;p&gt;
&lt;p&gt;Another propose of big differencing the Ethash algorithm need to crypto analysis for a long times and need to GPU code optimization times.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Verification and Optimization timeline Examples&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;original ethminer (2015) -&amp;gt; claymore optimized miner (2016) [1year]&lt;&#x2F;p&gt;
&lt;p&gt;genoil ethminer (2015) -&amp;gt; ethereum-mining&#x2F;ethminer (2017) [2year]&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-results&quot;&gt;Test Results::&lt;&#x2F;h2&gt;
&lt;p&gt;Tethash miner has 2~3% of hashrate degrade on GPU, due to more core computation time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;This work is licensed under a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by-nc-sa&#x2F;4.0&#x2F;&quot;&gt;Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Define a maximum block timestamp drift</title>
        <published>2018-10-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Maurelian</name><uri>https://github.com/Maurelian</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1482/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/define-a-maximum-block-timestamp-drift/1556" />
        

        <id>https://wg-eips.ritovision.com/1482/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1482"
            label="EIP-1482" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1482/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Include an explicit definition of the acceptable timestamp drift in the protocol specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;On the basis that both Geth and Parity implement the same timestamp validation requirements, this should be written into the reference specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;There is a lack of clarity about how accurate timestamps in the block header must be. The yellow paper describes the timestamp as&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A scalar value equal to the reasonable output of Unix’s time() at this block’s inception&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This causes &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.stackexchange.com&#x2F;questions&#x2F;5924&#x2F;how-do-ethereum-mining-nodes-maintain-a-time-consistent-with-the-network&#x2F;5926#5926&quot;&gt;confusion&lt;&#x2F;a&gt; about the safe use of the &lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; opcode (solidity&#x27;s &lt;code&gt;block.timestamp&lt;&#x2F;code&gt; or &lt;code&gt;now&lt;&#x2F;code&gt;) in smart contract development.&lt;&#x2F;p&gt;
&lt;p&gt;Differing interpretations of &#x27;reasonable&#x27; may create a risk of consenus failures.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The yellow paper should define a timestamp as:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A scalar value equal to the output of Unix’s time() at this block’s inception. For the purpose of block validation, it must be greater than the previous block&#x27;s timestamp, and no more than 15 seconds greater than system time.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Both &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;blob&#x2F;4e474c74dc2ac1d26b339c32064d0bac98775e77&#x2F;consensus&#x2F;ethash&#x2F;consensus.go#L45&quot;&gt;Geth&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;blob&#x2F;73db5dda8c0109bb6bc1392624875078f973be14&#x2F;ethcore&#x2F;src&#x2F;verification&#x2F;verification.rs#L296-L307&quot;&gt;Parity&lt;&#x2F;a&gt; reject blocks with timestamp more than 15 seconds in the future. This establishes a defacto standard, which should be made explicit in the reference specification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;It may be necessary to relax this requirement for blocks which were mined early in the main chain&#x27;s history, if they would be considered invalid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;These would be important to have.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;_The implementations must be completed before any EIP is given status &quot;Final&quot;, but it need not be completed before the EIP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of &quot;rough consensus and running code&quot; is still useful when it comes to resolving many discussions of API details.
_&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blockchain Storage Rent Payment</title>
        <published>2018-09-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>William Entriken</name><uri>https://github.com/fulldecent</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1418/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1418-storage-rent/10737" />
        

        <id>https://wg-eips.ritovision.com/1418/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1418"
            label="EIP-1418" />
        

        
        

        
        <summary type="html">At each block, deduct value from every account based on the quantity of storage used by that account.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1418/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;At each block, deduct an amount of value (&quot;rent&quot;) from every account based on the quantity of storage used by that account.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum is a public utility and we are underpricing the long-term costs of storage. Storage cost can be approximately modeled as bytes × time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;Updated transaction type&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A new transaction type is introduced. Whereas &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1559&#x2F;&quot;&gt;EIP-1559&lt;&#x2F;a&gt; introduced warm access for contract state, this new type introduces warm access for contract code.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;New state variables (per account)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;σ[a]_rent&lt;&#x2F;strong&gt; -- an amount of value, in Wei, this is a signed value&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;σ[a]_storageWords&lt;&#x2F;strong&gt; -- number of words in storage&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New constants&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RENT_WORD_COST&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- The rent cost, in Wei, paid for each word-block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RENT_ACCOUNT_COST&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- The rent cost, in Wei, paid for each account-block&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; – When implementation starts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New opcodes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RENTBALANCE(address)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- G_BALANCE -- Similar to &lt;code&gt;BALANCE&lt;&#x2F;code&gt;
&lt;ul&gt;
&lt;li&gt;This returns the logical &lt;code&gt;σ[a]_rent&lt;&#x2F;code&gt; value which is defined to reduce each block. It is possible for the implementation to calculate this value using the recommended implementation variables, rather than storing and updating  &lt;code&gt;σ[a]_rent&lt;&#x2F;code&gt; every block for every account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SENDRENT(address, amount)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; -- G_BASE -- Convert value to rent and send to account
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;σ[account]_rent&lt;&#x2F;code&gt; += amount&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;σ[msg.sender]_balance&lt;&#x2F;code&gt; -= amount&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Updated opcodes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A new subroutine, paying for rent, is established as such:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PAYRENT(account)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    blocks_to_pay = NUMBER - σ[account]_rentLastPaid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cost_per_block = RENT_ACCOUNT_COST + RENT_WORD_COST * (⌈∥σ[account]_code∥ &#x2F; 32⌉ + * σ[a]_storageWords)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rent_to_pay = blocks_to_pay * cost_per_block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    σ[account]_rent -= rent_to_pay&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if σ[account]_rent &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_value += σ[account]_rent&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_rent = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if σ[account]_value &amp;lt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_rent = σ[account]_value&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    		σ[account]_value = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    end&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    σ[account]_rentLastPaid = NUMBER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    σ[account]_rentEvictBlock = NUMBER + ⌊σ[account]_rent &#x2F; cost_per_block⌋&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;END PAYRENT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SSTORE(account, key, value)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Perform PAYRENT(account)&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;account&lt;&#x2F;code&gt; is evicted (i.e. &lt;code&gt;NUMBER&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;σ[account]_rentEvictBlock&lt;&#x2F;code&gt;) then transaction fails unless using the new transaction type and sufficient proofs are included to validate the old storage root and calculate the new root.&lt;&#x2F;li&gt;
&lt;li&gt;Do normal SSTORE operation&lt;&#x2F;li&gt;
&lt;li&gt;If the old value was zero for this [account, key] and the new value is non-zero, then &lt;code&gt;σ[account]_storageWords++&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;If the old value was non-zero for this [account, key] and the new value is zero, then &lt;code&gt;σ[account]_storageWords--&lt;&#x2F;code&gt;, and if the result is negative then set to zero&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SLOAD(account, key)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;account&lt;&#x2F;code&gt; is evicted (i.e. &lt;code&gt;NUMBER&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;σ[account]_rentEvictBlock&lt;&#x2F;code&gt;) then transaction fails unless using the new transaction type and sufficient proofs are included to validate the existing storage root and the existing storage value.&lt;&#x2F;li&gt;
&lt;li&gt;Do normal SLOAD operation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;CALL (and derivatives)&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;If the target block is evicted (i.e. &lt;code&gt;NUMBER&lt;&#x2F;code&gt; &amp;gt; &lt;code&gt;σ[account]_rentEvictBlock&lt;&#x2F;code&gt;) then transaction fails unless using the new transaction type and sufficient proof is included to validate the existing code.&lt;&#x2F;li&gt;
&lt;li&gt;Do normal CALL operation&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;
&lt;ul&gt;
&lt;li&gt;Set σ[account]_rentLastPaid = NUMBER&lt;&#x2F;li&gt;
&lt;li&gt;Do normal CREATE operation&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;σ[account]_storageWord = 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Note: it is possible there is a pre-existing rent balance here&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;New built-in contract&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PAYRENT(address, amount)&lt;&#x2F;code&gt; -- Calls &lt;code&gt;PAYRENT&lt;&#x2F;code&gt; opcode
&lt;ul&gt;
&lt;li&gt;This is a convenience for humans to send Ether from their accounts and turn it into rent. Note that simple accounts (CODESIZE == 0) cannot call arbitrary opcodes, they can only call CREATE or CALL.&lt;&#x2F;li&gt;
&lt;li&gt;The gas cost of PAYRENT will be 10,000 or lower if possible.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Calculating &lt;code&gt;σ[account]_storageWord&lt;&#x2F;code&gt; for existing accounts&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;DRAFT...&lt;&#x2F;p&gt;
&lt;p&gt;It is not an acceptable upgrade if on the fork block it is necessary for only archive nodes to participate which know the full storage amount for each account.&lt;&#x2F;p&gt;
&lt;p&gt;An acceptable upgrade will be if the required &lt;code&gt;σ[account]_storageWord&lt;&#x2F;code&gt; can be calculated (or estimated) incrementally based on new transaction activity.&lt;&#x2F;p&gt;
&lt;p&gt;DRAFT: I think it is possible to make such an acceptable upgrade using an unbiased estimator&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;add one bit of storage per &lt;code&gt;SSTORE&lt;&#x2F;code&gt; for legacy accounts on the first access of a given key&lt;&#x2F;li&gt;
&lt;li&gt;add log(n) bits for each trie level&lt;&#x2F;li&gt;
&lt;li&gt;assume that storage keys are a random variable&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To think more about...&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No changes to current opcode gas costs.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;No call&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A contract will not know or react to the receipt of rent. This is okay. Workaround: if a contract really needed to know who provided rent payments then it could create a function in its ABI to attribute these payments. It is already possible to send payments to a contract without attribution by using &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;. Other blockchains like TRON allow to transfer value to a contract without performing a call.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Eviction responsibility &#x2F; lazy evaluation&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The specification gives responsibility for eviction to the consensus clients. This is the most predictable behavior because it happens exactly when it should. Also there need not be any incentive mechanism (refund gas, bounty) for outside participants (off-chain) to monitor accounts and request removal.&lt;&#x2F;p&gt;
&lt;p&gt;It is possible that an arbitrary number of accounts will be evicted in one block. That doesn&#x27;t matter. Client implementations do not need to track which accounts are evicted, consensus is achieved just by agreeing on the conditions under which an account would be evicted.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No converting rent to value&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ether converted to rent cannot be converted back. Anybody that works in accounting and knows about gifts cards should tell you this is a good idea. It makes reasoning about the system much easier.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Accounts pay rent&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Yes, they pay rent. It costs resources to account for their balances so we charge them rent.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Why do you need a separate rent account?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Because anybody&#x2F;everybody can contribute to the rent account. If you depend on a contract, you should contribute to its rent.&lt;&#x2F;p&gt;
&lt;p&gt;But the contract can spend all of its value.&lt;&#x2F;p&gt;
&lt;p&gt;By maintaining a separate rent and value balance, this allows people to contribute to the rent while being confident that this is allowing the contract to stay around.&lt;&#x2F;p&gt;
&lt;p&gt;NOTE: cloning. With this EIP, it may become feasible to allow storage cloning. Yes really. Because the new clone will be paying rent. See other EIP, I think made by Augur team.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;economics-constants&quot;&gt;Economics &amp;amp; constants&lt;&#x2F;h3&gt;
&lt;p&gt;An &lt;code&gt;SSTORE&lt;&#x2F;code&gt; executed in 2015 cost 20,000 gas and has survived about 6 million blocks. The gas price has been around 1 ~ 50 Gwei. So basically 4,000 Wei per block per word so far. Maybe storing an account is 10 times more intensive than storing a word. But actually &lt;code&gt;G_transaction&lt;&#x2F;code&gt; is 21,000 and &lt;code&gt;G_sstore&lt;&#x2F;code&gt; is 20,000 so these are similar and they can both create new accounts &#x2F; words.&lt;&#x2F;p&gt;
&lt;p&gt;How about:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RENT_WORD_COST&lt;&#x2F;code&gt; -- 4,000 Wei&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RENT_ACCOUNT_COST&lt;&#x2F;code&gt; -- 4,000 Wei&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; – when implementation starts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The rent is priced in cold, hard Ether. It is not negotiated by clients, it is not dynamic.&lt;&#x2F;p&gt;
&lt;p&gt;A future EIP may change this pricing to be dynamic. For example to notarize a block, notaries may be required to prove they have the current storage dataset (excluding evictions). Additionally, they may also prove they have the dataset plus evictions to earn an additional fee. The relative storage of the evicted accounts, and the other accounts versus the value of the additional fee may be used as a feedback mechanism to set a market price for storage.&lt;&#x2F;p&gt;
&lt;p&gt;FYI, there are about 15B words in the Ethereum Mainnet dataset and about 100M total Ether mined. This means if all Ether was spent on storage at current proposed prices it would be 400 terabyte-years of storage. I&#x27;m not sure if it is helpful to look at it that way.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;EIP-1559 already introduces a mechanism for nodes to participate without recording the full network state and for clients to warm cache with storage data in their type 2 transactions.&lt;&#x2F;p&gt;
&lt;p&gt;Users will need to be educated.&lt;&#x2F;p&gt;
&lt;p&gt;Many smart contracts allow anybody to use an arbitrary amount of storage in them. This can limit the usefulness of deploying this proposal on an existing chain.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Recommended implementation variables (per account)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;σ[a]_rentLastPaid&lt;&#x2F;strong&gt; -- a block number that is set when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Value is transferred into an account (&lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Code is set for an account (&lt;code&gt;CREATE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;An account&#x27;s storage is updated (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;This begins with a logical value of &lt;code&gt;FORK_BLOCK&lt;&#x2F;code&gt; for all accounts&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;σ[a]_rentEvictBlock&lt;&#x2F;strong&gt; -- the block number when this account will be evicted&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Storage note&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For every account that is evicted, clients may choose to delete that storage from disk. A future EIP may make an incentive to keep this extra data for a fee. A future EIP may create a mechanism for clients to exchange information about these storage states.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;Many smart contracts allow anybody to use an arbitrary amount of storage in them.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
&lt;!--

 ## TODO

 To discuss:

 - Can&#x2F;should an evicted account be allowed to be un-evicted when paying past due rent?
   --&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduced gas cost for call to self</title>
        <published>2018-08-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Jacques Wagener</name><uri>https://github.com/jacqueswww</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1380/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1380-reduced-gas-cost-for-call-to-self/1242" />
        

        <id>https://wg-eips.ritovision.com/1380/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1380"
            label="EIP-1380" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1380/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the gas cost for call instructions, when the goal is to run a new instance of the currently loaded contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current gas cost of 700 for all call types (&lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;) does not take into account that a call to a contract itself
does not need to perform additional I&#x2F;O operations, because the current contract code has already been loaded into memory.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the call-to-self gas cost would greatly benefit smart contract languages, such as Solidity and Vyper, who would then be able to utilise &lt;code&gt;CALL&lt;&#x2F;code&gt; instead
of &lt;code&gt;JUMP&lt;&#x2F;code&gt; opcodes for internal function calls. While languages can already utilise &lt;code&gt;CALL&lt;&#x2F;code&gt; for internal function calls, they are discouraged to do so due to the
gas costs associated with it.&lt;&#x2F;p&gt;
&lt;p&gt;Using &lt;code&gt;JUMP&lt;&#x2F;code&gt; comes at a considerable cost in complexity to the implementation of a smart contract language and&#x2F;or compiler. The context (including stack and memory)
must be swapped in and out of the calling functions context. A desired feature is having &lt;em&gt;pure&lt;&#x2F;em&gt; functions, which do not modify the state of memory, and realising
them through &lt;code&gt;JUMP&lt;&#x2F;code&gt; requires a bigger effort from the compiler as opposed to being able to use &lt;code&gt;CALL&lt;&#x2F;code&gt;s.&lt;&#x2F;p&gt;
&lt;p&gt;Using call-to-self provides the guarantee that when making an internal call the function can rely on a clear reset state of memory or context, benefiting both
contract writers and contract consumers against potentially undetected edge cases were memory could poison the context of the internal function.&lt;&#x2F;p&gt;
&lt;p&gt;Because of the &lt;code&gt;JUMP&lt;&#x2F;code&gt; usage for internal functions a smart contract languages are also at risk of reaching the stack depth limit considerably faster, if nested
function calls with many in and&#x2F;or outputs are required.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the gas cost, and thereby incentivising of using call-to-self instead of &lt;code&gt;JUMP&lt;&#x2F;code&gt;s for the internal function implementation will also benefit static
analyzers and tracers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, then decrease the cost of &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; from 700 to 40,
if and only if, the destination address of the call equals to the address of the caller.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;EIP150 has increased the cost of these instructions from 40 to 700 to more fairly charge for loading new contracts from disk, e.g. to reflect the I&#x2F;O charge more closely.
By assuming that 660 is the cost of loading a contract from disk, one can assume that the original 40 gas is a fair cost of creating a new VM instance of an already loaded contract code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This should pose no risk to backwards compatibility. Currently existing contracts should not notice the difference, just see cheaper execution.
With EIP150 contract (and language) developers had a lesson that relying on strict gas costs is not feasible as costs may change.
The impact of this EIP is even less that of EIP150 because the costs are changing downwards and not upwards.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Ethash 1a</title>
        <published>2018-08-26T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Jean M. Cyr</name><uri>https://github.com/jean-m-cyr</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1355/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1355-ethash-1a/1167" />
        

        <id>https://wg-eips.ritovision.com/1355/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1355"
            label="EIP-1355" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1355/">&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Provide minimal set of changes to Ethash algorithm to hinder and delay the adoption of ASIC based mining.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Define hash function &lt;code&gt;fnv1a()&lt;&#x2F;code&gt; as&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;v1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;v1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; v2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; FNV1A_PRIME&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;FNV1A_PRIME&lt;&#x2F;code&gt; is 16777499 or 16777639.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Change the hash function that determines the DAG item index in Ethash algorithm from &lt;code&gt;fnv()&lt;&#x2F;code&gt; to new &lt;code&gt;fnv1a()&lt;&#x2F;code&gt;.
In &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth-wiki&#x2F;blob&#x2F;master&#x2F;concepts&#x2F;ethash&#x2F;ethash.md#main-loop&quot;&gt;Main Loop&lt;&#x2F;a&gt; change&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; fnv&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; mixhashes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The usual argument for decentralization and network security.&lt;&#x2F;p&gt;
&lt;p&gt;Unless programmable, an ASIC is hardwired to perform sequential operations in a given order. fnv1a changes the order in which an exclusive-or and a multiply are applied, effectively disabling the current wave of ASICS. A second objective is minimize ethash changes to be the least disruptive, to facilitate rapid development, and to lower the analysis and test requirements. Minimizing changes to ethash reduces risk associated with updating all affected network components, and also reduces the risk of detuning existing GPUs. It&#x27;s expected that this specific change would have no effect on existing GPU performance.&lt;&#x2F;p&gt;
&lt;p&gt;Changing fnv to fnv1a has no cryptographic implications. It is merely an efficient hash function with good dispersion characteristics used to scramble DAG indexing. We remain focused on risk mitigation by reducing the need for rigorous cryptographic analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fnv-primes&quot;&gt;FNV Primes&lt;&#x2F;h3&gt;
&lt;p&gt;The 16777639 satisfies all requirements from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV_prime&quot;&gt;Wikipedia&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The 16777499 is preferred by FNV authors but not used in the reference FNV implementation because of historical reasons.
See &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.isthe.com&#x2F;chongo&#x2F;tech&#x2F;comp&#x2F;fnv&#x2F;index.html#fnv-prime&quot;&gt;A few remarks on FNV primes&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;This work is licensed under a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;creativecommons.org&#x2F;licenses&#x2F;by-nc-sa&#x2F;4.0&#x2F;&quot;&gt;Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ChainID opcode</title>
        <published>2018-08-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Richard Meissner</name><uri>https://github.com/rmeissner</uri>
	</author>
	
	<author>
		<name>Bryant Eisenbach</name><uri>https://github.com/fubuloubu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1344/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/add-chain-id-opcode-for-replay-protection-when-handling-signed-messages-in-contracts/1131" />
        

        <id>https://wg-eips.ritovision.com/1344/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1344"
            label="EIP-1344" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1344/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds an opcode that returns the current chain&#x27;s EIP-155 unique identifier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;155&#x2F;&quot;&gt;EIP-155&lt;&#x2F;a&gt; proposes to use the chain ID to prevent replay attacks between different chains. It would be a great benefit to have the same possibility inside smart contracts when handling signatures, especially for Layer 2 signature schemes using &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;712&#x2F;&quot;&gt;EIP-712&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Adds a new opcode &lt;code&gt;CHAINID&lt;&#x2F;code&gt; at 0x46, which uses 0 stack arguments. It pushes the current chain ID onto the stack. Chain ID is a 256-bit value. The operation costs &lt;code&gt;G_base&lt;&#x2F;code&gt; to execute.&lt;&#x2F;p&gt;
&lt;p&gt;The value of the current chain ID is obtained from the chain ID configuration, which should match the EIP-155 unique identifier a client will accept from incoming transactions. Please note that per EIP-155, it is not &lt;em&gt;required&lt;&#x2F;em&gt; that a transaction have an EIP-155 unique identifier, but in that scenario this opcode will still return the configured chain ID and not a default.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The current approach proposed by EIP-712 is to specify the chain ID at compile time. Using this approach will result in problems after a hardfork, as well as human error that may lead to loss of funds or replay attacks on signed messages.
By adding the proposed opcode it will be possible to access the current chain ID and validate signatures based on that.&lt;&#x2F;p&gt;
&lt;p&gt;Currently, there is no specification for how chain ID is set for a particular network, relying on choices made manually by the client implementers and the chain community. There is a potential scenario where, during a &quot;contentious split&quot; over a divisive issue, a community using a particular value of chain ID will make a decision to split into two such chains. When this scenario occurs, it will be unsafe to maintain chain ID to the same value on both chains, as chain ID is used for replay protection for in-protocol transactions (per EIP-155), as well as for L2 and &quot;meta-transaction&quot; use cases (per EIP-712 as enabled by this proposal). There are two potential resolutions in this scenario under the current process: 1) one chain decides to modify their value of chain ID (while the other keeps it), or 2) both chains decide to modify their value of chain ID.&lt;&#x2F;p&gt;
&lt;p&gt;In order to mitigate this situation, users of the proposed &lt;code&gt;CHAINID&lt;&#x2F;code&gt; opcode &lt;strong&gt;must&lt;&#x2F;strong&gt; ensure that their application can handle a potential update to the value of chain ID during their usage of their application in case this does occur, if required for the continued use of the application. A Trustless Oracle that logs the timestamp when a change is made to chain ID can be implemented either as an application-level feature inside the application contract system, or referenced as a globally standard contract. Failure to provide a mitigation for this scenario could lead to a sudden loss of legitimacy of previously signed off-chain messages, which could be an issue during settlement periods and other longer-term verification events for these types of messages. Not all applications of this opcode may need mitigations to handle this scenario, but developers should provide reasoning on a case-by-case basis.&lt;&#x2F;p&gt;
&lt;p&gt;One example of a scenario where it would not make sense to leverage a global oracle is with the Plasma L2 paradigm. In the Plasma paradigm, an operator or group of operators submit blocks from the L2 network to the base chain (in this case Ethereum) summarizing transactions that have occurred on that chain. The submission of these blocks may not perfectly align with major events on the mainchain, such as a split causing an update of chain ID, which may cause a significant insecurity in the protocol if chain ID is utilized in signing messages. If the operators are not allowed to control the update of chain ID they will not be able to perfectly synchronize the update with their block submissions, and certain past transactions may be rejected because they do not align with the update. This is one example of the unintended consequences of trying to specify too much of the behavior of chain ID during a contentious split, and why having a simple opcode for access is most optimal, versus a more complicated precompile or contract.&lt;&#x2F;p&gt;
&lt;p&gt;This proposed opcode would be the simplest possible way to implement this functionality, and allows developers the flexibility to implement their own global or local handling of chain ID changes, if required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is fully backwards compatible with all chains which implement EIP-155 chain ID domain separator for transaction signing.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;This was previously suggested as part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;901&quot;&gt;EIP-901&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test Cases added to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;pull&#x2F;627&quot;&gt;ethereum&#x2F;tests&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation for the Trinity Python client is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py-evm&#x2F;pull&#x2F;1803&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An example implementation of a trustless chain ID oracle was implemented &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;fubuloubu&#x2F;chain-id-oracle&#x2F;blob&#x2F;master&#x2F;ChainIdOracle.vy&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Modify Ethereum PoW Incentive Structure and Delay Difficulty Bomb</title>
        <published>2018-08-05T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Brian Venturo</name><uri>https://github.com/atlanticcrypto</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1295/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/atlanticcrypto/Discussion/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1295/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1295"
            label="EIP-1295" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1295/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Network security and overall ecosystem maturity warrants the continued incentivization of Proof of Work participation but may allow for a reduction in ancillary ETH issuance and the delay of the Difficulty Bomb. This EIP proposes a reduction of Uncle and removal of Nephew rewards while delaying the Difficulty Bomb with the Constantinople hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with CNSTNTNPL_FORK_BLKNUM the client will calculate the difficulty based on a fake block number suggesting the client that the difficulty bomb is adjusting around 6 million blocks later than previously specified with the Homestead fork.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, Uncle rewards will be adjusted and Nephew rewards will be removed to eliminate excess ancillary ETH issuance. The current ETH block reward of 3 ETH will remain constant.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Network scalability and security are at the forefront of risks to the Ethereum protocol. With great strides being made towards on and off chain scalability, the existence of an artificial throughput limiting device in the protocol is not warranted. Removing the risk of reducing throughput through the initialization of the Difficulty Bomb is &quot;low-hanging-fruit&quot; to ensure continued operation at a minimum of current throughput through the next major hard fork (scheduled for late 2019).&lt;&#x2F;p&gt;
&lt;p&gt;The security layer of the Ethereum network is and should remain robust. Incentives for continued operation of the security of the growing ecosystem are paramount.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time, the ancillary issuance benefits of the Ethereum protocol can be adjusted to reduce the overall issuance profile. Aggressively adjusting Uncle and removing Nephew rewards will reduce the inflationary aspect of ETH issuance, while keeping the current block reward constant at 3 ETH will ensure top line incentives stay in place.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 6_000_000) if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjust-uncle-and-nephew-rewards&quot;&gt;Adjust Uncle and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;If an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (3 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for uncle rewards, adjusted to reward 2 levels of Uncles at a reduced rate.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is a removal of all rewards for Nephew blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The security layer of the Ethereum network is and should remain robust. Incentives for continued operation of the growing ecosystem’s security are paramount.&lt;&#x2F;p&gt;
&lt;p&gt;At the same time, the ancillary issuance benefits of the Ethereum protocol can be adjusted to reduce the overall issuance profile. Aggressively adjusting Uncle and removing Nephew rewards will reduce the inflationary aspect of ETH issuance, while keeping the current block reward constant at 3 ETH will ensure top line incentives stay in place.&lt;&#x2F;p&gt;
&lt;p&gt;The Difficulty Bomb was instituted as a type of planned obsolescence to force the implementation of network upgrades with regular frequency. With the focus on scalability for the protocol, delaying a mechanism whereby the throughput of the network can be limited artificially, due to any circumstance, is a logical step to ensure continued minimum network operation at the current throughput level. We believe the existence of the Difficulty Bomb has allowed for the inclusion of protocol upgrades in forced hard-forks, and will continue to do so.&lt;&#x2F;p&gt;
&lt;p&gt;Through August 4th, the 2018 year to date reward issued to Uncle blocks totaled over 635,000 ETH. The average reward per Uncle totals 2.27 ETH. The year to date average Uncle rate is 22.49%. Using the year to date metrics, the ongoing average ETH paid as an Uncle reward per block is 0.51 ETH plus the Uncle inclusion reward of 0.021 ETH (0.09375 ETH * .2249), total Uncle related reward per block being over 0.53 ETH. With total year to date block rewards totaling approximately 3,730,000 ETH, the network has paid an additional 17pct in Uncle rewards. This is issuance that can be reduced while still maintaining the overall integrity and incentivization of network security.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the issuance of ETH in rewarding Uncle blocks (forked blocks caused by latency in propagation, a multi-faceted problem) should directly incentivize the investment in technologies and efficiencies to reduce block propagation latency which may lead to a reduction in Network wide Uncle rates, reducing ancillary issuance further.&lt;&#x2F;p&gt;
&lt;p&gt;Reducing the Uncle rewards from the current specification to the proposed will yield two levels of ancillary ETH issuance for Uncles:&lt;&#x2F;p&gt;
&lt;p&gt;Level 1 Uncle -&amp;gt; 0.75 ETH&lt;&#x2F;p&gt;
&lt;p&gt;Level 2 Uncle -&amp;gt; 0.375 ETH&lt;&#x2F;p&gt;
&lt;p&gt;These levels are sufficient to continue incentivizing decentralized participation, while also providing an immediate economic incentive for the upgrade of the Ethereum node network and its tangential infrastructure.&lt;&#x2F;p&gt;
&lt;p&gt;We believe that the ETH network has been subsidizing transaction inclusion through the robust Uncle Reward structure since inception. We also believe that a removal of the set subsidy will create a dynamic response mechanism whereby Miners and transaction senders will minimize total costs of transaction inclusion. This dynamic response structure may limit unnecessary layer 1 transaction throughput while providing incentives for layer 2 scaling solutions.&lt;&#x2F;p&gt;
&lt;p&gt;The Nephew reward structure should be entirely eliminated.&lt;&#x2F;p&gt;
&lt;p&gt;Due to current market conditions, and the likelihood of a further USD denominated price decline (50%), we believe that any top line reduction to security incentives will put the Ethereum network at undue risk. Unlike the time of the Byzantium hard fork, current USD denominated economics for securing the Ethereum network threaten the participation of the most decentralized Miner community (at home miners), which we believe make up the largest proportion of the overall network hashrate. We believe eliminating this portion of the community will increase centralization and the probability of an organized network attack.&lt;&#x2F;p&gt;
&lt;p&gt;For a technology so new and with so much potential, we find it extremely irresponsible to increase the likelihood of a network attack by reducing ETH Issuance past this proposal’s level.&lt;&#x2F;p&gt;
&lt;p&gt;With a reduction to the Uncle and removal of the Nephew reward, ancillary ETH issuance should drop (under normal market conditions, i.e. 22.49% uncle rate) by over 75pct and total ETH issuance from the successful sealing and mining of valid blocks should drop over 10pct.&lt;&#x2F;p&gt;
&lt;p&gt;Paired with the diffusal of the Difficulty Bomb, this proposal strikes a balance between ensuring status quo network throughput, reducing overall ETH issuance, and continuing top line incentives for investment in infrastructure and efficiencies to continue operating the Ethereum network’s security layer.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the second Metropolis hard-fork, Constantinople.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Forthcoming.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Net gas metering for SSTORE without dirty maps</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1283/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/sorpaas/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1283/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1283"
            label="EIP-1283" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1283/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes net gas metering changes for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode, enabling
new usages for contract storage, and reducing excessive gas costs
where it doesn&#x27;t match how most implementations work.&lt;&#x2F;p&gt;
&lt;p&gt;This acts as an alternative for EIP-1087, where it tries to be
friendlier to implementations that use different optimization
strategies for storage change caches.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a way for gas metering on SSTORE (as an alternative
for EIP-1087 and EIP-1153), using information that is more universally
available to most implementations, and requires as little change in
implementation structures as possible.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s original value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s current value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Usages that benefits from this EIP&#x27;s gas reduction scheme includes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Subsequent storage write operations within the same call frame. This
includes reentry locks, same-contract multi-send, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Exchange storage information between sub call frame and parent call
frame, where this information does not need to be persistent outside
of a transaction. This includes sub-frame error codes and message
passing, etc.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Definitions of terms are as below:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s original value&lt;&#x2F;em&gt;: This is the value of the storage if
a reversion happens on the &lt;em&gt;current transaction&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s current value&lt;&#x2F;em&gt;: This is the value of the storage
before SSTORE operation happens.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Storage slot&#x27;s new value&lt;&#x2F;em&gt;: This is the value of the storage after
SSTORE operation happens.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Replace &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode gas cost calculation (including refunds) with
the following logic:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this is a no-op), 200 gas is
deducted.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; does not equal &lt;em&gt;new value&lt;&#x2F;em&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage slot has
not been changed by the current execution context)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, 20000 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, 5000 gas is deducted. If &lt;em&gt;new value&lt;&#x2F;em&gt; is 0, add 15000
gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; does not equal &lt;em&gt;current value&lt;&#x2F;em&gt; (this storage
slot is dirty), 200 gas is deducted. Apply both of the following
clauses.
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;current value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;new value&lt;&#x2F;em&gt; is not
0), remove 15000 gas from refund counter. We can prove that
refund counter will never go below 0.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;new value&lt;&#x2F;em&gt; is 0 (also means that &lt;em&gt;current value&lt;&#x2F;em&gt; is not
0), add 15000 gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt; (this storage slot is
reset)
&lt;ul&gt;
&lt;li&gt;If &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, add 19800 gas to refund counter.&lt;&#x2F;li&gt;
&lt;li&gt;Otherwise, add 4800 gas to refund counter.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Refund counter works as before -- it is limited to half of the gas
consumed. On a transaction level, refund counter will never go below
zero. However, there are some important notes depending on the
implementation details:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If an implementation uses &quot;transaction level&quot; refund counter (refund
is checkpointed at each call frame), then the refund counter
continues to be unsigned.&lt;&#x2F;li&gt;
&lt;li&gt;If an implementation uses &quot;execution-frame level&quot; refund counter
(a new refund counter is created at each call frame, and then merged
back to parent when the call frame finishes), then the refund
counter needs to be changed to signed -- at internal calls, a child
refund can go below zero.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;explanation&quot;&gt;Explanation&lt;&#x2F;h2&gt;
&lt;p&gt;The new gas cost scheme for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; is divided into three different
types:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No-op&lt;&#x2F;strong&gt;: the virtual machine does not need to do anything. This is
the case if &lt;em&gt;current value&lt;&#x2F;em&gt; equals &lt;em&gt;new value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Fresh&lt;&#x2F;strong&gt;: this storage slot has not been changed, or has been reset
to its original value. This is the case if &lt;em&gt;current value&lt;&#x2F;em&gt; does not
equal &lt;em&gt;new value&lt;&#x2F;em&gt;, and &lt;em&gt;original value&lt;&#x2F;em&gt; equals &lt;em&gt;current value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Dirty&lt;&#x2F;strong&gt;: this storage slot has already been changed. This is the
case if &lt;em&gt;current value&lt;&#x2F;em&gt; does not equal &lt;em&gt;new value&lt;&#x2F;em&gt;, and &lt;em&gt;original
value&lt;&#x2F;em&gt; does not equal &lt;em&gt;current value&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We can see that the above three types cover all possible variations of
&lt;em&gt;original value&lt;&#x2F;em&gt;, &lt;em&gt;current value&lt;&#x2F;em&gt;, and &lt;em&gt;new value&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No-op&lt;&#x2F;strong&gt; is a trivial operation. Below we only consider cases for
&lt;strong&gt;Fresh&lt;&#x2F;strong&gt; and &lt;strong&gt;Dirty&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;All initial (not-&lt;strong&gt;No-op&lt;&#x2F;strong&gt;) &lt;code&gt;SSTORE&lt;&#x2F;code&gt; on a particular storage slot starts
with &lt;strong&gt;Fresh&lt;&#x2F;strong&gt;. After that, it will become &lt;strong&gt;Dirty&lt;&#x2F;strong&gt; if the value has
been changed. When going from &lt;strong&gt;Fresh&lt;&#x2F;strong&gt; to &lt;strong&gt;Dirty&lt;&#x2F;strong&gt;, we charge the
gas cost the same as current scheme. A &lt;strong&gt;Dirty&lt;&#x2F;strong&gt; storage slot can be
reset back to &lt;strong&gt;Fresh&lt;&#x2F;strong&gt; via a &lt;code&gt;SSTORE&lt;&#x2F;code&gt; opcode. This will trigger a
refund.&lt;&#x2F;p&gt;
&lt;p&gt;When a storage slot remains at &lt;strong&gt;Dirty&lt;&#x2F;strong&gt;, we charge 200 gas. In this
case, we would also need to keep track of &lt;code&gt;R_SCLEAR&lt;&#x2F;code&gt; refunds -- if we
already issued the refund but it no longer applies (&lt;em&gt;current value&lt;&#x2F;em&gt; is
0), then removes this refund from the refund counter. If we didn&#x27;t
issue the refund but it applies now (&lt;em&gt;new value&lt;&#x2F;em&gt; is 0), then adds this
refund to the refund counter. It is not possible where a refund is not
issued but we remove the refund in the above case, because all storage
slot starts with &lt;strong&gt;Fresh&lt;&#x2F;strong&gt; state.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;state-transition&quot;&gt;State Transition&lt;&#x2F;h3&gt;
&lt;p&gt;Below is a graph (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1283#issuecomment-410229053&quot;&gt;by
@Arachnid&lt;&#x2F;a&gt;)
showing possible state transition of gas costs. We ignore &lt;strong&gt;No-op&lt;&#x2F;strong&gt;
state because that is trivial:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;img src=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1283&#x2F;.&#x2F;assets&#x2F;state.png&quot; alt=&quot;State Transition&quot; &#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Below is table version of the above diagram. Vertical shows the &lt;em&gt;new
value&lt;&#x2F;em&gt; being set, and horizontal shows the state of &lt;em&gt;original value&lt;&#x2F;em&gt;
and &lt;em&gt;current value&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is 0:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;A (&lt;code&gt;current=orig=0&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;th&gt;B (&lt;code&gt;current!=orig&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;~0&lt;&#x2F;td&gt;&lt;td&gt;B; 20k gas&lt;&#x2F;td&gt;&lt;td&gt;B; 200 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;A; 200 gas&lt;&#x2F;td&gt;&lt;td&gt;A; 200 gas, 19.8k refund&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;&#x2F;th&gt;&lt;th&gt;X (&lt;code&gt;current=orig!=0&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;th&gt;Y (&lt;code&gt;current!=orig&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;th&gt;Z (&lt;code&gt;current=0&lt;&#x2F;code&gt;)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;orig&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;X; 200 gas&lt;&#x2F;td&gt;&lt;td&gt;X; 200 gas, 4.8k refund&lt;&#x2F;td&gt;&lt;td&gt;X; 200 gas, -10.2k refund&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;~orig, ~0&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;Y; 5k gas&lt;&#x2F;td&gt;&lt;td&gt;Y; 200 gas&lt;&#x2F;td&gt;&lt;td&gt;Y; 200 gas, -15k refund&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;Z; 5k gas, 15k refund&lt;&#x2F;td&gt;&lt;td&gt;Z; 200 gas, 15k refund&lt;&#x2F;td&gt;&lt;td&gt;Z; 200 gas&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP mostly achieves what a transient storage tries to do
(EIP-1087 and EIP-1153), but without the complexity of introducing the
concept of &quot;dirty maps&quot;, or an extra storage struct.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;We don&#x27;t suffer from the optimization limitation of
EIP-1087. EIP-1087 requires keeping a dirty map for storage changes,
and implicitly makes the assumption that a transaction&#x27;s storage
changes are committed to the storage trie at the end of a
transaction. This works well for some implementations, but not for
others. After EIP-658, an efficient storage cache implementation
would probably use an in-memory trie (without RLP encoding&#x2F;decoding)
or other immutable data structures to keep track of storage changes,
and only commit changes at the end of a block. For them, it is
possible to know a storage&#x27;s original value and current value, but
it is not possible to iterate over all storage changes without
incurring additional memory or processing costs.&lt;&#x2F;li&gt;
&lt;li&gt;It never costs more gas compared with the current scheme.&lt;&#x2F;li&gt;
&lt;li&gt;It covers all usages for a transient storage. Clients that are easy
to implement EIP-1087 will also be easy to implement this
specification. Some other clients might require a little bit extra
refactoring on this. Nonetheless, no extra memory or processing cost
is needed on runtime.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Regarding &lt;code&gt;SSTORE&lt;&#x2F;code&gt; gas cost and refunds, see Appendix for proofs of
properties that this EIP satisfies.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;For &lt;em&gt;absolute gas used&lt;&#x2F;em&gt; (that is, actual &lt;em&gt;gas used&lt;&#x2F;em&gt; minus &lt;em&gt;refund&lt;&#x2F;em&gt;),
this EIP is equivalent to EIP-1087 for all cases.&lt;&#x2F;li&gt;
&lt;li&gt;For one particular case, where a storage slot is changed, reset to
its original value, and then changed again, EIP-1283 would move more
gases to refund counter compared with EIP-1087.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Examine examples provided in EIP-1087&#x27;s Motivation:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0,
it will be charged &lt;code&gt;20000 + 200 - 19800 = 400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be
charged &lt;code&gt;20000 + 5 * 200 = 21000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a
transfer from B to C, with all accounts having nonzero starting and
ending balances, it will cost &lt;code&gt;5000 * 3 + 200 - 4800 = 10400&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement. No gas cost increase is
anticipated, and many contracts will see gas reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Below we provide 17 test cases. 15 of them covering consecutive two
&lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations are based on work &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;issues&#x2F;483&quot;&gt;by
@chfast&lt;&#x2F;a&gt;. Two additional
cases with three &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations is used to test the case when a
slot is reset and then set again.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Code&lt;&#x2F;th&gt;&lt;th&gt;Used Gas&lt;&#x2F;th&gt;&lt;th&gt;Refund&lt;&#x2F;th&gt;&lt;th&gt;Original&lt;&#x2F;th&gt;&lt;th&gt;1st&lt;&#x2F;th&gt;&lt;th&gt;2nd&lt;&#x2F;th&gt;&lt;th&gt;3rd&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;412&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;19800&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;20212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60006000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556003600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;4800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60026000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;15000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556002600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;5212&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x60016000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;412&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600160005560006000556001600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40218&lt;&#x2F;td&gt;&lt;td&gt;19800&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;0x600060005560016000556000600055&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;10218&lt;&#x2F;td&gt;&lt;td&gt;19800&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h2 id=&quot;appendix-proof&quot;&gt;Appendix: Proof&lt;&#x2F;h2&gt;
&lt;p&gt;Because the &lt;em&gt;storage slot&#x27;s original value&lt;&#x2F;em&gt; is defined as the value
when a reversion happens on the &lt;em&gt;current transaction&lt;&#x2F;em&gt;, it&#x27;s easy to
see that call frames won&#x27;t interfere SSTORE gas calculation. So
although the below proof is discussed without call frames, it applies
to all situations with call frames. We will discuss the case
separately for &lt;em&gt;original value&lt;&#x2F;em&gt; being zero and not zero, and use
&lt;em&gt;induction&lt;&#x2F;em&gt; to prove some properties of SSTORE gas cost.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Final value&lt;&#x2F;em&gt; is the value of a particular storage slot at the end of
a transaction. &lt;em&gt;Absolute gas used&lt;&#x2F;em&gt; is the absolute value of &lt;em&gt;gas used&lt;&#x2F;em&gt;
minus &lt;em&gt;refund&lt;&#x2F;em&gt;. We use &lt;code&gt;N&lt;&#x2F;code&gt; to represent the total number of SSTORE
operations on a storage slot. For states discussed below, refer to
&lt;em&gt;State Transition&lt;&#x2F;em&gt; in &lt;em&gt;Explanation&lt;&#x2F;em&gt; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;original-value-being-zero&quot;&gt;Original Value Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up still being 0, we want to charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a non-zero value, we want to
charge &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt; gas, because it requires writing this
slot to disk.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state A. The first SSTORE can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state A: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state B: 20000 gas is deducted. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because
&lt;code&gt;20000 + 200 * (N-1) == 20000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From A to A. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From A to B. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
gas cost is &lt;code&gt;20000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to B. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From B to A. The previous gas cost is &lt;code&gt;20000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 - 19800 + 20000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy
&lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;original-value-not-being-zero&quot;&gt;Original Value Not Being Zero&lt;&#x2F;h3&gt;
&lt;p&gt;When &lt;em&gt;original value&lt;&#x2F;em&gt; is not 0, we want to prove that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Case I&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up unchanged, we want to
charge &lt;code&gt;200 * N&lt;&#x2F;code&gt; gases, because no disk write is needed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case II&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being zero, we want to
charge &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt; gas. Note that &lt;code&gt;15000&lt;&#x2F;code&gt; is the
refund in actual definition.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Case III&lt;&#x2F;strong&gt;: If the &lt;em&gt;final value&lt;&#x2F;em&gt; ends up being a changed non-zero
value, we want to charge &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;base-case-1&quot;&gt;Base Case&lt;&#x2F;h4&gt;
&lt;p&gt;We always start at state X. The first SSTORE can:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Go to state X: 200 gas is deducted. We satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt; because
&lt;code&gt;200 * N == 200 * 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Y: 5000 gas is deducted. We satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt; because
&lt;code&gt;5000 + 200 * (N-1) == 5000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Go to state Z: The absolute gas used is &lt;code&gt;5000 - 15000&lt;&#x2F;code&gt; where 15000
is the refund. We satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt; because &lt;code&gt;5000 - 15000 + 200 * (N-1) == 5000 - 15000 + 200 * 0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;inductive-step-1&quot;&gt;Inductive Step&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;From X to X. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;200 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Y. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current gas
cost is &lt;code&gt;5000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From X to Z. The previous gas cost is &lt;code&gt;200 * (N-1)&lt;&#x2F;code&gt;. The current
absolute gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-1)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to X. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
absolute current gas cost is &lt;code&gt;200 - 4800 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Y. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current gas cost is &lt;code&gt;200 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case
III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Y to Z. The previous gas cost is &lt;code&gt;5000 + 200 * (N-2)&lt;&#x2F;code&gt;. The
current absolute gas cost is &lt;code&gt;200 - 15000 + 5000 + 200 * (N-2)&lt;&#x2F;code&gt;. It
satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to X. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 10200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case I&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Y. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 15000 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case III&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;From Z to Z. The previous gas cost is &lt;code&gt;5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. The current absolute gas cost is &lt;code&gt;200 + 5000 - 15000 + 200 * (N-2)&lt;&#x2F;code&gt;. It satisfy &lt;em&gt;Case II&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Increase Gcallstipend gas in the CALL opcode</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Ben Kaufman</name><email>ben@daostack.io</email>
	</author>
	
	<author>
		<name>Adam Levi</name><email>adam@daostack.io</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1285/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1285-increase-gcallstipend-gas-in-the-call-opcode/941" />
        

        <id>https://wg-eips.ritovision.com/1285/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1285"
            label="EIP-1285" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1285/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Increase the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; fee parameter in the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode from &lt;code&gt;2,300&lt;&#x2F;code&gt; to &lt;code&gt;3,500&lt;&#x2F;code&gt; gas units.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode forwards a stipend of &lt;code&gt;2,300&lt;&#x2F;code&gt; gas units for a non zero value &lt;code&gt;CALL&lt;&#x2F;code&gt; operations where a contract is called. This stipend is given to the contract to allow execution of its &lt;code&gt;fallback&lt;&#x2F;code&gt; function. The stipend given is intentionally small in order to prevent the called contract from spending the call gas or performing an attack (like re-entrancy).
While the stipend is small it should still give the sufficient gas required for some cheap opcodes like &lt;code&gt;LOG&lt;&#x2F;code&gt;, but it&#x27;s not enough for some more complex and modern logics to be implemented.
This EIP proposes to increase the given stipend from &lt;code&gt;2,300&lt;&#x2F;code&gt; to &lt;code&gt;3,500&lt;&#x2F;code&gt; to increase the usability of  the &lt;code&gt;fallback&lt;&#x2F;code&gt; function.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The main motivation behind this EIP is to allow simple fallback functions to be implemented for contracts following the &lt;code&gt;&quot;Proxy&quot;&lt;&#x2F;code&gt; pattern. Simply explained, a &lt;code&gt;&quot;Proxy Contract&quot;&lt;&#x2F;code&gt; is a contract which use &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; in its &lt;code&gt;fallback&lt;&#x2F;code&gt; function to behave according to the logic of another contract and serve as an independent instance for the logic of the contract it points to.
This pattern is very useful for saving gas per deployment (as Proxy contracts are very lean) and it opens the ability to experiment with upgradability of contracts.
On average, the &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; functionality of a proxy contract costs about &lt;code&gt;1,000&lt;&#x2F;code&gt; gas units.
When a contract transfers ETH to a proxy contract, the proxy logic will consume about &lt;code&gt;1,000&lt;&#x2F;code&gt; gas units before the &lt;code&gt;fallback&lt;&#x2F;code&gt; function of the logic contract will be executed. This leaves merely about 1,300 gas units for the execution of the logic. This is a severe limitation as it is not enough for an average &lt;code&gt;LOG&lt;&#x2F;code&gt; operation (it might be enough for a &lt;code&gt;LOG&lt;&#x2F;code&gt; with one parameter).
By slightly increasing the gas units given in the stipend we allow proxy contracts have proper &lt;code&gt;fallback&lt;&#x2F;code&gt; logic without increasing the attack surface of the calling contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Increase the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; fee parameter in the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode from &lt;code&gt;2,300&lt;&#x2F;code&gt; to &lt;code&gt;3,500&lt;&#x2F;code&gt; gas unit.
The actual change to the Ethereum clients would be to change the &lt;code&gt;CallStipend&lt;&#x2F;code&gt; they store as a constant.
For an implementation example you can find a Geth client implementation linked &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ben-kaufman&#x2F;go-ethereum&#x2F;tree&#x2F;eip-1285&quot;&gt;here&lt;&#x2F;a&gt;. The actual change to the code can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ben-kaufman&#x2F;go-ethereum&#x2F;blob&#x2F;eip-1285&#x2F;params&#x2F;protocol_params.go#L41&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The rational for increasing the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; gas parameter by &lt;code&gt;1,200&lt;&#x2F;code&gt; gas units comes from the cost of performing &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; with a small margin for some small additional operations. All while still keeping the stipend relatively small and insufficient for accessing the storage or changing the state.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a backwards incompatible change for the &lt;code&gt;Gcallstipend&lt;&#x2F;code&gt; gas parameter in the &lt;code&gt;CALL&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Sane limits for certain EVM parameters</title>
        <published>2018-08-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1985/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1985-sane-limits-for-certain-evm-parameters/3224" />
        

        <id>https://wg-eips.ritovision.com/1985/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1985"
            label="EIP-1985" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1985/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce an explicit value range for certain EVM parameters
(such as gas limit, block number, block timestamp, size field when returning&#x2F;copying data within EVM).
Some of these already have an implicit value range due to various (practical) reasons.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Having such an explicit value range can help in creating compatible client implementations,
in certain cases it can also offer minor speed improvements,
and can reduce the effort needed to create consensus critical test cases
by eliminating unrealistic edge cases.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= {FORK_BLOCK}&lt;&#x2F;code&gt;, the following value ranges are introduced.
They restrict the results (i.e. values pushed to the stack) of the instructions listed below.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;gas&lt;&#x2F;em&gt;, &lt;em&gt;gas limit&lt;&#x2F;em&gt;, &lt;em&gt;block gas limit&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7fffffffffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**63 - 1&lt;&#x2F;code&gt;, &lt;code&gt;9223372036854775807&lt;&#x2F;code&gt;).
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GASLIMIT&lt;&#x2F;code&gt; (&lt;code&gt;0x45&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt; (&lt;code&gt;0x5a&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;block number&lt;&#x2F;em&gt;, &lt;em&gt;timestamp&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0x7fffffffffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**63 - 1&lt;&#x2F;code&gt;, &lt;code&gt;9223372036854775807&lt;&#x2F;code&gt;).
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TIMESTAMP&lt;&#x2F;code&gt; (&lt;code&gt;0x42&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NUMBER&lt;&#x2F;code&gt; (&lt;code&gt;0x43&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;account address&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0xffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**160 - 1&lt;&#x2F;code&gt;, &lt;code&gt;1461501637330902918203684832716283019655932542975&lt;&#x2F;code&gt;)
i.e. the address occupies the 160 low bits of the 256-bit value and the remaining top 96 bits must be zeros.
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ADDRESS&lt;&#x2F;code&gt; (&lt;code&gt;0x30&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ORIGIN&lt;&#x2F;code&gt; (&lt;code&gt;0x32&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CALLER&lt;&#x2F;code&gt; (&lt;code&gt;0x33&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;COINBASE&lt;&#x2F;code&gt; (&lt;code&gt;0x41&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xf0&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CREATE2&lt;&#x2F;code&gt; (&lt;code&gt;0xf5&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;buffer size&lt;&#x2F;em&gt;, &lt;em&gt;code size&lt;&#x2F;em&gt;, &lt;em&gt;memory size&lt;&#x2F;em&gt;
is a range between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;0xffffffff&lt;&#x2F;code&gt; (&lt;code&gt;2**32 - 1&lt;&#x2F;code&gt;, &lt;code&gt;4294967295&lt;&#x2F;code&gt;).
It affects the following instructions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x36&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x38&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3b&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3d&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x59&lt;&#x2F;code&gt;),&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PC&lt;&#x2F;code&gt; (&lt;code&gt;0x58&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;These limits have been:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;proposed by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;implemented partially by certain clients, such as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;aleth&quot;&gt;Aleth&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&quot;&gt;Parity&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereumjs&quot;&gt;ethereumjs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;allowed by certain test cases in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&quot;&gt;Ethereum testing suite&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;and implicitly also allowed by certain assumptions, such as due to gas limits some of these values cannot grow past a certain limit&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Most of the limits proposed in this document have been previously explored and tested in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;evmc&quot;&gt;EVMC&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Using the &lt;code&gt;2**63 - 1&lt;&#x2F;code&gt; constant to limit some of the ranges:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;allows using signed 64-bit integer type to represent it,
what helps programming languages not having unsigned types,&lt;&#x2F;li&gt;
&lt;li&gt;makes arithmetic simpler (e.g. checking out-of-gas conditions is simple as &lt;code&gt;gas_counter &amp;lt; 0&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;timestamp&quot;&gt;Timestamp&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt; defines the timestamp in block as &quot;A scalar value equal to the reasonable output of Unix’s time() at this block’s inception&quot;.
IEEE Std 1003.1-2001 (POSIX.1) leaves that definition implementation defined.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;addresses&quot;&gt;Addresses&lt;&#x2F;h3&gt;
&lt;p&gt;The size of addresses is specified in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt; as 20 bytes.
E.g. the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; instruction is specified to return &lt;em&gt;H&lt;&#x2F;em&gt;&lt;sub&gt;c&lt;&#x2F;sub&gt; ∈ 𝔹&lt;sub&gt;20&lt;&#x2F;sub&gt; which has 20 bytes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;memory-size&quot;&gt;Memory size&lt;&#x2F;h3&gt;
&lt;p&gt;Memory expansion cost is not linear and is determined by the following formula:
cost = cost_per_word * number_of_words + (number_of_words ^ 2 &#x2F; 512)&lt;&#x2F;p&gt;
&lt;p&gt;Expanding to over &lt;code&gt;2^32 - 1&lt;&#x2F;code&gt; bytes would cost &lt;code&gt;35184774742016&lt;&#x2F;code&gt; gas. This number fits into the gas limit imposed above (&lt;code&gt;2 ^ 63 - 1&lt;&#x2F;code&gt;) and would cost around 35184 Ether in a transaction to exhaust, with a 1 GWei gas cost, which can be attained on mainnet.&lt;&#x2F;p&gt;
&lt;p&gt;However, setting the limit &lt;code&gt;2^32 - 1&lt;&#x2F;code&gt; is beneficial from a VM design perspective and we believe limiting memory should be done via carefully selecting the block gas limit.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;code-size&quot;&gt;Code size&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;170&#x2F;&quot;&gt;EIP-170&lt;&#x2F;a&gt; has implemented a code size limit of 0x6000, however even before that, it was practically impossible to deploy a code blob exceeding &lt;code&gt;2**32 - 1&lt;&#x2F;code&gt; bytes in size.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;comparing-current-implementations&quot;&gt;Comparing current implementations&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Timestamp is implemented as a 64-bit value in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;aleth&quot;&gt;Aleth&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&quot;&gt;Parity&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Block gas limit is implemented as a 64-bit in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;aleth&quot;&gt;Aleth&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Memory, buffer and code sizes are implemented as 64-bit values in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;geth&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;All of these limits are already enforced mostly through the block gas limit. Since the out of range case results in a transaction failure, there should not be a change in behaviour.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBA&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;92&quot;&gt;EIP-92&lt;&#x2F;a&gt; proposed the transaction gas limit to be limited at &lt;code&gt;2**63 - 1&lt;&#x2F;code&gt; and had a lengthy discussion about other limits.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;106&quot;&gt;EIP-106&lt;&#x2F;a&gt; proposed the block gas limit to be limited at &lt;code&gt;2**63 - 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;todo&quot;&gt;TODO&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;Does the gas limit apply to the gas argument for call instructions?&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Eliminate Difficulty Bomb and Adjust Block Reward on Constantinople Shift</title>
        <published>2018-07-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>EOS Classic</name><uri>https://github.com/eosclassicteam</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1276/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1276-eliminate-difficulty-bomb-and-adjust-block-reward-on-constantinople-shift/908" />
        

        <id>https://wg-eips.ritovision.com/1276/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1276"
            label="EIP-1276" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1276/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the factor of difficulty logic well known as difficulty bomb. This EIP proposes to eliminate the difficulty bomb forever and to reduce the block rewards with the Constantinople fork, the second part of the Metropolis fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty without considering the current block number. Furthermore, block rewards will be adjusted to a base of 2 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Block time has been played a most important role on blockchain ecosystem, and it is being adjusted by the logic of mining difficulty calculation that is already implemented on the node client as a part of proof-of-work consensus. Last year, average block time rapidly increased due to the wrong design of difficulty logic that is meant to be changed on the part of Casper upgrade, however, implementation of casper has been delayed therefore it was inevitable to delay the difficulty bomb in order to prevent the significant delay of processing transactions on ethereum network.&lt;&#x2F;p&gt;
&lt;p&gt;Despite of the successful hardfork to delay the activation of difficulty bomb, activation of the difficulty bomb is expected to happen again on the upcoming period before implementing casper protocol on ethereum network. Therefore, completely removing the difficulty bomb is the most proper way to response the block time increase instead of delaying it again.&lt;&#x2F;p&gt;
&lt;p&gt;Also decreasing the block mining reward along with difficulty bomb removal is expected to help the growth of the stable ethereum ecosystem, right now ethereum dominates 92% of the total hashrate share of ethash based chains, and this corresponds to a tremendous level of energy consumption. As this energy consumption has a correlated environmental cost the network participants have an ethical obligation to ensure this cost is not higher than necessary. At this time, the most direct way to reduce this cost is to lower the block reward in order to limit the appeal of ETH mining. Unchecked growth in hashrate is also counterproductive from a security standpoint. Reducing the reward also decreases the likelihood of a miner driven chain split as Ethereum approaches proof-of-stake.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;remove-exponential-component-of-difficulty-adjustment&quot;&gt;Remove Exponential Component of Difficulty Adjustment&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply remove the exponential difficulty adjustment component, &lt;code&gt;epsilon&lt;&#x2F;code&gt;, i.e. the &lt;code&gt;int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 2_000_000_000_000_000_000 if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(2E18 wei, or 2,000,000,000,000,000,000 wei, or 2 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will completely remove the difficulty bomb on difficulty adjustment algorithm without delaying the difficulty bomb again, therefore it is possible to prevent network delay on the beginning of 2019.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP-1276 opposes directly the intent of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1234&#x2F;&quot;&gt;EIP-1234&lt;&#x2F;a&gt; which should be also considered in discussions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the second Metropolis hard-fork, &lt;em&gt;Constantinople&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Specify restricted address range for precompiles&#x2F;system contracts</title>
        <published>2018-07-27T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1352/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1352-specify-restricted-address-range-for-precompiles-system-contracts/1151" />
        

        <id>https://wg-eips.ritovision.com/1352/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1352"
            label="EIP-1352" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1352/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Specify an Ethereum address range occupied by precompiles and future system contracts. Regular accounts and contracts cannot obtain such an address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The address range between 0x0000000000000000000000000000000000000000 and 0x000000000000000000000000000000000000ffff is reserved for precompiles and system contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This will simplify certain future features where unless this is implemented, several exceptions must be specified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The address range between 0x0000000000000000000000000000000000000000 and 0x000000000000000000000000000000000000ffff is reserved for precompiles and system contracts.&lt;&#x2F;p&gt;
&lt;p&gt;Due to the extremely low probability (and lack of adequate testing possibilities) no explicit checks should be added to ensure that external transaction signing or
the invoking of the &lt;code&gt;CREATE&lt;&#x2F;code&gt; instruction can result in a precompile address.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;No contracts on the main network have been created at the specified addresses. As a result it should pose no backwards compatibility problems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;N&#x2F;A&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Remove Difficulty Bomb</title>
        <published>2018-07-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1240/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/difficulty-bomb-removal/832" />
        

        <id>https://wg-eips.ritovision.com/1240/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1240"
            label="EIP-1240" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1240/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) slowly accelerating. This EIP proposes to remove the difficulty increase over time and replace it with a fixed difficulty targeting 15 second blocks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; the client will calculate the difficulty without considering the current block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The difficulty bomb operates under the assumption that miners decide what code economic participants are running, rather than economic participants deciding for themselves.  In reality, miners will mine whatever chain is most profitable and the most profitable chain is the one that economic participants use.  If 99% of miners mine a chain that no economic participants use then that chain will have no value and the miners will cease mining of it in favor of some other chain that does have economic participants.  Another way to put this is that miners will follow economic participants, not the other way around.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;remove-difficulty&quot;&gt;Remove Difficulty&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, if &lt;code&gt;block.number &amp;gt;= FORK_BLOCK_NUMBER&lt;&#x2F;code&gt; then change the epsilon component to &lt;code&gt;0&lt;&#x2F;code&gt; rather than having it be a function of block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;With the difficulty bomb removed, when Casper is released it will be up to economic participants to decide whether they want the features that Casper enables or not.  If they do not want Casper, they are free to continue running unpatched clients and participating in the Ethereum network as it exists today.  This freedom of choice is the cornerstone of DLTs and making it hard for people to make that choice (by creating an artificial pressure) does not work towards that goal of freedom of choice.  If the development team is not confident that economic participants will want Casper, then they should re-evaluate their priorities rather than trying to force Casper onto users.&lt;&#x2F;p&gt;
&lt;p&gt;Author Personal Note: I think we will see almost all economic participants in Ethereum switch to PoS&#x2F;Sharding without any extra pressure beyond client defaults.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation. Therefore, it should be included in a scheduled hardfork at a certain block number.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementations&quot;&gt;Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;The yellow paper implements this change in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&#x2F;pull&#x2F;710&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Constantinople Difficulty Bomb Delay and Block Reward Adjustment</title>
        <published>2018-07-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/5chdn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1234/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1234-constantinople-difficulty-bomb-delay-and-block-reward-adjustment/833" />
        

        <id>https://wg-eips.ritovision.com/1234/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1234"
            label="EIP-1234" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1234/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) slowly accelerating. This EIP proposes to delay the difficulty bomb for approximately 12 months and to reduce the block rewards with the Constantinople fork, the second part of the Metropolis fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting the client that the difficulty bomb is adjusting around 5 million blocks later than previously specified with the Homestead fork. Furthermore, block rewards will be adjusted to a base of 2 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Casper development and switch to proof-of-stake is delayed, the Ethash proof-of-work should be feasible for miners and allow sealing new blocks every 15 seconds on average for another 12 months. With the delay of the ice age, there is a desire to not suddenly also increase miner rewards. The difficulty bomb has been known about for a long time and now it&#x27;s going to stop from happening. In order to maintain stability of the system, a block reward reduction that offsets the ice age delay would leave the system in the same general state as before. Reducing the reward also decreases the likelihood of a miner driven chain split as Ethereum approaches proof-of-stake.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 5_000_000) if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 2_000_000_000_000_000_000 if block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(2E18 wei, or 2,000,000,000,000,000,000 wei, or 2 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Constantinople formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by 29 million seconds (approximately 12 months), so the chain would be back at 30 second block times in winter 2019. An alternate proposal was to add special rules to the difficulty calculation to effectively &lt;em&gt;pause&lt;&#x2F;em&gt; the difficulty between different blocks. This would lead to similar results.&lt;&#x2F;p&gt;
&lt;p&gt;This was previously discussed at All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;6dbd82303bfcb697eaf9a76de37f5fa570e6379d&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2042.md&quot;&gt;#42&lt;&#x2F;a&gt; and subsequent meetings; and accepted in the Constantinople Session &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;issues&#x2F;55&quot;&gt;#1&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the second Metropolis hard-fork, &lt;em&gt;Constantinople&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases shall be created once the specification is to be accepted by the developers or implemented by the clients.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The implementation in it&#x27;s logic does not differ from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;EIP-649&lt;&#x2F;a&gt;; an implementation for Parity-Ethereum is available in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&#x2F;pull&#x2F;9187&quot;&gt;parity-ethereum#9187&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Defuse Difficulty Bomb and Reset Block Reward</title>
        <published>2018-07-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>SmeargleUsedFly</name><uri>https://github.com/SmeargleUsedFly</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1227/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/1227" />
        

        <id>https://wg-eips.ritovision.com/1227/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1227"
            label="EIP-1227" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1227/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to permanently disable the &quot;difficulty bomb&quot; and reset the block reward to pre-Byzantium levels.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty without the additional exponential component. Furthermore, block rewards will be adjusted to a base of 5 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Due to the &quot;difficulty bomb&quot; (also known as the &quot;ice age&quot;), introduced in EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2&#x2F;&quot;&gt;#2&lt;&#x2F;a&gt;, an artificial exponential increase in difficulty until chain freeze, users may find it much more challenging to remain on the unforked chain after a hard-fork. This is a desirable effect of the ice age (in fact, its only stated purpose) in the case of a scheduled network upgrade, but is especially problematic when a hard-fork includes a controversial change.&lt;&#x2F;p&gt;
&lt;p&gt;This situation has already been observed: during the Byzantium hard-fork users were given the &quot;choice&quot; of following the upgraded side of the chain or remaining on the original chain, the latter already experiencing block times greater than 30 seconds. In reality one will find that organizing a disperse and decentralized set of individuals to keep the original, soon-to-be-dead chain alive under such conditions impossible. This is exacerbated when a controversial change, such as EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;#649&lt;&#x2F;a&gt;, is merged in so close to the hard-fork date, as users cannot be organized to take an educated stance for or against the change on such short notice.&lt;&#x2F;p&gt;
&lt;p&gt;Ultimately, the difficulty bomb serves but a single purpose: make it more difficult to keep the original chain alive after a hard-fork. This is unacceptable if the only way the community can make their voice heard is running&#x2F;not running client software, and not through the EIP process, since they effectively have no choice and therefore no power. This EIP proposes to completely eliminate the difficulty bomb, returning some measure of power over Ethereum&#x27;s governance process to the users, to the community.&lt;&#x2F;p&gt;
&lt;p&gt;Given the controversy surrounding the directly relevant EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;#649&lt;&#x2F;a&gt;, the issuance should also be reset to pre-Byzantium levels. It may be reduced again at a later time via a new hard-fork, only this time users would actually have a meaningful choice in accepting the change or not. Note: the issuance reduction is not the focus of this proposal, and is optional; the defusing of the difficulty bomb is of primary concern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;remove-exponential-component-of-difficulty-adjustment&quot;&gt;Remove Exponential Component of Difficulty Adjustment&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply remove the exponential difficulty adjustment component, &lt;code&gt;epsilon&lt;&#x2F;code&gt;, i.e. the &lt;code&gt;int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;reset-block-uncle-and-nephew-rewards&quot;&gt;Reset Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 5_000_000_000_000_000_000 if block.number &amp;gt;= FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(5E18 wei, or 5,000,000,000,000,000,000 wei, or 5 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Byzantium formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Byzantium formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will permanently, without further changes, disable the &quot;ice age.&quot; It will also reset the block reward to pre-Byzantium levels. Both of these changes are specified similarly to EIP &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;649&#x2F;&quot;&gt;#649&lt;&#x2F;a&gt;, so they should require only minimal changes from client developers.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. However, it may be controversial in nature among different sections of the userbase—the very problem this EIP is made to address. Therefore, it should not be included in a scheduled hardfork at a certain block number. It is suggested to implement this EIP in an isolated hard-fork before the second of the two Metropolis hard-forks.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Forthcoming.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Forthcoming.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Transient storage opcodes</title>
        <published>2018-06-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alexey Akhunov</name><uri>https://github.com/AlexeyAkhunov</uri>
	</author>
	
	<author>
		<name>Moody Salem</name><uri>https://github.com/moodysalem</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1153/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-transient-storage-opcodes/553" />
        

        <id>https://wg-eips.ritovision.com/1153/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1153"
            label="EIP-1153" />
        

        
        

        
        <summary type="html">Add opcodes for manipulating state that behaves almost identically to storage but is discarded after every transaction</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1153/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces transient storage opcodes, which manipulate state that behaves identically to storage, except that transient storage is discarded after every transaction, and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is not subject to the gas stipend check as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;. In other words, the values of transient storage are never deserialized from storage or serialized to storage. Thus transient storage is cheaper since it never requires disk access. Transient storage is accessible to smart contracts via 2 new opcodes, &lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt;, where “T” stands for &quot;transient:&quot;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TLOAD  (0x5c)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TSTORE (0x5d)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Running a transaction in Ethereum can generate multiple nested frames of execution, each created by &lt;code&gt;CALL&lt;&#x2F;code&gt; (or similar) instructions. Contracts can be re-entered during the same transaction, in which case there are more than one frame belonging to one contract. Currently, these frames can communicate in two ways: via inputs&#x2F;outputs passed via &lt;code&gt;CALL&lt;&#x2F;code&gt; instructions, and via storage updates. If there is an intermediate frame belonging to another untrusted contract, communication via inputs&#x2F;outputs is not secure. Notable example is a reentrancy lock which cannot rely on the intermediate frame to pass through the state of the lock. Communication via storage (&lt;code&gt;SSTORE&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;SLOAD&lt;&#x2F;code&gt;) is costly. Transient storage is a dedicated and gas efficient solution to the problem of inter frame communication.&lt;&#x2F;p&gt;
&lt;p&gt;Storage refunds accumulated due to inter frame communication are also limited to 20% of gas spent by a transaction due to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt; (introduced in the London hard fork). This greatly reduces the refunds for transiently-set storage slots in otherwise low-cost transactions. For example, in order to receive the full refund of one re-entrancy lock, the transaction must spend ~80k gas on other operations.&lt;&#x2F;p&gt;
&lt;p&gt;Language support could be added in relatively easy way. For example, in Solidity, a qualifier &lt;code&gt;transient&lt;&#x2F;code&gt; can be introduced (similar to the existing qualifiers &lt;code&gt;memory&lt;&#x2F;code&gt; and &lt;code&gt;storage&lt;&#x2F;code&gt;, and Java&#x27;s own &lt;code&gt;transient&lt;&#x2F;code&gt; keyword with a similar meaning). Since the addressing scheme of &lt;code&gt;TSTORE&lt;&#x2F;code&gt; and &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is the same as for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, code generation routines that exist for storage variables, can be easily generalised to also support transient storage.&lt;&#x2F;p&gt;
&lt;p&gt;Potential use cases enabled or improved by this EIP include:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Reentrancy locks&lt;&#x2F;li&gt;
&lt;li&gt;On-chain computable CREATE2 addresses: constructor arguments are read from the factory contract instead of passed as part of init code hash&lt;&#x2F;li&gt;
&lt;li&gt;Single transaction &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; approvals, e.g. &lt;code&gt;#temporaryApprove(address spender, uint256 amount)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Fee-on-transfer contracts: pay a fee to a token contract to unlock transfers for the duration of a transaction&lt;&#x2F;li&gt;
&lt;li&gt;&quot;Till&quot; pattern: allowing users to perform all actions as part of a callback, and checking the &quot;till&quot; is balanced at the end&lt;&#x2F;li&gt;
&lt;li&gt;Proxy call metadata: pass additional metadata to an implementation contract without using calldata, e.g. values of immutable proxy constructor arguments&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;These opcodes are more efficient to execute than the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcodes because the original value never needs to be loaded from storage (i.e. is always 0). The gas accounting rules are also simpler, since no refunds are required.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two new opcodes are added to EVM, &lt;code&gt;TLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x5c&lt;&#x2F;code&gt;) and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x5d&lt;&#x2F;code&gt;). (Note that previous drafts of this EIP specified the values &lt;code&gt;0xb3&lt;&#x2F;code&gt; and &lt;code&gt;0xb4&lt;&#x2F;code&gt; for &lt;code&gt;TLOAD&lt;&#x2F;code&gt; and &lt;code&gt;TSTORE&lt;&#x2F;code&gt; respectively to avoid conflict with other EIPs. The conflict has since been removed.)&lt;&#x2F;p&gt;
&lt;p&gt;They use the same arguments on stack as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (&lt;code&gt;0x54&lt;&#x2F;code&gt;) and &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x55&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TLOAD&lt;&#x2F;code&gt; pops one 32-byte word from the top of the stack, treats this value as the address, fetches 32-byte word from the transient storage at that address, and pushes the value on top of the stack.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;TSTORE&lt;&#x2F;code&gt; pops two 32-byte words from the top of the stack. The word on the top is the address, and the next is the value. &lt;code&gt;TSTORE&lt;&#x2F;code&gt; saves the value at the given address in the transient storage.&lt;&#x2F;p&gt;
&lt;p&gt;Addressing is the same as &lt;code&gt;SLOAD&lt;&#x2F;code&gt; and &lt;code&gt;SSTORE&lt;&#x2F;code&gt;. i.e. each 32-byte address points to a unique 32-byte word.&lt;&#x2F;p&gt;
&lt;p&gt;Gas cost for &lt;code&gt;TSTORE&lt;&#x2F;code&gt; is the same as a warm &lt;code&gt;SSTORE&lt;&#x2F;code&gt; of a dirty slot (i.e. original value is not new value and is not current value, currently 100 gas), and gas cost of &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is the same as a hot &lt;code&gt;SLOAD&lt;&#x2F;code&gt; (value has been read before, currently 100 gas). Gas cost cannot be on par with memory access due to transient storage&#x27;s interactions with reverts.&lt;&#x2F;p&gt;
&lt;p&gt;All values in transient storage are discarded at the end of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Transient storage is private to the contract that owns it, in the same way as persistent storage. Only owning contract frames may access their transient storage. And when they do, all the frames access the same transient store, in the same way as persistent storage, but unlike memory.&lt;&#x2F;p&gt;
&lt;p&gt;When transient storage is used in the context of &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, then the owning contract of the transient storage is the contract that issued &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; instruction (the caller) as with persistent storage. When transient storage is used in the context of &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, then the owning contract of the transient storage is the contract that is the target of the &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; instruction (the callee).&lt;&#x2F;p&gt;
&lt;p&gt;If a frame reverts, all writes to transient storage that took place between entry to the frame and the return are reverted, including those that took place in inner calls.  This mimics the behavior of persistent storage.&lt;&#x2F;p&gt;
&lt;p&gt;If the &lt;code&gt;TSTORE&lt;&#x2F;code&gt; opcode is called within the context of a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;, it will result in an exception instead of performing the modification. &lt;code&gt;TLOAD&lt;&#x2F;code&gt; is allowed within the context of a &lt;code&gt;STATICCALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The behavior of the opcodes for transient storage differs from the opcodes for storage in that &lt;code&gt;TSTORE&lt;&#x2F;code&gt; does not require &lt;em&gt;gasleft&lt;&#x2F;em&gt;, as defined in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;, to be less than or equal to the gas stipend (currently 2,300).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Another option to solve the problem of inter-frame communication is repricing the &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt; opcodes to be cheaper for the transient storage use case. This has already been done as of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;2200&#x2F;&quot;&gt;EIP-2200&lt;&#x2F;a&gt;. However, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt; reduced the maximum refund to only 20% of the transaction gas cost, which means the use of transient storage is severely limited.&lt;&#x2F;p&gt;
&lt;p&gt;Another approach is to keep the refund counter for transient storage separate from the refund counter for other storage uses, and remove the refund cap for transient storage. However, that approach is more complex to implement and understand. For example, the 20% refund cap must be applied to the gas used &lt;em&gt;after&lt;&#x2F;em&gt; subtracting the uncapped gas refund. Otherwise, the refund amount available subject to the 20% refund cap could be increased by executing transient storage writes. Thus it is preferable to have a separate mechanism that does not interact with the refund counter. Future hard forks can remove the complex refund behavior meant to support the transient storage use case, encouraging migration to contracts that are more efficient for the Ethereum clients to execute.&lt;&#x2F;p&gt;
&lt;p&gt;There is a known objection to the word-addressed storage-like interface of the &lt;code&gt;TSTORE&lt;&#x2F;code&gt; and &lt;code&gt;TLOAD&lt;&#x2F;code&gt; opcodes since transient storage is more akin to memory than storage in lifecycle. A byte-addressed memory-like interface is another option. The storage-like word-addressed interface is preferred due to the usefulness of mappings in combination with the transaction-scoped memory region. Often times, you will need to keep transient state with arbitrary keys, such as in the &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;20&#x2F;&quot;&gt;ERC-20&lt;&#x2F;a&gt; temporary approval use case which uses a mapping of &lt;code&gt;(owner, spender)&lt;&#x2F;code&gt; to &lt;code&gt;allowance&lt;&#x2F;code&gt;. Mappings are difficult to implement using linear memory, and linear memory must also have dynamic gas costs. It is also more complicated to handle reverts with a linear memory. It is possible to have a memory-like interface while the underlying implementation uses a map to allow for storage in arbitrary offsets, but this would result in a third memory-storage hybrid interface that would require new code paths in compilers.&lt;&#x2F;p&gt;
&lt;p&gt;Some think that a unique transaction identifier may obviate the need for transient storage as described in this EIP. This is a misconception: a transaction identifier used in combination with regular storage has all the same issues that motivate this EIP. The two features are orthogonal.&lt;&#x2F;p&gt;
&lt;p&gt;Relative cons of this transient storage EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Does not address transient usages of storage in existing contracts&lt;&#x2F;li&gt;
&lt;li&gt;New code in the clients&lt;&#x2F;li&gt;
&lt;li&gt;New concept for the yellow paper (more to update)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Relative pros of this transient storage EIP:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Transient storage opcodes are considered separately in protocol upgrades and not inadvertently broken (e.g. &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;3529&#x2F;&quot;&gt;EIP-3529&lt;&#x2F;a&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Clients do not need to load the original value&lt;&#x2F;li&gt;
&lt;li&gt;No upfront gas cost to account for non-transient writes&lt;&#x2F;li&gt;
&lt;li&gt;Does not change the semantics of the existing operations&lt;&#x2F;li&gt;
&lt;li&gt;No need to clear storage slots after usage&lt;&#x2F;li&gt;
&lt;li&gt;Simpler gas accounting rules&lt;&#x2F;li&gt;
&lt;li&gt;Future storage designs (e.g. Verkle tree) do not need to account for transient storage refunds&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement.&lt;&#x2F;p&gt;
&lt;p&gt;Since this EIP does not change behavior of any existing opcodes, it is backwards compatible with all existing smart contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;A test suite for this EIP can be found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;execution-spec-tests&#x2F;tree&#x2F;1983444bbe1a471886ef7c0e82253ffe2a4053e1&#x2F;tests&#x2F;cancun&#x2F;eip1153_tstore&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reference-implementation&quot;&gt;Reference Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Because the transient storage must behave almost identically to storage within the context of a single transaction with regards to revert behavior, it is necessary to be able to revert to a previous state of transient storage within a transaction. At the same time reverts are exceptional cases and loads, stores and returns should be cheap.&lt;&#x2F;p&gt;
&lt;p&gt;A map of current state plus a journal of all changes and a list of checkpoints is recommended. This has the following time complexities:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;On entry to a call frame, a call marker is added to the list - &lt;code&gt;O(1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;New values are written to the current state, and the previous value is written to the journal - &lt;code&gt;O(1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;When a call exits successfully, the marker to the journal index of when that call was entered is discarded - &lt;code&gt;O(1)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;On revert all entries are reverted up to the last checkpoint, in reverse - &lt;code&gt;O(N)&lt;&#x2F;code&gt; where &lt;code&gt;N&lt;&#x2F;code&gt; = number of journal entries since last checkpoint&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;typescript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; JournalEntry&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;    prevValue&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Journal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; JournalEntry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Checkpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Journal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;interface&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        [&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EMPTY_VALUE&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;class&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TransientStorage&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The current state of transient storage.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    private&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; current&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Current&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * All changes are written to the journal. On revert, we apply the changes in reverse to the last checkpoint.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    private&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; journal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Journal&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * The length of the journal at the time of each checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    private&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; checkpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Checkpoints&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Returns the current value of the given contract address and key&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The address of the contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The key of transient storage for the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;?.&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; EMPTY_VALUE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Set the current value in the map&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the address of the contract for which the key is being set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the slot to set for the address&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * &lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;@&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;param&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the new value of the slot to set&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; put&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; key&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; string&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            prevValue&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;get&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ??&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; value&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Commit all the changes since the last checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; commit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Nothing to commit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The last checkpoint is discarded.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * To be called whenever entering a new context. If revert is called after checkpoint, all changes made after the latest checkpoint are reverted.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; checkpoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; void&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;push&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;**&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;     * Revert transient storage to the state from the last call to checkpoint&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    public&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        const&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;checkpoints&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;pop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;typeof&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ===&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;undefined&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; throw&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; new&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; Error&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Nothing to revert&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;let&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            const&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; key&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-constant&quot;&gt; prevValue&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; we can assume it exists, since it was written in the journal&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;            this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;current&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;key&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; prevValue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;        this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;splice&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;lastCheckpoint&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; this&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;journal&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-variable&quot;&gt;length&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; lastCheckpoint&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The worst case time complexity can be produced by writing the maximum number of keys that can fit in one block, and then reverting. In this case, the client is required to do twice as many writes to apply all the entries in the journal. However, the same case applies to the state journaling implementation of existing clients, and cannot be DOS&#x27;d with the following code.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;pragma&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name z-tag&quot;&gt; solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; =0.8.13&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;contract&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; TryDOS&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    uint256&lt;&#x2F;span&gt;&lt;span&gt; slot&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    constructor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; tryDOS&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; external&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        uint256&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        while&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;gasleft&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            unchecked&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                slot &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;TSTORE&lt;&#x2F;code&gt; presents a new way to allocate memory on a node with linear cost. In other words, each TSTORE allows the developer to store 32 bytes for 100 gas, excluding any other required operations to prepare the stack. Given 30 million gas, the maximum amount of memory that can be allocated using TSTORE is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30M gas * 1 TSTORE &#x2F; 100 gas * 32 bytes &#x2F; 1 TSTORE * 1MB &#x2F; 2^20 bytes ~= 9.15MB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Given the same amount of gas, the maximum amount of memory that can be allocated in a single context by &lt;code&gt;MSTORE&lt;&#x2F;code&gt; is ~3.75MB:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30M gas = 3x + x^2 &#x2F; 512 =&amp;gt; x = ~123,169 32-byte words&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~123,169 words * 32 bytes&#x2F;word * 1MB &#x2F; 2^20 bytes = 3.75MB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;However, if you only spend 1M gas allocating memory in each context, and make calls to reset the memory expansion cost, you can allocate ~700KB per million gas, for a total of ~20MB of memory allocated:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1M gas = 3x + x^2 &#x2F; 512 =&amp;gt; x = ~21,872 32-byte words&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;30M gas * ~21,872 words &#x2F; 1M gas * 32 bytes&#x2F;word * 1MB &#x2F; 2^20 bytes = ~20MB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Smart contract developers should understand the lifetime of transient storage variables before use. Because transient storage is automatically cleared at the end of the transaction, smart contract developers may be tempted to avoid clearing slots as part of a call in order to save gas. However, this could prevent further interactions with the contract in the same transaction (e.g. in the case of re-entrancy locks) or cause other bugs, so smart contract developers should be careful to &lt;em&gt;only&lt;&#x2F;em&gt; leave transient storage slots with nonzero values when those slots are intended to be used by future calls within the same transaction. Otherwise, these opcodes behave exactly the same as &lt;code&gt;SSTORE&lt;&#x2F;code&gt; and &lt;code&gt;SLOAD&lt;&#x2F;code&gt;, so all the usual security considerations apply especially in regard to reentrancy risk.&lt;&#x2F;p&gt;
&lt;p&gt;Smart contract developers may also be tempted to use transient storage as an alternative to in-memory mappings. They should be aware that transient storage is not discarded when a call returns or reverts, as is memory, and should prefer memory for these use cases so as not to create unexpected behavior on reentrancy in the same transaction. The necessarily high cost of transient storage over memory should already discourage this usage pattern. Most usages of in-memory mappings can be better implemented with key-sorted lists of entries, and in-memory mappings are rarely required in smart contracts (i.e. the author knows of no known use cases in production).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>PRECOMPILEDCALL opcode (Remove CALL costs for precompiled contracts)</title>
        <published>2018-05-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Jordi Baylina</name><uri>https://github.com/jbaylina</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1109/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1109-remove-call-costs-for-precompiled-contracts/447" />
        

        <id>https://wg-eips.ritovision.com/1109/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1109"
            label="EIP-1109" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1109/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP creates a specific opcode named &lt;code&gt;PRECOMPILEDCALL&lt;&#x2F;code&gt; to call Precompiled contracts without the costs of a normal &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP tries to resolve the problem of high gas consumption when calling precompiled contracts with a small gas cost. Using this opcode for calling precompiled contracts allows to define precompiled contracts whose effective cost it is less than 700.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Each precompiled contract has an already defined cost for calling it. It does not make sense to add the implicit extra gas cost of the CALL opcode.&lt;&#x2F;p&gt;
&lt;p&gt;As an example, SHA256 precompiled contract costs 60 and ECADD costs 500 (proposed to costs only 50 in &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1108&#x2F;&quot;&gt;EIP-1108&lt;&#x2F;a&gt; . When a precompiled contract is called, 700 gas is consumed just for the CALL opcode besides the costs of the precompiled contract.&lt;&#x2F;p&gt;
&lt;p&gt;This makes no sense, and right now it&#x27;s impossible to define a precompiled contract whose effective cost for using it, is less than 700.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= XXXXX&lt;&#x2F;code&gt;, define a new opcode named &lt;code&gt;PRECOMPILEDCALL&lt;&#x2F;code&gt; with code value &lt;code&gt;0xfb&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of the OPCODE is 2 (Gbase) plus the Specific gas cost defined for each specific precompiled smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;The OPCODE takes 5 words from the stack and returns 1 word to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The input stack values are:&lt;&#x2F;p&gt;
&lt;p&gt;mu_s[0] = The address of the precompiled smart contract that is called.
mu_s[1] = Pointer to memory for the input parameters.
mu_s[2] = Length of the input parameters in bytes.
mu_s[3] = Pointer to memory where the output is stored
mu_s[4] = Length of the output buffer.&lt;&#x2F;p&gt;
&lt;p&gt;The return will be 1 in case of success call and 0 in any of the next cases:&lt;&#x2F;p&gt;
&lt;p&gt;1.- mu_s[0] is an address of an undefined precompiled smart contract.
2.- The precompiled smart contract fails (as defined on each smart contract). Invalid input parameters for example.&lt;&#x2F;p&gt;
&lt;p&gt;Precompiled smart contracts, does not execute opcodes, so there is no need to pass a gas parameter as a normal &lt;code&gt;CALL&lt;&#x2F;code&gt; (&lt;code&gt;0xf1&lt;&#x2F;code&gt;).  If the available gas is less that 2 plus the required gas required for the specific precompiled smart contract, the context just STOPS executing with an &quot;Out of Gas&quot; error.&lt;&#x2F;p&gt;
&lt;p&gt;There is no stack check for this call.&lt;&#x2F;p&gt;
&lt;p&gt;The normal &lt;code&gt;CALL&lt;&#x2F;code&gt;s to the precompiled smart contracts continue to work with the exact same behavior.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;code&gt;PRECOMPILEDCALL&lt;&#x2F;code&gt; to a regular address or regular smart contract, is considered a call to an &quot;undefined smart contract&quot;, so the VM MUST not execute it and the opcode must return 0x0 .&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;There was a first proposal for removing the gast consts for the &lt;code&gt;CALL&lt;&#x2F;code&gt;, but it looks that it&#x27;s easier to implement and test a new opcode just for that.&lt;&#x2F;p&gt;
&lt;p&gt;The code is just the next opcode available after the &lt;code&gt;STATICCALL&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible.  Smart contracts that call precompiled contracts using this new opcode will cost less from now on.&lt;&#x2F;p&gt;
&lt;p&gt;Old contracts that call precompiled smart contracts with the &lt;code&gt;CALL&lt;&#x2F;code&gt; method, will continue working.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Normal call to a defined precompiled contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call to undefined precompiled contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call to a regular contract&lt;&#x2F;li&gt;
&lt;li&gt;Call to a regular account&lt;&#x2F;li&gt;
&lt;li&gt;Call to 0x0 smart contract (Does not exists).&lt;&#x2F;li&gt;
&lt;li&gt;Call with large values for the offste pointers and lengths&lt;&#x2F;li&gt;
&lt;li&gt;Call with the exact gas remaining needed to call smart contract.&lt;&#x2F;li&gt;
&lt;li&gt;Call with the exact gas remaining minus one needed to call smart contract.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Not implemented yet.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce alt_bn128 precompile gas costs</title>
        <published>2018-05-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Antonio Salazar Cardozo</name><uri>https://github.com/shadowfiend</uri>
	</author>
	
	<author>
		<name>Zachary Williamson</name><uri>https://github.com/zac-williamson</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1108/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-1108-reduce-alt-bn128-precompile-gas-costs/3206" />
        

        <id>https://wg-eips.ritovision.com/1108/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1108"
            label="EIP-1108" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1108/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The elliptic curve arithmetic precompiles are currently overpriced. Re-pricing the precompiles would greatly assist a number of privacy solutions and scaling solutions on Ethereum.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Changes in 2018 to the underlying library used by the official Go reference
implementation led to significant performance gains for the &lt;code&gt;ECADD&lt;&#x2F;code&gt;, &lt;code&gt;ECMUL&lt;&#x2F;code&gt;,
and pairing check precompiled contracts on the &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; elliptic curve.&lt;&#x2F;p&gt;
&lt;p&gt;In the Parity client, field operations used by the precompile algorithms were optimized in 2018,
and recent changes to the pairing algorithm used by the &lt;code&gt;bn&lt;&#x2F;code&gt; crate have brought considerable speedups.&lt;&#x2F;p&gt;
&lt;p&gt;Faster operations on Ethereum clients should be reflected in reduced gas costs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Recently, the underlying library used by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&quot;&gt;official Go reference
implementation&lt;&#x2F;a&gt; to implement the
&lt;code&gt;ECADD&lt;&#x2F;code&gt; (at address &lt;code&gt;0x06&lt;&#x2F;code&gt;), &lt;code&gt;ECMUL&lt;&#x2F;code&gt; (at address &lt;code&gt;0x07&lt;&#x2F;code&gt;), and pairing check (at
address &lt;code&gt;0x08&lt;&#x2F;code&gt;) precompiled contracts was shifted to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;cloudflare&#x2F;bn256&quot;&gt;Cloudflare&#x27;s bn256
library&lt;&#x2F;a&gt;. Based on the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16203&quot;&gt;initial PR that
introduced this change&lt;&#x2F;a&gt;,
and corroborated in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16301#issuecomment-372687543&quot;&gt;a later
note&lt;&#x2F;a&gt;,
the computational cost of &lt;code&gt;ECADD&lt;&#x2F;code&gt;, &lt;code&gt;ECMUL&lt;&#x2F;code&gt;, and pairing checks (excepting the
constant) has dropped roughly an order of magnitude across the board.&lt;&#x2F;p&gt;
&lt;p&gt;Also, optimizations in the bn library &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;bn&#x2F;pull&#x2F;9&quot;&gt;in 2018&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;bn&#x2F;pull&#x2F;14&quot;&gt;2019&lt;&#x2F;a&gt;
used by the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity-ethereum&quot;&gt;Parity client&lt;&#x2F;a&gt; led to a
significant performance boost we
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;zac-williamson&#x2F;838410a3da179d47d31b25b586c15e53&quot;&gt;benchmarked&lt;&#x2F;a&gt;
and compared against the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;pdyraga&#x2F;4649b74436940a01e8221d85e80bfeef&quot;&gt;previous
results&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Following is a table with the current gas cost and new gas cost:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Contract&lt;&#x2F;th&gt;&lt;th&gt;Address&lt;&#x2F;th&gt;&lt;th&gt;Current Gas Cost&lt;&#x2F;th&gt;&lt;th&gt;Updated Gas Cost&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ECADD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x06&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;500&lt;sup&gt;[1]&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;150&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ECMUL&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x07&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;40 000&lt;sup&gt;[1]&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;6 000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Pairing check&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;0x08&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;80 000 * k + 100 000&lt;sup&gt;[2]&lt;&#x2F;sup&gt;&lt;&#x2F;td&gt;&lt;td&gt;34 000 * k + 45 000&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The gas costs for &lt;code&gt;ECADD&lt;&#x2F;code&gt; and &lt;code&gt;ECMUL&lt;&#x2F;code&gt; are updates to the costs listed in
EIP-196, while the gas costs for the pairing check are updates to the cost
listed in EIP-197. Updated gas costs have been adjusted to the less performant
client which is Parity, according to benchmarks&lt;sup&gt;[3]&lt;&#x2F;sup&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To come up with these updates gas costs, the performance of the &lt;code&gt;ecrecover&lt;&#x2F;code&gt; precompile
was measured at 116 microseconds per &lt;code&gt;ecrecover&lt;&#x2F;code&gt; invocation. Assuming the &lt;code&gt;ecrecover&lt;&#x2F;code&gt;
gas price is fair at 3,000 gas, we get a price of 25.86 gas per microsecond of a precompile
algorithm&#x27;s runtime. With this in mind, the pairing precompile took 3,037 microseconds to
compute 1 pairing, and 14,663 microseconds to compute 10 pairings. From this, the pairing
algorithm has a fixed &#x27;base&#x27; run-time of 1,745 microseconds, plus 1,292 microseconds per
pairing. We can split the run-time into &#x27;fixed cost&#x27; and &#x27;linear cost per pairing&#x27;
components because of the structure of the algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Thus using a &#x27;fair&#x27; price of 25.86 gas per microsecond, we get a gas formula of
~&lt;code&gt;35,000 * k + 45,000&lt;&#x2F;code&gt; gas, where &lt;code&gt;k&lt;&#x2F;code&gt; is the number of pairings being computed. [4]&lt;&#x2F;p&gt;
&lt;p&gt;[1]- Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;[2]- Per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;197&#x2F;&quot;&gt;EIP-197&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;[3]- &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;zac-williamson&#x2F;838410a3da179d47d31b25b586c15e53&quot;&gt;Parity benchmarks.&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;[4]- &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;1987#discussion_r280977066&quot;&gt;PR comment clarifying gas cost math&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;existing-protocols-would-benefit-immensely-from-cheaper-elliptic-curve-cryptography&quot;&gt;Existing protocols would benefit immensely from cheaper elliptic curve cryptography&lt;&#x2F;h3&gt;
&lt;p&gt;Fast elliptic curve cryptography is a keystone of a growing number of protocols built on top of Ethereum. To list a few:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;AztecProtocol&#x2F;AZTEC&quot;&gt;The AZTEC protocol&lt;&#x2F;a&gt; utilizes the elliptic curve precompiles to construct private tokens, with zero-knowledge transaction logic, via the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1723&quot;&gt;ERC-1723&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1724&quot;&gt;ERC-1724&lt;&#x2F;a&gt; standard.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;matter-network&quot;&gt;Matter Labs&lt;&#x2F;a&gt; utilizes the precompiles to implement Ignis, a scaling solution with a throughput of 500txns per second&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rollup&#x2F;rollup&quot;&gt;Rollup&lt;&#x2F;a&gt; utilizes the precompiles to create L2 scaling solutions, where the correctness of transactions is guaranteed by main-net, without an additional consensus layer&lt;&#x2F;li&gt;
&lt;li&gt;ZEther&lt;sup class=&quot;footnote-reference&quot; id=&quot;fr-1-1&quot;&gt;&lt;a href=&quot;#fn-1&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; uses precompiles &lt;code&gt;ECADD&lt;&#x2F;code&gt; and &lt;code&gt;ECMUL&lt;&#x2F;code&gt; to construct confidential transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;To give a concrete example, it currently costs &lt;code&gt;820,000&lt;&#x2F;code&gt; gas to validate the cryptography in a typical AZTEC confidential transaction. If the gas schedule for the precompiles correctly reflected their load on the Ethereum network, this cost would be &lt;code&gt;197,000&lt;&#x2F;code&gt; gas. This significantly increases the potential use cases for private assets on Ethereum. AZTEC is planning to deploy several cryptographic protocols Ethereum, but these are at the limits of what is practical given the current precompile costs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Confidential weighted voting&lt;&#x2F;li&gt;
&lt;li&gt;Partial-order filling over encrypted orders, for private decentralized exchanges&lt;&#x2F;li&gt;
&lt;li&gt;Anonymous identity sharing proofs (e.g. proving you are on a whitelist, without revealing who you are)&lt;&#x2F;li&gt;
&lt;li&gt;Many-to-one payments and one-to-many confidential payments, as encrypted communication channels between main-net and L2 applications&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For zk-SNARK based protocols on Ethereum, EIP-1108 will not only reduce the gas costs of verifying zk-SNARKs substantially, but can also aid in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;matter-labs&#x2F;Groth16BatchVerifier&quot;&gt;batching together multiple zk-SNARK proofs&lt;&#x2F;a&gt;. This is also a technique that can be used to split up monolithic zk-SNARK circuits into a batch of zk-SNARKs with smaller individual circuit sizes, which makes zk-SNARKs both easier to construct and deploy.&lt;&#x2F;p&gt;
&lt;p&gt;ZEther transactions currently cost ~&lt;code&gt;6,000,000&lt;&#x2F;code&gt; gas. This EIP would reduce this to ~&lt;code&gt;1,000,000&lt;&#x2F;code&gt; gas, which makes the protocol more practical.&lt;&#x2F;p&gt;
&lt;p&gt;To summarise, there are several protocols that currently exist on main-net, that would benefit immensely from this EIP. Elliptic curve cryptography can provide valuable solutions for Ethereum, such as scaling and privacy, and the scope and scale of these solutions can be increased if the gas costs for the &lt;code&gt;bn128&lt;&#x2F;code&gt; precompiles accurately reflects their computational load on the network.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;cheaper-elliptic-curve-cryptography-can-be-used-to-trade-storage-for-computation&quot;&gt;Cheaper elliptic curve cryptography can be used to trade storage for computation&lt;&#x2F;h3&gt;
&lt;p&gt;Solutions such as Rollup and Ignis can be used to batch groups of individual transactions into a zk-SNARK proof, with the on-chain state being represented by a small Merkle root, instead of multiple account balances.&lt;&#x2F;p&gt;
&lt;p&gt;If zk-SNARK verification costs are decreased, these solutions can be deployed for a wider range of use cases and more Rollup-style transactions can be processed per block.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parity-and-geth-already-have-fast-algorithms-that-justify-reduced-gas-costs&quot;&gt;Parity and Geth already have fast algorithms that justify reduced gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP does not require Parity or Geth to deploy new cryptographic libraries, as fast bn128 algorithms have already been integrated into these clients. This goal of proposing this EIP for Istanbul, is to supplement &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1829&#x2F;&quot;&gt;EIP-1829&lt;&#x2F;a&gt; (arithmetic over generic elliptic curves), providing an immediate solution to the pressing problem of expensive cryptography, while more advanced solutions are developed, defined and deployed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;As no underlying algorithms are being changed, there are no additional test cases to specify.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Both the Parity and Geth clients have already implemented cryptographic libraries that are fast enough to justify reducing the precompile gas costs. As a reference, here are a list of elliptic curve libraries, in &lt;code&gt;C++&lt;&#x2F;code&gt;, &lt;code&gt;golang&lt;&#x2F;code&gt; and &lt;code&gt;rust&lt;&#x2F;code&gt;, that support the &lt;code&gt;bn128&lt;&#x2F;code&gt; curve, and have run-times that are equal to or faster than the Parity benchmarks.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;bn&quot;&gt;Parity bn crate (rust)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;tree&#x2F;master&#x2F;crypto&#x2F;bn256&#x2F;cloudflare&quot;&gt;Geth bn256 library (golang)&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;herumi&#x2F;mcl&quot;&gt;MCL, a portable C++ pairing library&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&quot;&gt;Libff, a C++ pairing library used in many zk-SNARK libraries&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;additional-references&quot;&gt;Additional References&lt;&#x2F;h2&gt;
&lt;p&gt;@vbuterin independently proposed a similar reduction after this EIP was originally created, with similar rationale, as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;1187&quot;&gt;ethereum&#x2F;EIPs#1187&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;section class=&quot;footnotes&quot;&gt;
&lt;ol class=&quot;footnotes-list&quot;&gt;
&lt;li id=&quot;fn-1&quot;&gt;
&lt;p&gt;Bünz, B., Agrawal, S., Zamani, M., &amp;amp; Boneh, D. (2020). Zether: Towards Privacy in a Smart Contract World. In J. Bonneau &amp;amp; N. Heninger (Eds.), &lt;span style=&quot;font-style: italic;&quot;&gt;Financial Cryptography and Data Security&lt;&#x2F;span&gt;. https:&#x2F;&#x2F;doi.org&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;doi.org&#x2F;10.1007&#x2F;978-3-030-51280-4_23&quot;&gt;10.1007&#x2F;978-3-030-51280-4_23&lt;&#x2F;a&gt;These are all technologies that have been, or are in the process of being, deployed to main-net. These protocols would all benefit from reducing the gas cost of the precompiles. &lt;a href=&quot;#fr-1-1&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;section&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Net gas metering for SSTORE operations</title>
        <published>2018-05-17T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><uri>https://github.com/arachnid</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1087/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-net-storage-gas-metering-for-the-evm/383" />
        

        <id>https://wg-eips.ritovision.com/1087/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1087"
            label="EIP-1087" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1087/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes a change to how gas is charged for EVM &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations, in order to reduce excessive gas costs in situations where these are unwarranted, and to enable new use-cases for contract storage.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Presently, &lt;code&gt;SSTORE&lt;&#x2F;code&gt; (&lt;code&gt;0x55&lt;&#x2F;code&gt;) operations are charged as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;20,000 gas to set a slot from 0 to non-0&lt;&#x2F;li&gt;
&lt;li&gt;5,000 gas for any other change&lt;&#x2F;li&gt;
&lt;li&gt;A 10,000 gas refund when a slot is set from non-0 to 0. Refunds are applied at the end of the transaction.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In situations where a single update is made to a storage value in a transaction, these gas costs have been determined to fairly reflect the resources consumed by the operation. However, this results in excessive gas costs for sequences of operations that make multiple updates.&lt;&#x2F;p&gt;
&lt;p&gt;Some examples to illustrate the problem:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0, it will be charged &lt;code&gt;20000 + 5000 - 10000 = 15000&lt;&#x2F;code&gt; gas, despite this sequence of operations not requiring any disk writes.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be charged &lt;code&gt;20000 + 5 * 5000 = 45000&lt;&#x2F;code&gt; gas, despite this sequence of operations requiring no more disk activity than a single write, charged at 20000 gas.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a transfer from B to C, with all accounts having nonzero starting and ending balances, will cost &lt;code&gt;5000 * 4 = 20000&lt;&#x2F;code&gt; gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Addressing this issue would also enable new use-cases that are currently cost-prohibitive, where a sequence of operations results in no net change to storage at the end of the transaction. For instance, mutexes to prevent reentrancy, or context information passed between multiple calls to the same contract. One such example is an &lt;code&gt;approveAndCall&lt;&#x2F;code&gt; operation, which would permit sending to and calling a contract in a single transaction, without that contract having to be updated for a new token standard.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following changes are made to the EVM:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A &#x27;dirty map&#x27; for each transaction is maintained, tracking all storage slots in all contracts that have been modified in the current transaction. The dirty map is scoped in the same manner as updates to storage, meaning that changes to the dirty map in a call that later reverts are not retained.&lt;&#x2F;li&gt;
&lt;li&gt;When a storage slot is written to with the value it already contains, 200 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;When a storage slot&#x27;s value is changed for the first time, the slot is marked as dirty. If the slot was previously set to 0, 20000 gas is deducted; otherwise, 5000 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;When a storage slot that is already in the dirty map is written to, 200 gas is deducted.&lt;&#x2F;li&gt;
&lt;li&gt;At the end of the transaction, for each slot in the dirty map:
&lt;ul&gt;
&lt;li&gt;If the slot was 0 before the transaction and is 0 now, refund 19800 gas.&lt;&#x2F;li&gt;
&lt;li&gt;If the slot was nonzero before the transaction and its value has not changed, refund 4800 gas.&lt;&#x2F;li&gt;
&lt;li&gt;If the slot was nonzero before the transaction and is 0 now, refund 15000 gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;After these changes, transactions that make only a single change to a storage slot will retain their existing costs. However, contracts that make multiple changes will see significantly reduced costs. Repeating the examples from the Motivation section:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a contract with empty storage sets slot 0 to 1, then back to 0, it will be charged &lt;code&gt;20000 + 200 - 19800 = 400&lt;&#x2F;code&gt; gas, down from 15000.&lt;&#x2F;li&gt;
&lt;li&gt;A contract with empty storage that increments slot 0 5 times will be charged &lt;code&gt;20000 + 5 * 200 = 21000&lt;&#x2F;code&gt; gas, down from 45000.&lt;&#x2F;li&gt;
&lt;li&gt;A balance transfer from account A to account B followed by a transfer from B to C, with all accounts having nonzero starting and ending balances, will cost &lt;code&gt;5000 * 3 + 200 - 4800 = 10400&lt;&#x2F;code&gt; gas, down from 20000.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;We believe the proposed mechanism represents the simplest way to reduce storage gas costs in situations where they do not reflect the actual costs borne by nodes. Several alternative designs were considered and dismissed:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Charging a flat 200 gas for &lt;code&gt;SSTORE&lt;&#x2F;code&gt; operations, and an additional 19800 &#x2F; 4800 at the end of a transaction for new or modified values is simpler, and removes the need for a dirty map, but pushes a significant source of gas consumption out of the EVM stack and applies it at the end of the transaction, which is likely to complicate debugging and reduces contracts&#x27; ability to limit the gas consumption of callees, as well as introducing a new mechanism to the EVM.&lt;&#x2F;li&gt;
&lt;li&gt;Keeping a separate refund counter for storage gas refunds would avoid the issue of refunds being limited to half the gas consumed (not necessary here), but would introduce additional complexity in tracking this value.&lt;&#x2F;li&gt;
&lt;li&gt;Refunding gas each time a storage slot is set back to its initial value would introduce a new mechanism (instant refunds) and complicate gas accounting for contracts calling other contracts; it would also permit the possibility of a contract call with negative execution cost.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP requires a hard fork to implement.&lt;&#x2F;p&gt;
&lt;p&gt;No contract should see an increase in gas cost for this change, and many will see decreased gas consumption, so no contract-layer backwards compatibility issues are anticipated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;Writing x to a storage slot that contains 0, where x != 0 (20k gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing y to a storage slot that contained x, where x != y and x != 0 (5k gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing 0 to a storage slot that contains x, where x != 0 (5k gas, 10k refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing 0 to a storage slot that already contains zero (200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x to a storage slot that already contains x, where x != 0 (200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains 0, where x != y (20200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains 0, where x != y != z and x != 0 (5200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then 0 to a storage slot that contains 0, where x != 0 (20200 gas, 19800 refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains y, where x != y != 0 (5200 gas, 4800 refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then 0 to a storage slot that contains 0, then reverting the stack frame in which the writes occurred (20200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;Writing x, then y to a storage slot that contains y, then reverting the stack frame in which the writes occurred (5200 gas, no refund)&lt;&#x2F;li&gt;
&lt;li&gt;In a nested frame, writing x to a storage slot that contains 0, then returning, and writing 0 to that slot (20200 gas, 19800 refund)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Overflow checking for the EVM</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1051/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-arithmetic-overflow-detection-for-the-evm/261" />
        

        <id>https://wg-eips.ritovision.com/1051/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1051"
            label="EIP-1051" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1051/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds overflow checking for EVM arithmetic operations, and two new opcodes that check and clear the overflow flags.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The correct functioning of many contracts today is dependent on detecting and preventing overflow of arithmetic operations. Since the EVM operates on mod 2^256 integers and provides no built-in overflow detection or prevention, this requires manual checks on every arithmetic operation.&lt;&#x2F;p&gt;
&lt;p&gt;In the interests of facilitating efficient and secure contracts, we propose new opcodes that permit efficient detection of overflows, which can be checked periodically rather than after each operation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Two new flags are added to the EVM state: overflow (&lt;code&gt;ovf&lt;&#x2F;code&gt;) and signed overflow (&lt;code&gt;sovf&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;ovf&lt;&#x2F;code&gt; flag is set in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When an &lt;code&gt;ADD&lt;&#x2F;code&gt; (&lt;code&gt;0x01&lt;&#x2F;code&gt;) opcode, with both inputs treated as unsigned integers, produces an ideal output in excess of 2^256 - 1.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;SUB&lt;&#x2F;code&gt; (&lt;code&gt;0x03&lt;&#x2F;code&gt;) opcode, with both inputs treated as unsigned integers, produces an ideal output less than 0.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; (&lt;code&gt;0x02&lt;&#x2F;code&gt;) opcode, with both inputs treated as unsigned integers, produces an ideal output in excess of 2^256 - 1.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;code&gt;sovf&lt;&#x2F;code&gt; flag is set whenever the &lt;code&gt;ovf&lt;&#x2F;code&gt; flag is set, and additionally in the following circumstances:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;When an &lt;code&gt;ADD&lt;&#x2F;code&gt; opcode with both inputs having the same MSB results in the output having a different MSB (eg, &lt;code&gt;(+a) + (+b) = (-c)&lt;&#x2F;code&gt; or &lt;code&gt;(-a) + (-b) = (+c)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;SUB&lt;&#x2F;code&gt; opcode occurs and the result has the same MSB as the subtracted (second argument) (eg, &lt;code&gt;(+a) - (-b) = (-c)&lt;&#x2F;code&gt; or &lt;code&gt;(-a) - (+b) = (+c)&lt;&#x2F;code&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; opcode with both inputs being positive has a negative output.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; opcode with both inputs being negative has a negative output.&lt;&#x2F;li&gt;
&lt;li&gt;When a &lt;code&gt;MUL&lt;&#x2F;code&gt; opcode with one negative input and one positive input has a positive output.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A new opcode, &lt;code&gt;OFV&lt;&#x2F;code&gt; is added, with number &lt;code&gt;0x0c&lt;&#x2F;code&gt;. This opcode takes 0 arguments from the stack. When executed, it pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the &lt;code&gt;ovf&lt;&#x2F;code&gt; flag is set, and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise. It then sets the &lt;code&gt;ovf&lt;&#x2F;code&gt; flag to false.&lt;&#x2F;p&gt;
&lt;p&gt;A new opcode, &lt;code&gt;SOVF&lt;&#x2F;code&gt; is added, with number &lt;code&gt;0x0d&lt;&#x2F;code&gt;. This opcode takes 0 arguments from the stack. When executed, it pushes &lt;code&gt;1&lt;&#x2F;code&gt; if the &lt;code&gt;sovf&lt;&#x2F;code&gt; flag is set, and &lt;code&gt;0&lt;&#x2F;code&gt; otherwise. It then sets the &lt;code&gt;sovf&lt;&#x2F;code&gt; flag to false.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Any change to implement overflow protection needs to preserve behaviour of existing contracts, which precludes many changes to the arithmetic operations themselves. One option would be to provide an opcode that enables overflow protection, causing a throw or revert if an overflow happens. However, this limits the manner in which overflows can be handled.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, we replicate functionality from real world CPUs, which typically implement &#x27;carry&#x27; and &#x27;overflow&#x27; flags.&lt;&#x2F;p&gt;
&lt;p&gt;Separate flags for signed and unsigned overflow are necessary due to the fact that a signed overflow may not result in an unsigned overflow.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces no backwards compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXTCODEHASH opcode</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>arachnid@notdot.net</email>
	</author>
	
	<author>
		<name>Paweł Bylica</name><email>pawel@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1052/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/extcodehash-opcode/262" />
        

        <id>https://wg-eips.ritovision.com/1052/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1052"
            label="EIP-1052" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1052/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a new opcode, which returns the keccak256 hash of a contract&#x27;s code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Many contracts need to perform checks on a contract&#x27;s bytecode, but do not necessarily need the bytecode itself. For instance, a contract may want to check if another contract&#x27;s bytecode is one of a set of permitted implementations, or it may perform analyses on code and whitelist any contract with matching bytecode if the analysis passes.&lt;&#x2F;p&gt;
&lt;p&gt;Contracts can presently do this using the &lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3c&lt;&#x2F;code&gt;) opcode, but this is expensive, especially for large contracts, in cases where only the hash is required. As a result, we propose a new opcode, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, which returns the keccak256 hash of a contract&#x27;s bytecode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;A new opcode, &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;, is introduced, with number &lt;code&gt;0x3f&lt;&#x2F;code&gt;. The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt;
takes one argument from the stack, zeros the first 96 bits
and pushes to the stack the keccak256 hash of the code of the account
at the address being the remaining 160 bits.&lt;&#x2F;p&gt;
&lt;p&gt;In case the account does not exist or is empty (as defined by &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;) &lt;code&gt;0&lt;&#x2F;code&gt; is pushed to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;In case the account does not have code the keccak256 hash of empty data
(i.e. &lt;code&gt;c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;)
is pushed to the stack.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost of the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; is 400.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;As described in the motivation section, this opcode is widely useful, and saves
on wasted gas in many cases.&lt;&#x2F;p&gt;
&lt;p&gt;The gas cost is the same as the gas cost for the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; opcode because the
execution of the &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; requires the same account lookup as in &lt;code&gt;BALANCE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Only the 20 last bytes of the argument are significant (the first 12 bytes are
ignored) similarly to the semantics of the &lt;code&gt;BALANCE&lt;&#x2F;code&gt; (&lt;code&gt;0x31&lt;&#x2F;code&gt;), &lt;code&gt;EXTCODESIZE&lt;&#x2F;code&gt; (&lt;code&gt;0x3b&lt;&#x2F;code&gt;) and
&lt;code&gt;EXTCODECOPY&lt;&#x2F;code&gt; (&lt;code&gt;0x3c&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; distinguishes accounts without code and non-existing accounts.
This is consistent with the way accounts are represented in the state trie.
This also allows smart contracts to check whether an account exists.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There are no backwards compatibility concerns.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of the account without code is &lt;code&gt;c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470&lt;&#x2F;code&gt;
what is the keccak256 hash of empty data.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of non-existent account is &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of a precompiled contract is either &lt;code&gt;c5d246...&lt;&#x2F;code&gt; or &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of &lt;code&gt;A&lt;&#x2F;code&gt; is &lt;code&gt;X&lt;&#x2F;code&gt;, then &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of &lt;code&gt;A + 2**160&lt;&#x2F;code&gt; is &lt;code&gt;X&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that selfdestructed in the current transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that selfdestructed and later the selfdestruct has been reverted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account created in the current transaction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that has been newly created and later the creation has been reverted.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an account that firstly does not exist and later is empty.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;code&gt;EXTCODEHASH&lt;&#x2F;code&gt; of an empty account that is going to be cleared by the state clearing rule.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TBD&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>ProgPoW, a Programmatic Proof-of-Work</title>
        <published>2018-05-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	<author>
		<name>Andrea Lanfranchi</name><uri>https://github.com/AndreaLanfranchi</uri>
	</author>
	
	<author>
		<name>Michael Carter</name><uri>https://github.com/bitsbetrippin</uri>
	</author>
	
	<author>
		<name>IfDefElse</name><email>ifdefelse@protonmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1057/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-progpow-a-programmatic-proof-of-work/272" />
        

        <id>https://wg-eips.ritovision.com/1057/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1057"
            label="EIP-1057" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1057/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A new Proof-of-Work algorithm to replace Ethash that utilizes almost all parts of commodity GPUs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;ProgPoW is a proof-of-work algorithm designed to close the efficiency gap available to specialized ASICs. It utilizes almost all parts of commodity hardware (GPUs), and comes pre-tuned for the most common hardware utilized in the Ethereum network.&lt;&#x2F;p&gt;
&lt;p&gt;This document presents an overview of the algorithm and examines what it means to be “ASIC-resistant.” Next, we compare existing PoW designs by analyzing how each algorithm executes in hardware. Finally, we present the detailed implementation by walking through the code.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ever since the first bitcoin mining ASIC was released, many new Proof of Work algorithms have been created with the intention of being “ASIC-resistant”. The goal of “ASIC-resistance” is to resist the centralization of PoW mining power such that these coins couldn’t be so easily manipulated by a few players.&lt;&#x2F;p&gt;
&lt;p&gt;Ethereum&#x27;s approach is to incentivize a geographically-distributed community of miners with a low barrier to entry on commodity hardware.  As stated in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;11.5. Mining Proof-of-Work. The mining proof-ofwork (PoW) exists as a cryptographically secure nonce that proves beyond reasonable doubt that a particular amount of computation has been expended in the determination of some token value n. It is utilised to enforce the blockchain security by giving meaning and credence to the notion of difficulty (and, by extension, total difficulty). However, since mining new blocks comes with an attached reward, the proof-of-work not only functions as a method of securing confidence that the blockchain will remain canonical into the future, but also as a wealth distribution mechanism.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;For both reasons, there are two important goals of the proof-of-work function; firstly, it should be as accessible as possible to as many people as possible. The requirement of, or reward from, specialised and uncommon hardware should be minimised. This makes the distribution model as open as possible, and, ideally, makes the act of mining a simple swap from electricity to Ether at roughly the same rate for anyone around the world.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Secondly, it should not be possible to make super-linear profits, and especially not so with a high initial barrier. Such a mechanism allows a well-funded adversary to gain a troublesome amount of the network’s total mining power and as such gives them a super-linear reward (thus skewing distribution in their favour) as well as reducing the network security...&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;... While ASICs exist for a proof-of-work function, both goals are placed in jeopardy.  Because of this, a proof-of-work function that is ASIC-resistant (i.e. difficult or economically inefficient to implement in specialised compute hardware) has been identified as the proverbial silver bullet.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;It is from these premises that Ethash was designed as an ASIC-resistant proof-of-work:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Two directions exist for ASIC resistance; firstly make it sequential memory-hard, i.e. engineer the function such that the determination of the nonce requires a lot of memory and bandwidth such that the memory cannot be used in parallel to discover multiple nonces simultaneously. The second is to make the type of computation it would need to do general-purpose; the meaning of “specialised hardware” for a general-purpose task set is, naturally, general purpose hardware and as such commodity desktop computers are likely to be pretty close to “specialised hardware” for the task. For Ethereum 1.0 we have chosen the first path.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;5 years of experience with the Ethereum blockchain have demonstrated the success of our approach.  This success cannot be taken for granted.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;11 years of experience with PoW Blockchains have shown a centralization in hardware development, resulting in a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.asicminervalue.com&#x2F;&quot;&gt;few companies&lt;&#x2F;a&gt; controlling the lifecycle of new hardware with limited distribution.&lt;&#x2F;li&gt;
&lt;li&gt;New ASICs for Ethash are providing higher efficiency than GPUs, such as the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;shop.bitmain.com&#x2F;product&#x2F;detail?pid=00020181031134626816gh0zYNKC06A3&quot;&gt;Antminer E3&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;As much as 40% of the Ethereum network may now be secured by ASICs.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;ProgPow restores Ethash&#x27; ASIC-resistance by extending Ethash with a GPU-specific approach to the second path — making the “specialised hardware” for the PoW task commodity hardware.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;progpow-overview&quot;&gt;ProgPoW Overview&lt;&#x2F;h3&gt;
&lt;p&gt;The design goal of ProgPoW is to have the algorithm’s requirements match what is available on commodity GPUs:  If the algorithm were to be implemented on a custom ASIC there should be little opportunity for efficiency gains compared to a commodity GPU.&lt;&#x2F;p&gt;
&lt;p&gt;The main elements of the algorithm are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Changes keccak_f1600 (with 64-bit words) to keccak_f800 (with 32-bit words) to reduce impact on total power&lt;&#x2F;li&gt;
&lt;li&gt;Increases mix state.&lt;&#x2F;li&gt;
&lt;li&gt;Adds a random sequence of math in the main loop.&lt;&#x2F;li&gt;
&lt;li&gt;Adds reads from a small, low-latency cache that supports random addresses.&lt;&#x2F;li&gt;
&lt;li&gt;Increases the DRAM read from 128 bytes to 256 bytes.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The random sequence changes every &lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt; (about 2 to 12 minutes depending on the configured value).  When mining source code is generated for the random sequence and compiled on the host CPU.  The GPU will execute the compiled code where what math to perform and what mix state to use are already resolved.&lt;&#x2F;p&gt;
&lt;p&gt;While a custom ASIC to implement this algorithm is still possible, the efficiency gains available are minimal.  The majority of a commodity GPU is required to support the above elements. The only optimizations available are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Remove the graphics pipeline (displays, geometry engines, texturing, etc)&lt;&#x2F;li&gt;
&lt;li&gt;Remove floating point math&lt;&#x2F;li&gt;
&lt;li&gt;A few ISA tweaks, like instructions that exactly match the merge() function&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;These would result in minimal, roughly 1.1-1.2x, efficiency gains.  This is much less than the 2x for Ethash or 50x for Cryptonight.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale-for-pow-on-commodity-hardware&quot;&gt;Rationale for PoW on Commodity Hardware&lt;&#x2F;h3&gt;
&lt;p&gt;With the growth of large mining pools, the control of hashing power has been delegated to the top few pools to provide a steadier economic return for small miners. While some have made the argument that large centralized pools defeats the purpose of “ASIC resistance,” it’s important to note that ASIC based coins are even more centralized for several reasons.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;No natural distribution: There isn’t an economic purpose for ultra-specialized hardware outside of mining and thus no reason for most people to have it.&lt;&#x2F;li&gt;
&lt;li&gt;No reserve group: Thus, there’s no reserve pool of hardware or reserve pool of interested parties to jump in when coin price is volatile and attractive for manipulation.&lt;&#x2F;li&gt;
&lt;li&gt;High barrier to entry: Initial miners are those rich enough to invest capital and ecological resources on the unknown experiment a new coin may be. Thus, initial coin distribution through mining will be very limited causing centralized economic bias.&lt;&#x2F;li&gt;
&lt;li&gt;Delegated centralization vs implementation centralization: While pool centralization is delegated, hardware monoculture is not: only the limited buyers of this hardware can participate so there isn’t even the possibility of divesting control on short notice.&lt;&#x2F;li&gt;
&lt;li&gt;No obvious decentralization of control even with decentralized mining: Once large custom ASIC makers get into the game, designing back-doored hardware is trivial. ASIC makers have no incentive to be transparent or fair in market participation.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;While the goal of “ASIC resistance” is valuable, the entire concept of “ASIC resistance” is a bit of a fallacy.  CPUs and GPUs are themselves ASICs.  Any algorithm that can run on a commodity ASIC (a CPU or GPU) by definition can have a customized ASIC created for it with slightly less functionality. Some algorithms are intentionally made to be  “ASIC friendly” - where an ASIC implementation is drastically more efficient than the same algorithm running on general purpose hardware. The protection that this offers when the coin is unknown also makes it an attractive target for a dedicated mining ASIC company as soon as it becomes useful.&lt;&#x2F;p&gt;
&lt;p&gt;Therefore, ASIC resistance is: the efficiency difference of specialized hardware versus hardware that has a wider adoption and applicability.  A smaller efficiency difference between custom vs general hardware mean higher resistance and a better algorithm. This efficiency difference is the proper metric to use when comparing the quality of PoW algorithms.  Efficiency could mean absolute performance, performance per watt, or performance per dollar - they are all highly correlated.  If a single entity creates and controls an ASIC that is drastically more efficient, they can gain 51% of the network hashrate and possibly stage an attack.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;review-of-existing-pow-algorithms&quot;&gt;Review of Existing PoW Algorithms&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;sha256&quot;&gt;SHA256&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 1000X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The SHA algorithm is a sequence of simple math operations - additions, logical ops, and rotates.&lt;&#x2F;p&gt;
&lt;p&gt;To process a single op on a CPU or GPU requires fetching and decoding an instruction, reading data from a register file, executing the instruction, and then writing the result back to a register file.  This takes significant time and power.&lt;&#x2F;p&gt;
&lt;p&gt;A single op implemented in an ASIC takes a handful of transistors and wires.  This means every individual op takes negligible power, area, or time.  A hashing core is built by laying out the sequence of required ops.&lt;&#x2F;p&gt;
&lt;p&gt;The hashing core can execute the required sequence of ops in much less time, and using less power or area, than doing the same sequence on a CPU or GPU.  A bitcoin ASIC consists of a number of identical hashing cores and some minimal off-chip communication.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scrypt-and-neoscrypt&quot;&gt;Scrypt and NeoScrypt&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 1000X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Scrypt and NeoScrypt are similar to SHA in the arithmetic and bitwise operations used. Unfortunately, popular coins such as Litecoin only use a scratchpad size between 32kb and 128kb for their PoW mining algorithm. This scratch pad is small enough to trivially fit on an ASIC next to the math core. The implementation of the math core would be very similar to SHA, with similar efficiency gains.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;x11-and-x16r&quot;&gt;X11 and X16R&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 1000X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;X11 (and similar X##) require an ASIC that has 11 unique hashing cores pipelined in a fixed sequence.  Each individual hashing core would have similar efficiency to an individual SHA core, so the overall design will have the same efficiency gains.&lt;&#x2F;p&gt;
&lt;p&gt;X16R requires the multiple hashing cores to interact through a simple sequencing state machine. Each individual core will have similar efficiency gains and the sequencing logic will take minimal power, area, or time.&lt;&#x2F;p&gt;
&lt;p&gt;The Baikal BK-X is an existing ASIC with multiple hashing cores and a programmable sequencer.  It has been upgraded to enable new algorithms that sequence the hashes in different orders.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;equihash&quot;&gt;Equihash&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 100X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The ~150mb of state is large but possible on an ASIC. The binning, sorting, and comparing of bit strings could be implemented on an ASIC at extremely high speed.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cuckoo-cycle&quot;&gt;Cuckoo Cycle&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 100X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The amount of state required on-chip is not clear as there are Time&#x2F;Memory Tradeoff attacks. A specialized graph traversal core would have similar efficiency gains to a SHA compute core.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cryptonight&quot;&gt;CryptoNight&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 50X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compared to Scrypt, CryptoNight does much less compute and requires a full 2mb of scratch pad (there is no known Time&#x2F;Memory Tradeoff attack).  The large scratch pad will dominate the ASIC implementation and limit the number of hashing cores, limiting the absolute performance of the ASIC.  An ASIC will consist almost entirely of just on-die SRAM.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ethash&quot;&gt;Ethash&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Potential ASIC efficiency gain ~ 2X&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Ethash requires external memory due to the large size of the DAG.  However that is all that it requires - there is minimal compute that is done on the result loaded from memory.  As a result a custom ASIC could remove most of the complexity, and power, of a GPU and be just a memory interface connected to a small compute engine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;ProgPoW can be tuned using the following parameters.  The proposed settings have been tuned for a range of existing, commodity GPUs:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt;: Number of blocks before changing the random program&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_LANES&lt;&#x2F;code&gt;: The number of parallel lanes that coordinate to calculate a single hash instance&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_REGS&lt;&#x2F;code&gt;: The register file usage size&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_DAG_LOADS&lt;&#x2F;code&gt;: Number of uint32 loads from the DAG per lane&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CACHE_BYTES&lt;&#x2F;code&gt;: The size of the cache&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CNT_DAG&lt;&#x2F;code&gt;: The number of DAG accesses, defined as the outer loop of the algorithm (64 is the same as Ethash)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CNT_CACHE&lt;&#x2F;code&gt;: The number of cache accesses per loop&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PROGPOW_CNT_MATH&lt;&#x2F;code&gt;: The number of math operations per loop&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The values of these parameters have been tweaked between the original version and the version proposed here for Ethereum adoption.  See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@ifdefelse&#x2F;progpow-progress-da5bb31a651b&quot;&gt;this medium post&lt;&#x2F;a&gt; for details.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Parameter&lt;&#x2F;th&gt;&lt;th&gt;0.9.2&lt;&#x2F;th&gt;&lt;th&gt;0.9.3&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;50&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;10&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_LANES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_REGS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;32&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_DAG_LOADS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;4&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CACHE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16x1024&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;16x1024&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CNT_DAG&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;64&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CNT_CACHE&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;12&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;11&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;PROGPOW_CNT_MATH&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;20&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;18&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;DAG Parameter&lt;&#x2F;th&gt;&lt;th&gt;0.9.2&lt;&#x2F;th&gt;&lt;th&gt;0.9.3&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;ETHASH_DATASET_PARENTS&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;256&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The random program changes every &lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt; blocks (default &lt;code&gt;10&lt;&#x2F;code&gt;, roughly 2 minutes) to ensure the hardware executing the algorithm is fully programmable.  If the program only changed every DAG epoch (roughly 5 days) certain miners could have time to develop hand-optimized versions of the random sequence, giving them an undue advantage.&lt;&#x2F;p&gt;
&lt;p&gt;Sample code is written in C++, this should be kept in mind when evaluating the code in the specification.
All numerics are computed using unsigned 32 bit integers.  Any overflows are trimmed off before proceeding to the next computation.  Languages that use numerics not fixed to bit lengths (such as Python and JavaScript) or that only use signed integers (such as Java) will need to keep their languages&#x27; quirks in mind.  The extensive use of 32 bit data values aligns with modern GPUs internal data architectures.&lt;&#x2F;p&gt;
&lt;p&gt;ProgPoW uses a 32-bit variant of &lt;strong&gt;FNV1a&lt;&#x2F;strong&gt; for merging data. The existing Ethash uses a similar variant of FNV1 for merging, but FNV1a provides better distribution properties.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#fnv1a&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1000193&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;811c9dc5&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;h &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; FNV_PRIME&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ProgPow uses &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;KISS_(algorithm)&quot;&gt;KISS99&lt;&#x2F;a&gt; for random number generation. This is the simplest (fewest instruction) random generator that passes the TestU01 statistical test suite.  A more complex random number generator like Mersenne Twister can be efficiently implemented on a specialized ASIC, providing an opportunity for efficiency gains.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#kiss99&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;typedef&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; jsr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; jcong&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99_t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; KISS99 is simple, fast, and passes the TestU01 suite&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;KISS_(algorithm)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; http:&#x2F;&#x2F;www.cse.yorku.ca&#x2F;~oz&#x2F;marsaglia-rng.html&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;kiss99_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 36969&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65535&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 18000&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 65535&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; MWC &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 17&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 13&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 69069&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1234567&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;MWC&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &lt;code&gt;fill_mix&lt;&#x2F;code&gt; function populates an array of &lt;code&gt;int32&lt;&#x2F;code&gt; values used by each lane in the hash calculations.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#fill-mix&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;void&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fill_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; lane_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use FNV to expand the per-warp seed to per-lane&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Use KISS to expand the per-lane seed to fill mix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; fnv_hash &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    kiss99_t&lt;&#x2F;span&gt;&lt;span&gt; st&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lane_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    st&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;fnv_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; lane_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;st&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Like Ethash Keccak is used to seed the sequence per-nonce and to produce the final result.  The keccak-f800 variant is used as the 32-bit word size matches the native word size of modern GPUs.  The implementation is a variant of SHAKE with width=800, bitrate=576, capacity=224, output=256, and no padding.  The result of keccak is treated as a 256-bit big-endian number - that is result byte 0 is the MSB of the value.&lt;&#x2F;p&gt;
&lt;p&gt;As with Ethash the input and output of the keccak function are fixed and relatively small.  This means only a single &quot;absorb&quot; and &quot;squeeze&quot; phase are required.  For a pseudo-code implementation of the &lt;code&gt;keccak_f800_round&lt;&#x2F;code&gt; function see the &lt;code&gt;Round[b](A,RC)&lt;&#x2F;code&gt; function in the &quot;Pseudo-code description of the permutations&quot; section of the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;keccak.team&#x2F;keccak_specs_summary.html&quot;&gt;official Keccak specs&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;hash32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak_f800_progpow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak_f800 call for the single absorb pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 22&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        keccak_f800_round&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;st&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Squeeze phase for fixed 8 words of output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash32_t&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        ret&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; st&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; ret&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The inner loop uses FNV and KISS99 to generate a random sequence from the &lt;code&gt;prog_seed&lt;&#x2F;code&gt;.  This random sequence determines which mix state is accessed and what random math is performed.&lt;&#x2F;p&gt;
&lt;p&gt;Since the &lt;code&gt;prog_seed&lt;&#x2F;code&gt; changes only once per &lt;code&gt;PROGPOW_PERIOD&lt;&#x2F;code&gt; (10 blocks or about 2 minutes) it is expected that while mining &lt;code&gt;progPowLoop&lt;&#x2F;code&gt; will be evaluated on the CPU to generate source code for that period&#x27;s sequence.  The source code will be compiled on the CPU before running on the GPU.  You can see an example sequence and generated source code in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&#x2F;blob&#x2F;824cd791634204c4cc7e31f84bb76c0c84895bd3&#x2F;test&#x2F;kernel.cu&quot;&gt;kernel.cu&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#progpowinit&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;kiss99_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowInit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    kiss99_t&lt;&#x2F;span&gt;&lt;span&gt; prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;z&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;w&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jcong&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;jsr&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prog_seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Create a random sequence of mix destinations for merge() and mix sources for cache reads&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guarantees every destination merged once&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; guarantees no duplicate cache reads, which could be optimized away&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Uses Fisher-Yates shuffle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;--&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span&gt; j&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        swap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        j &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        swap&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;j&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The math operations that merges values into the mix data are ones chosen to maintain entropy.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#math&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Merge new data from b into the value in a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Assuming A has high entropy only do ops that retain entropy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; even if B is low entropy&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; (IE don&amp;#39;t do A&amp;amp;B)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    switch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 33&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 33&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; prevent rotate by 0 which is a NOP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTL32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTR32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 31&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The math operations chosen for the random math are ones that are easy to implement in CUDA and OpenCL, the two main programming languages for commodity GPUs. The &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;1.1&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;mul_hi.html&quot;&gt;mul_hi&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;2.0&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;integerMax.html&quot;&gt;min&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;1.1&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;clz.html&quot;&gt;clz&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;2.0&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;popcount.html&quot;&gt;popcount&lt;&#x2F;a&gt; functions match the corresponding OpenCL functions.  ROTL32 matches the OpenCL &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.khronos.org&#x2F;registry&#x2F;OpenCL&#x2F;sdk&#x2F;1.0&#x2F;docs&#x2F;man&#x2F;xhtml&#x2F;rotate.html&quot;&gt;rotate&lt;&#x2F;a&gt; function.  ROTR32 is rotate right, which is equivalent to &lt;code&gt;rotate(i, 32-v)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#math&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random math between two input values&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; b&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    switch&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;r &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 11&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; mul_hi&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTL32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; ROTR32&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 6&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;|&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span&gt; a &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; b&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; clz&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    case&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; popcount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;a&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; popcount&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;b&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The flow of the inner loop is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Lane &lt;code&gt;(loop % LANES)&lt;&#x2F;code&gt; is chosen as the leader for that loop iteration&lt;&#x2F;li&gt;
&lt;li&gt;The leader&#x27;s &lt;code&gt;mix[0]&lt;&#x2F;code&gt; value modulo the number of 256-byte DAG entries is used to select where to read from the full DAG&lt;&#x2F;li&gt;
&lt;li&gt;Each lane reads &lt;code&gt;DAG_LOADS&lt;&#x2F;code&gt; sequential words, using &lt;code&gt;(lane ^ loop) % LANES&lt;&#x2F;code&gt; as the starting offset within the entry.&lt;&#x2F;li&gt;
&lt;li&gt;The random sequence of math and cache accesses is performed&lt;&#x2F;li&gt;
&lt;li&gt;The DAG data read at the start of the loop is merged at the end of the loop&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;prog_seed&lt;&#x2F;code&gt; and &lt;code&gt;loop&lt;&#x2F;code&gt; come from the outer loop, corresponding to the current program seed (which is block_number&#x2F;PROGPOW_PERIOD) and the loop iteration number.  &lt;code&gt;mix&lt;&#x2F;code&gt; is the state array, initially filled by &lt;code&gt;fill_mix&lt;&#x2F;code&gt;. &lt;code&gt;dag&lt;&#x2F;code&gt; is the bytes of the Ethash DAG grouped into 32 bit unsigned ints in little-endian format.  On little-endian architectures this is just a normal int32 pointer to the existing DAG.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DAG_BYTES&lt;&#x2F;code&gt; is set to the number of bytes in the current DAG, which is generated identically to the existing Ethash algorithm.&lt;&#x2F;p&gt;
&lt;p&gt;Test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#progpowloop&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;void&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowLoop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; loop&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dag_entry holds the 256 bytes of data loaded from the DAG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag_entry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; On each loop iteration rotate which lane is the source of the DAG address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; The source lane&amp;#39;s mix[0] value is used to ensure the last loop&amp;#39;s DAG data feeds into this loop&amp;#39;s address.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; dag_addr_base is which 256-byte entry within the DAG will be accessed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span&gt; dag_addr_base &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;loop&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (&lt;&#x2F;span&gt;&lt;span&gt;DAG_BYTES &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;sizeof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Lanes access DAG_LOADS sequential words from the dag entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Shuffle which portion of the entry each lane accesses each iteration by XORing lane and loop.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; This prevents multi-chip ASICs from each storing just a portion of the DAG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        size_t&lt;&#x2F;span&gt;&lt;span&gt; dag_addr_lane &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; dag_addr_base &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;^&lt;&#x2F;span&gt;&lt;span&gt; loop&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            dag_entry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dag_addr_lane &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_DAG_LOADS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initialize the program seed and sequences&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; When mining these are evaluated on the CPU and compiled away&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_dst_cnt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_src_cnt &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    kiss99_t&lt;&#x2F;span&gt;&lt;span&gt; prog_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowInit&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    int&lt;&#x2F;span&gt;&lt;span&gt; max_i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_CNT_CACHE&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_MATH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; max_i&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_CACHE&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cached memory access&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; lanes access random 32-bit locations within the first portion of the DAG&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_src&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_src_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; dst &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_dst_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; sel &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                uint32_t&lt;&#x2F;span&gt;&lt;span&gt; offset &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_CACHE_BYTES&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;sizeof&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint32_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_MATH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Random Math&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;            &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Generate 2 unique sources&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; src_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 &amp;lt;= src1 &amp;lt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; src2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; src_rnd &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 0 &amp;lt;= src2 &amp;lt; PROGPOW_REGS - 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;src2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; src1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ++&lt;&#x2F;span&gt;&lt;span&gt;src2&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; src2 is now any reg other than src1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; sel1 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; dst  &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_dst_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;            int&lt;&#x2F;span&gt;&lt;span&gt; sel2 &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;                uint32_t&lt;&#x2F;span&gt;&lt;span&gt; data &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; math&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;src2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;                mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Consume the global load data at the very end of the loop to allow full latency hiding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Always merge into mix[0] to feed the offset calculation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_DAG_LOADS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span&gt; dst &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ?&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix_seq_dst&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mix_seq_dst_cnt&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        int&lt;&#x2F;span&gt;&lt;span&gt; sel &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; kiss99&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_rnd&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; merge&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;dst&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; dag_entry&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sel&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The flow of the overall algorithm is:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A keccak hash of the header + nonce to create a digest of 256 bits from keccak_f800 (padding is consistent with custom one in ethash)&lt;&#x2F;li&gt;
&lt;li&gt;Use first two words of digest as seed to generate initial mix data&lt;&#x2F;li&gt;
&lt;li&gt;Loop multiple times, each time hashing random loads and random math into the mix data&lt;&#x2F;li&gt;
&lt;li&gt;Hash all the mix data into a single 256-bit value&lt;&#x2F;li&gt;
&lt;li&gt;A final keccak hash using carry-over digest from initial data + mix_data final 256 bit value (padding is consistent with custom one in ethash)&lt;&#x2F;li&gt;
&lt;li&gt;When mining this final value is compared against a &lt;code&gt;hash32_t&lt;&#x2F;code&gt; target&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;cpp&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;hash32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; progPowHash&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; value is (block_number&#x2F;PROGPOW_PERIOD)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint64_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hash32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; header&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage&quot;&gt;    const&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;dag&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;          &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; gigabyte DAG located in framebuffer - the first portion gets cached&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash32_t&lt;&#x2F;span&gt;&lt;span&gt; hash_init&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    hash32_t&lt;&#x2F;span&gt;&lt;span&gt; hash_final&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Absorb phase for initial keccak pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1st fill with header data (8 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; header&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2nd fill with nonce (2 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;9&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nonce &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3rd apply padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;18&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80008081&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak(header..nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hash_init &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak_f800_progpow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; get the seed to initialize mix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        seed &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;uint64_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;hash_init&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; |&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash_init&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; initialize mix for all lanes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        fill_mix&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; execute the randomly generated inner loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_CNT_DAG&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;        progPowLoop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;prog_seed&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dag&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reduce mix data to a per-lane 32-bit digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;    uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_REGS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; mix&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Reduce all lanes to a single 256-bit digest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; FNV_OFFSET_BASIS&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; PROGPOW_LANES&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; fnv1a&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;%&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest_lane&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;l&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;  &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        Absorb phase for final keccak pass&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;        ========================================&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    *&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;        uint32_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;25&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 1st fill with hash_init (8 words)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; hash_init&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 2nd fill with digest from main loop&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 16&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; i&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;            state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; digest&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;uint32s&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;i &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 3rd apply padding&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;17&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;00000001&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;        state&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;80008081&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; keccak(header..nonce)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        hash_final &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; keccak_f800_progpow&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;	}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Compare hash final to target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    [&lt;&#x2F;span&gt;&lt;span&gt;...&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal has been software and hardware audited:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;leastauthority.com&#x2F;static&#x2F;publications&#x2F;LeastAuthority-ProgPow-Algorithm-Final-Audit-Report.pdf&quot;&gt;Least Authority — ProgPoW Software Audit PDF&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum-cat-herders&#x2F;progpow-audit&#x2F;raw&#x2F;master&#x2F;Bob%20Rao%20-%20ProgPOW%20Hardware%20Audit%20Report%20Final.pdf&quot;&gt;Bob Rao - ProgPoW Hardware Audit PDF&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Least Authority in their findings suggest a change to DAG generation --  modification of &lt;code&gt;ETHASH_DATASET_PARENTS&lt;&#x2F;code&gt; from a value of 256 to the new value of 512 -- in order to mitigate vulnerability to a &quot;Light Evaluation&quot; attack. Due to this the DAG memory file used by ProgPoW is would no longer compatible with the one used by Ethash (epoch length and size increase ratio remain the same though).&lt;&#x2F;p&gt;
&lt;p&gt;We do not recommend implementing this fix at this time. Ethash will not be exploitable for years, and it&#x27;s not clear ProgPoW will ever be exploitable.  It&#x27;s better to deploy the audited code.&lt;&#x2F;p&gt;
&lt;p&gt;After the completion of the audits a clever finding by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kik&#x2F;&quot;&gt;Kik&lt;&#x2F;a&gt; disclosed a vulnerability to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kik&#x2F;progpow-exploit&quot;&gt;bypassing ProgPoW memory hardness&lt;&#x2F;a&gt;.  The vulnerability is present in Ethash as well but is near-impossible to exploit.  In progPoW it is not possible to exploit -- it assumes the ability to create variants of the candidate block&#x27;s header hash in a fashion similar to bitcoin, which is actually not possible in Ethereum.  An attacker would need modified block headers, would need customized nodes able to accept the modified block headers, and uses extraNonce&#x2F;extraData as entropy -- which isn’t the standard.  And the required brute-force search would be difficult to accomplish in one blocktime.  And even if supported by a customized node the block propagation of such mined blocks would be immediately blocked by other peers as the header hash is invalid.&lt;&#x2F;p&gt;
&lt;p&gt;The authors have since found another vulnerability similar to Kik&#x27;s, but it adds too much overhead to be ASIC-friendly.  See Lanfranchi&#x27;s full explanation &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&#x2F;issues&#x2F;51#issuecomment-690155355&quot;&gt;here&lt;&#x2F;a&gt;.  To completely prevent such exploits we could change the condition modifying the input state of the last keccak pass from&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;header (256 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;seed for mix initiator (64 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;mix from main loop (256 bits)&lt;&#x2F;li&gt;
&lt;li&gt;no padding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;to&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;digest from initial keccak (256 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;mix from main loop (256 bits) +&lt;&#x2F;li&gt;
&lt;li&gt;padding&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;thus widening the constraint to target in keccak &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;kik&#x2F;progpow-exploit&quot;&gt;brute force keccak linear searches&lt;&#x2F;a&gt; from 64 to 256 bits.&lt;&#x2F;p&gt;
&lt;p&gt;This fix is available as a PR to the reference implementation.  Again, we do not recommend implementing this fix at this time.  Kik&#x27;s vulnerability and others like it cannot be exploited now and likely never will be.  It&#x27;s better to deploy the audited code.&lt;&#x2F;p&gt;
&lt;p&gt;Note that these vulnerabilities cannot be exploited to deny service, double spend, or otherwise damage the network.  They could at worst give their deployer an efficiency advantage over other miners.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;The random sequence generated for block 30,000 (prog_seed 3,000) can been seen in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&#x2F;blob&#x2F;824cd791634204c4cc7e31f84bb76c0c84895bd3&#x2F;test&#x2F;kernel.cu&quot;&gt;kernel.cu&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The algorithm run on block 30,000 produces the following digest and result:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Header     : 0xffeeddccbbaa9988776655443322110000112233445566778899aabbccddeeff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Nonce      : 0x123456789abcdef0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hash init  : 0xee304846ddd0a47b98179e96b60ec5ceeae2727834367e593de780e3e6d1892f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Mix seed   : 0x7ba4d0dd464830ee&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Mix hash   : 0x493c13e9807440571511b561132834bbd558dddaa3b70c09515080a6a1aff6d0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Hash final : 0x46b72b75f238bea3fcfd227e0027dc173dceaa1fb71744bd3d5e030ed2fed053&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Additional test vectors can be found &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1057&#x2F;assets&#x2F;test-vectors&#x2F;#progpowhash&quot;&gt;in the test vectors file&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Machine-readable test vectors (T.B.D)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The reference ProgPoW mining implementation is located at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&quot;&gt;the @ifdefelse ProgPOW repository&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The reference ProgPoW mining implementation located at &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ifdefelse&#x2F;ProgPOW&quot;&gt;ProgPOW&lt;&#x2F;a&gt; is a derivative of ethminer so retains the GPL license.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Hybrid Casper FFG</title>
        <published>2018-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Danny Ryan</name><uri>https://github.com/djrtwo</uri>
	</author>
	
	<author>
		<name>Chih-Cheng Liang</name><uri>https://github.com/ChihChengLiang</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1011/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/djrtwo/EIPs/issues/5" />
        

        <id>https://wg-eips.ritovision.com/1011/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:1011"
            label="EIP-1011" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1011/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Specification of the first step to transition Ethereum main net from Proof of Work (PoW) to Proof of Stake (PoS). The resulting consensus model is a PoW&#x2F;PoS hybrid.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP specifies a hybrid PoW&#x2F;PoS consensus model for Ethereum main net. Existing PoW mechanics are used for new block creation, and a novel PoS mechanism called Casper the Friendly Finality Gadget (FFG) is layered on top using a smart contract.&lt;&#x2F;p&gt;
&lt;p&gt;Through the use of Ether deposits, slashing conditions, and a modified fork choice, FFG allows the underlying PoW blockchain to be finalized.  As network security is greatly shifted from PoW to PoS, PoW block rewards are reduced.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP does not contain safety and liveness proofs or validator implementation details, but these can be found in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper FFG paper&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;VALIDATOR_GUIDE.md&quot;&gt;Validator Implementation Guide&lt;&#x2F;a&gt; respectively.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;glossary&quot;&gt;Glossary&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;epoch&lt;&#x2F;strong&gt;: The span of blocks between checkpoints. Epochs are numbered starting at the hybrid casper fork, incrementing by one at the start of each epoch.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;finality&lt;&#x2F;strong&gt;: The point at which a block has been decided upon by a client to &lt;em&gt;never&lt;&#x2F;em&gt; revert. Proof of Work does not have the concept of finality, only of further deep block confirmations.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;checkpoint&lt;&#x2F;strong&gt;: The block&#x2F;hash under consideration for finality for a given epoch. This block is the &lt;em&gt;last&lt;&#x2F;em&gt; block of the previous epoch. Rather than dealing with every block, Casper FFG only considers checkpoints for finalization. When a checkpoint is explicitly finalized, all ancestor blocks of the checkpoint are implicitly finalized.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;validator&lt;&#x2F;strong&gt;: A participant in the Casper FFG consensus that has deposited ether in the casper contract and has the responsibility to vote and finalize checkpoints.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;validator set&lt;&#x2F;strong&gt;: The set of validators in the casper contract at any given time.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;dynasty&lt;&#x2F;strong&gt;: The number of finalized checkpoints in the chain from root to the parent of a block. The dynasty is used to define when a validator starts and ends validating. The current dynasty only increments when a checkpoint is finalized as opposed to epoch numbers that increment regardless of finality.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;slash&lt;&#x2F;strong&gt;: The burning of some amount of a validator&#x27;s deposit along with an immediate logout from the validator set. Slashing occurs when a validator signs two conflicting &lt;code&gt;vote&lt;&#x2F;code&gt; messages that violate a slashing condition. For an in-depth discussion of slashing conditions, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper FFG Paper&lt;&#x2F;a&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Transitioning the Ethereum network from PoW to PoS has been on the roadmap and in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&quot;&gt;Yellow Paper&lt;&#x2F;a&gt; since the launch of the protocol. Although effective in coming to a decentralized consensus, PoW consumes an incredible amount of energy, has no economic finality, and has no effective strategy in resisting cartels. Excessive energy consumption, issues with equal access to mining hardware, mining pool centralization, and an emerging market of ASICs each provide a distinct motivation to make the transition as soon as possible.&lt;&#x2F;p&gt;
&lt;p&gt;Until recently, the proper way to make this transition was still an open area of research. In October of 2017 &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper the Friendly Finality Gadget&lt;&#x2F;a&gt; was published, solving open questions of economic finality through validator deposits and crypto-economic incentives. For a detailed discussion and proofs of &quot;accountable safety&quot; and &quot;plausible liveness&quot;, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1710.09437&quot;&gt;Casper FFG&lt;&#x2F;a&gt; paper.&lt;&#x2F;p&gt;
&lt;p&gt;The Casper FFG contract can be layered on top of any block proposal mechanism, providing finality to the underlying chain. This EIP proposes layering FFG on top of the existing PoW block proposal mechanism as a conservative step-wise approach in the transition to full PoS. The new FFG staking mechanism requires minimal changes to the protocol, allowing the Ethereum network to fully test and evaluate Casper FFG on top of PoW before moving to a validator based block proposal mechanism.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt;: 1.25e24 wei (1,250,000 ETH)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;: &lt;code&gt;2**160 - 1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NEW_BLOCK_REWARD&lt;&#x2F;code&gt;: 6e17 wei (0.6 ETH)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;code&gt;: 5.5e5 blocks (~3 months)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VOTE_BYTES&lt;&#x2F;code&gt;: &lt;code&gt;0xe9dc0614&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;INITIALIZE_EPOCH_BYTES&lt;&#x2F;code&gt;: &lt;code&gt;0x5dcffc17&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;code&gt;: amount in wei configurable by client&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;casper-contract-parameters&quot;&gt;Casper Contract Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;: 50 blocks&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WARM_UP_PERIOD&lt;&#x2F;code&gt;: 1.8e5 blocks (~1 month)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WITHDRAWAL_DELAY&lt;&#x2F;code&gt;: 1.5e4 epochs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DYNASTY_LOGOUT_DELAY&lt;&#x2F;code&gt;: 700 dynasties&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_INTEREST_FACTOR&lt;&#x2F;code&gt;: 7e-3&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_PENALTY_FACTOR&lt;&#x2F;code&gt;: 2e-7&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt;: 1.5e21 wei (1500 ETH)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;deploying-casper-contract&quot;&gt;Deploying Casper Contract&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number == HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, then when processing the block before processing any transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;set the code of &lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;set the code of &lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;set the code of &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;set balance of &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to &lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Then execute a &lt;code&gt;CALL&lt;&#x2F;code&gt; with the following parameters before executing any normal block transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 3141592&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NONCE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASPRICE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This &lt;code&gt;CALL&lt;&#x2F;code&gt; utilizes no gas and does not increment the nonce of &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;initialize-epochs&quot;&gt;Initialize Epochs&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= (HYBRID_CASPER_FORK_BLKNUM + WARM_UP_PERIOD)&lt;&#x2F;code&gt; and &lt;code&gt;block.number % EPOCH_LENGTH == 0&lt;&#x2F;code&gt;, execute a &lt;code&gt;CALL&lt;&#x2F;code&gt; with the following parameters before executing any normal block transactions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 3141592&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;NONCE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GASPRICE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: &lt;code&gt;INITIALIZE_EPOCH_BYTES&lt;&#x2F;code&gt; followed by the 32-byte encoding of &lt;code&gt;floor(block.number &#x2F; EPOCH_LENGTH)&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This &lt;code&gt;CALL&lt;&#x2F;code&gt; utilizes no gas and does not increment the nonce of &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;casper-votes&quot;&gt;Casper Votes&lt;&#x2F;h4&gt;
&lt;p&gt;A &lt;code&gt;vote&lt;&#x2F;code&gt; transaction is defined as a transaction with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: Begins with &lt;code&gt;VOTE_BYTES&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;A valid &lt;code&gt;vote&lt;&#x2F;code&gt; transaction to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; must satisfy each of the following:
&lt;ul&gt;
&lt;li&gt;Must have the following signature &lt;code&gt;(CHAIN_ID, 0, 0)&lt;&#x2F;code&gt; (ie. &lt;code&gt;r = s = 0, v = CHAIN_ID&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;Must have &lt;code&gt;value == nonce == gasprice == 0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When producing and validating a block, when handling &lt;code&gt;vote&lt;&#x2F;code&gt; transactions to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;:
&lt;ul&gt;
&lt;li&gt;Only include &quot;valid&quot; &lt;code&gt;vote&lt;&#x2F;code&gt; transactions as defined above&lt;&#x2F;li&gt;
&lt;li&gt;Place all &lt;code&gt;vote&lt;&#x2F;code&gt; transactions at the end of the block&lt;&#x2F;li&gt;
&lt;li&gt;Track cumulative gas used by votes separately from cumulative gas used by normal transactions via &lt;code&gt;vote_gas_used&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Total &lt;code&gt;vote_gas_used&lt;&#x2F;code&gt; of &lt;code&gt;vote&lt;&#x2F;code&gt; transactions cannot exceed the &lt;code&gt;block_gas_limit&lt;&#x2F;code&gt;, independent of gas used by normal block transactions&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;When applying &lt;code&gt;vote&lt;&#x2F;code&gt; transactions to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to vm state:
&lt;ul&gt;
&lt;li&gt;Set sender to &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Count gas of &lt;code&gt;vote&lt;&#x2F;code&gt; toward &lt;code&gt;vote_gas_used&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Do not count gas of &lt;code&gt;vote&lt;&#x2F;code&gt; toward the normal &lt;code&gt;gas_used&lt;&#x2F;code&gt;. For all &lt;code&gt;vote&lt;&#x2F;code&gt; transaction receipts, cumulative gas used is equal to last non-&lt;code&gt;vote&lt;&#x2F;code&gt; transaction receipt&lt;&#x2F;li&gt;
&lt;li&gt;Do not increment the nonce of &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;All unsuccessful &lt;code&gt;vote&lt;&#x2F;code&gt; transactions to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; are invalid and must not be included in the block&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;fork-choice-and-finalization&quot;&gt;Fork Choice and Finalization&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, the fork choice rule is the logic represented by the following pseudocode. Note that options &lt;code&gt;--casper-fork-choice&lt;&#x2F;code&gt; and &lt;code&gt;--exclude&lt;&#x2F;code&gt; are discussed below in &quot;Client Settings&quot;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; handle_block&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; is_new_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    set_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; --&lt;&#x2F;span&gt;&lt;span&gt;casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;fork&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;choice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span&gt; on&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        check_and_finalize_new_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; is_new_head&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; --&lt;&#x2F;span&gt;&lt;span&gt;casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;fork&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span&gt;choice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span&gt; off&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; old pure PoW chain scoring rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficuty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; current_head&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; --&lt;&#x2F;span&gt;&lt;span&gt;exclude&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; list&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; one&lt;&#x2F;span&gt;&lt;span&gt; of&lt;&#x2F;span&gt;&lt;span&gt; its&lt;&#x2F;span&gt;&lt;span&gt; descendants&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; don&amp;#39;t revert finalized blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; is&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; not&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ancestors&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt; false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; new casper chain scoring rule&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficuty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current_head&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; current_head&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;total_difficulty&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;post_state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;casper_contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; casper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;highest_justified_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NON_REVERT_MIN_DEPOSITS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; check_and_finalize_new_checkpoint&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;new_block&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    casper&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; new_block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;post_state&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;casper_contract&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; If no finalized blocks, db.last_finalized_epoch initialized to -1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    finalized_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; casper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;highest_finalized_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;NON_REVERT_MIN_DEPOSITS&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; finalized_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        finalized_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; casper&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;checkpoint_hashes&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;finalized_epoch&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ensure not trivially finalized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; finalized_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; b&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\x00&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            return&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_epoch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        db&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;last_finalized_block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; finalized_hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The new chain scoring rule queries the casper contract to find the highest justified epoch that meets the client&#x27;s minimum deposit requirement (&lt;code&gt;NON_REVERT_MIN_DEPOSITS&lt;&#x2F;code&gt;). The &lt;code&gt;10**40&lt;&#x2F;code&gt; multiplier ensures that the justified epoch takes precedence over block mining difficulty. &lt;code&gt;total_difficulty&lt;&#x2F;code&gt; only serves as a tie breaker if the two blocks in question have an equivalent &lt;code&gt;highest_justified_epoch&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note&lt;&#x2F;em&gt;: If the client has no justified checkpoints, the contract returns &lt;code&gt;highest_justified_epoch&lt;&#x2F;code&gt; as &lt;code&gt;0&lt;&#x2F;code&gt; essentially reverting the fork choice rule to pure PoW.&lt;&#x2F;p&gt;
&lt;p&gt;When assessing a new block as the chain&#x27;s head, clients must &lt;em&gt;never revert finalized blocks&lt;&#x2F;em&gt; as seen by the code commented as &quot;don&#x27;t revert finalized blocks&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;When a new block is added as the chain&#x27;s head, clients then check for a new finalized block. This is handled by the &lt;code&gt;check_and_finalized_new_checkpoint(new_block)&lt;&#x2F;code&gt; method above. If the highest finalized epoch in the casper contract is greater than the previous finalized epoch, then the client finalizes the block with the hash &lt;code&gt;casper.checkpoint_hashes(finalized_epoch)&lt;&#x2F;code&gt;, storing this block and the related epoch number in the client database as finalized.&lt;&#x2F;p&gt;
&lt;p&gt;Clients only consider checkpoints justified or finalized if deposits were greater than &lt;code&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;code&gt; &lt;em&gt;during the epoch in question&lt;&#x2F;em&gt;. This logic is encapsulated in &lt;code&gt;casper.highest_justified_epoch(NON_REVERT_MIN_DEPOSIT)&lt;&#x2F;code&gt; and &lt;code&gt;casper.highest_finalized_epoch(NON_REVERT_MIN_DEPOSIT)&lt;&#x2F;code&gt;, respectively.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;block-reward&quot;&gt;Block Reward&lt;&#x2F;h4&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;, then &lt;code&gt;block_reward&lt;&#x2F;code&gt; is defined by the following logic and utilizes the same formulas for ommer rewards but with the updated &lt;code&gt;block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 5&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 4&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    block_reward&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; NEW_BLOCK_REWARD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;validators&quot;&gt;Validators&lt;&#x2F;h4&gt;
&lt;p&gt;The mechanics and responsibilities of validators are not specified in this EIP because they rely upon network transactions to the contract at &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; rather than on protocol level implementation and changes.
See the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;VALIDATOR_GUIDE.md&quot;&gt;Validator Implementation Guide&lt;&#x2F;a&gt; for validator details.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;msg-hasher-code&quot;&gt;MSG_HASHER_CODE&lt;&#x2F;h4&gt;
&lt;p&gt;The source code for &lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt; is located &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;casper&#x2F;contracts&#x2F;msg_hash.se.py&quot;&gt;here&lt;&#x2F;a&gt;.
The source is to be migrated to Vyper LLL before the bytecode is finalized for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM init code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;purity-checker-code&quot;&gt;PURITY_CHECKER_CODE&lt;&#x2F;h4&gt;
&lt;p&gt;The source code for &lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt; is located &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;research&#x2F;blob&#x2F;master&#x2F;impurity&#x2F;check_for_impurity.se&quot;&gt;here&lt;&#x2F;a&gt;.
The source is to be migrated to Vyper LLL before the bytecode is finalized for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM init code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;casper-code&quot;&gt;CASPER_CODE&lt;&#x2F;h4&gt;
&lt;p&gt;The source code for &lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt; is located at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;casper&#x2F;contracts&#x2F;simple_casper.v.py&quot;&gt;here&lt;&#x2F;a&gt;.
The contract is to be formally verified and further tested before the bytecode is finalized for this EIP.&lt;&#x2F;p&gt;
&lt;p&gt;The EVM init code with the above specified params is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;TBD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;client-settings&quot;&gt;Client Settings&lt;&#x2F;h4&gt;
&lt;p&gt;Clients should be implemented with the following configurable settings:&lt;&#x2F;p&gt;
&lt;h5 id=&quot;enable-casper-fork-choice&quot;&gt;Enable Casper Fork Choice&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to enable&#x2F;disable the Casper Fork Choice. A suggested implementation is &lt;code&gt;--casper-fork-choice&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This setting should ship as default disabled in client versions during the initial casper fork. This setting should ship as default enabled in subsequent client versions.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;non-revert-min-deposit&quot;&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;h5&gt;
&lt;p&gt;The minimum size of total deposits that the client must observe in the FFG contract for the state of the contract to affect the client&#x27;s fork choice. A suggested implementation is &lt;code&gt;--non-revert-min-deposit WEI_VALUE&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The suggested default value that clients should ship with is at least 2e23 wei (200K ETH).&lt;&#x2F;p&gt;
&lt;p&gt;See &quot;Fork Choice&quot; more details.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;exclusion&quot;&gt;Exclusion&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to exclude a specified blockhash and all of its descendants from a client&#x27;s fork choice. A suggested implementation is &lt;code&gt;--exclude BLOCKHASHES&lt;&#x2F;code&gt;, where &lt;code&gt;BLOCK_HASHES&lt;&#x2F;code&gt; is a comma delimited list of blockhashes to exclude.&lt;&#x2F;p&gt;
&lt;p&gt;Note: this &lt;em&gt;can&lt;&#x2F;em&gt; by design override a client&#x27;s forkchoice and revert finalized blocks.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;join-fork&quot;&gt;Join Fork&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to manually join a fork specified by a blockhash. A suggested implementation is &lt;code&gt;--join-fork BLOCKHASH&lt;&#x2F;code&gt; where the client automatically sets the head to the block defined by&lt;code&gt;BLOCKHASH&lt;&#x2F;code&gt; and locally finalizes it.&lt;&#x2F;p&gt;
&lt;p&gt;Note: this &lt;em&gt;can&lt;&#x2F;em&gt; by design override a client&#x27;s forkchoice and revert finalized blocks.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;monitor-votes&quot;&gt;Monitor Votes&lt;&#x2F;h5&gt;
&lt;p&gt;The ability to monitor incoming &lt;code&gt;vote&lt;&#x2F;code&gt; transactions for slashing conditions and submit proof to the casper contract for a finder&#x27;s fee if found. A suggested implementation is &lt;code&gt;--monitor-votes&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The setting should default to disabled.&lt;&#x2F;p&gt;
&lt;p&gt;The following pseudocode defines when two &lt;code&gt;vote&lt;&#x2F;code&gt; messages violate a slashing condition. A &lt;code&gt;vote&lt;&#x2F;code&gt; message is the singular argument included in a &lt;code&gt;vote&lt;&#x2F;code&gt; transaction.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; decode_rlp_list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; [validator_index, target_hash, target_epoch, source_epoch, signature]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; RLPList&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; same_target_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; surrounds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    decoded_values_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decode_rlp_msg&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_2&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    source_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; decoded_values_1&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vote_1_surrounds_vote_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    vote_2_surrounds_vote_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; target_epoch_1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; source_epoch_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; vote_1_surrounds_vote_2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; vote_2_surrounds_vote_1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;def&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; violates_slashing_condition&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function&quot;&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; same_target_epoch&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; or&lt;&#x2F;span&gt;&lt;span&gt; surrounds&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;vote_msg_1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; vote_msg_2&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The casper contract also provides a helper method &lt;code&gt;slashable(vote_msg_1, vote_msg_2)&lt;&#x2F;code&gt; to check if two votes violate a slashing condition. Clients should use the above pseudocode in combination with &lt;code&gt;casper.slashable()&lt;&#x2F;code&gt; as a final check when deciding whether to submit a &lt;code&gt;slash&lt;&#x2F;code&gt; to the contract.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;--monitor-votes&lt;&#x2F;code&gt; setting is to be used for clients that wish to monitor vote transactions for slashing conditions. If a slashing condition is found, the client creates and sends a transaction to &lt;code&gt;slash&lt;&#x2F;code&gt; on the casper contract. The first transaction to include the slashing condition proof slashes the validator in question and sends a 4% finder&#x27;s fee to the transaction sender.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Naive PoS specifications and implementations have existed since early blockchain days, but most are vulnerable to serious attacks and do not hold up under crypto-economic analysis. Casper FFG solves problems such as &quot;Nothing at Stake&quot; and &quot;Long Range Attacks&quot; through requiring validators to post slashable deposits and through defining economic finality.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;minimize-consensus-changes&quot;&gt;Minimize Consensus Changes&lt;&#x2F;h4&gt;
&lt;p&gt;The finality gadget is designed to minimize changes across clients. For this reason, FFG is implemented within the EVM, so that the contract byte code encapsulates most of the complexity of the fork.&lt;&#x2F;p&gt;
&lt;p&gt;Most other decisions were made to minimize changes across clients. For example, it would be possible to allow &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; to mint Ether each time it paid rewards (as compared to creating the contract with &lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt;), but this would be more invasive and error-prone than relying on existing EVM mechanics.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;deploying-casper-contract-1&quot;&gt;Deploying Casper Contract&lt;&#x2F;h4&gt;
&lt;p&gt;The &lt;code&gt;MSG_HASHER_CODE&lt;&#x2F;code&gt; and &lt;code&gt;PURITY_CHECKER_CODE&lt;&#x2F;code&gt; both do not require any initialization so the EVM bytecode can simply be placed at &lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt; and &lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt;. On the other hand, the casper contract &lt;em&gt;does&lt;&#x2F;em&gt; require passing in parameters and initialization of state. This initialization would normally occur by the EVM init code interacting with the CREATE opcode. Due to the nature of this contract being deployed outside of normal block transactions and to a particular address, the EVM init code&#x2F;CREATE method requires client specific &quot;hacks&quot; to make it work. For simplicity of specifying across clients, the EVM bytecode -- &lt;code&gt;CASPER_CODE&lt;&#x2F;code&gt; -- is placed at &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; followed by an explicit &lt;code&gt;CALL&lt;&#x2F;code&gt; to a one-time &lt;code&gt;init&lt;&#x2F;code&gt; method on the casper contract. &lt;code&gt;init&lt;&#x2F;code&gt; handles all of the logic that a constructor normally would, accepting contract parameters as arguments and setting initial variable values, and can only be run &lt;em&gt;once&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt; is composed of the byte signature of the &lt;code&gt;init&lt;&#x2F;code&gt; method of the casper contract concatenated with the 32-byte encodings of the following variables in the following order:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;WITHDRAWAL_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DYNASTY_LOGOUT_DELAY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MSG_HASHER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;PURITY_CHECKER_ADDR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_INTEREST_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BASE_PENALTY_FACTOR&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The entirety of this data is provided as a bytestring -- &lt;code&gt;CASPER_INIT_DATA&lt;&#x2F;code&gt; -- to reduce the chance of encoding errors across clients, especially regarding fixed decimal types which are new in vyper and not yet supported by all clients.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;casper-contract-params&quot;&gt;Casper Contract Params&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt; is set to 50 blocks as a balance between time to finality and message overhead.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;WARM_UP_PERIOD&lt;&#x2F;code&gt; is set to 1.8e5 blocks to provide validators with an approximate 1 month period to make initial deposits before full contract functionality and voting begin. This helps prevent degenerate cases such as having very few or even just one validator in the initial dynasty. This 1 month period also gives the network time to observe on the order of how many validators will initially be participating in consensus. If for some reason there is an unexpectedly low turnout, the community might choose to delay validation and consider design alternatives.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;WITHDRAWAL_DELAY&lt;&#x2F;code&gt; is set to 15000 epochs to freeze a validator&#x27;s funds for approximately 4 months after logout. This allows for at least a 4 month window to identify and slash a validator for attempting to finalize two conflicting checkpoints. This also defines the window of time with which a client must log on to sync the network due to weak subjectivity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;DYNASTY_LOGOUT_DELAY&lt;&#x2F;code&gt; is set to 700 dynasties to prevent immediate logout in the event of an attack from being a viable strategy.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BASE_INTEREST_FACTOR&lt;&#x2F;code&gt; is set to 7e-3 such that if there are ~10M ETH in total deposits, then validators earn approximately 5% per year in ETH rewards under optimal FFG conditions.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;BASE_PENALTY_FACTOR&lt;&#x2F;code&gt; is set to 2e-7 such that if 50% of deposits go offline, then offline validators lose half of their deposits in approximately 3 weeks, at which the online portion of validators becomes a 2&#x2F;3 majority and can begin finalizing checkpoints again.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt; is set to 1500 ETH to form a natural upper bound on the total number of validators, bounding the overhead due to &lt;code&gt;vote&lt;&#x2F;code&gt; messages. Using formulas found &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@VitalikButerin&#x2F;parametrizing-casper-the-decentralization-finality-time-overhead-tradeoff-3f2011672735&quot;&gt;here&lt;&#x2F;a&gt; under &quot;From validator count to minimum staking ETH&quot;, we estimate that with 1500 ETH minimum deposit at an assumed ~10M in total deposits there will be approximately 900 validators at any given time. &lt;code&gt;vote&lt;&#x2F;code&gt;s are only sent after the first quarter of an epoch so 900 votes have to fit into 37 blocks or ~24 &lt;code&gt;vote&lt;&#x2F;code&gt;s per block. We have experimented with more dynamic models for &lt;code&gt;MIN_DEPOSIT_SIZE&lt;&#x2F;code&gt;, but these tend to introduce significant complexities and without data from a live network seem to be premature optimizations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;initialize-epochs-1&quot;&gt;Initialize Epochs&lt;&#x2F;h4&gt;
&lt;p&gt;The call to the method at &lt;code&gt;INITIALIZE_EPOCH_BYTES&lt;&#x2F;code&gt; at &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt; at the start of each epoch is a call to the &lt;code&gt;initialize_epoch&lt;&#x2F;code&gt; method in the casper contract. This method can only be called once per epoch and is guaranteed by the protocol to be called at the start block of each epoch by &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;. This method performs a number of bookkeeping tasks around incrementing variables, updating rewards, etc.&lt;&#x2F;p&gt;
&lt;p&gt;Any call to this method fails prior to the end of the &lt;code&gt;WARM_UP_PERIOD&lt;&#x2F;code&gt;. Thus the protocol does not begin executing &lt;code&gt;initialize_epoch&lt;&#x2F;code&gt; calls until &lt;code&gt;block.number &amp;gt;= HYBRID_CASPER_FORK_BLKNUM + WARM_UP_PERIOD&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuance&quot;&gt;Issuance&lt;&#x2F;h4&gt;
&lt;p&gt;A fixed amount of 1.25M ETH was chosen as &lt;code&gt;CASPER_BALANCE&lt;&#x2F;code&gt; to fund the casper contract. This gives the contract enough runway to operate for approximately 2 years (assuming ~10M ETH in validator deposits). Acting similarly to the &quot;difficulty bomb&quot;, this &quot;funding crunch&quot; forces the network to hardfork in the relative near future to further fund the contract. This future hardfork is an opportunity to upgrade the contract and transition to full PoS.&lt;&#x2F;p&gt;
&lt;p&gt;The PoW block reward is reduced from 3.0 to 0.6 ETH&#x2F;block over the course of approximately one year because the security of the chain is greatly shifted from PoW difficulty to PoS finality and because rewards are now issued to both validators and miners. Rewards are stepped down by 0.6 ETH&#x2F;block every 3 months (&lt;code&gt;REWARD_STEPDOWN_BLOCK_COUNT&lt;&#x2F;code&gt;) to provide for a conservative transition period from full PoW to hybrid PoS&#x2F;PoW. This gives validators time to become familiar with the new technology and begin logging on and also provides the network with more leeway in case of any unforeseen issues. If any major issues do arise, the Ethereum network will still have substantial PoW security to rely upon while decisions are made and&#x2F;or patches are deployed. See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;djrtwo&#x2F;bc864c0d0a275170183803814b207b9a&quot;&gt;here&lt;&#x2F;a&gt; for further analysis of the current PoW security and of the effect of PoW block reward reduction in the context of Hybrid Casper FFG.&lt;&#x2F;p&gt;
&lt;p&gt;In addition to block rewards, miners now receive an issuance reward for including successful &lt;code&gt;vote&lt;&#x2F;code&gt; transactions into the block on time. This reward is equal to 1&#x2F;8th that of the reward the validator receives for a successful &lt;code&gt;vote&lt;&#x2F;code&gt; transaction. Under optimal FFG conditions after group validator reward adjustments are made, miners receive approximately 1&#x2F;5th of the total ETH issued by the Casper contract.&lt;&#x2F;p&gt;
&lt;p&gt;Below is a table of deposit sizes with associated annual interest rate and approximate time until funding crunch:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Deposit Size&lt;&#x2F;th&gt;&lt;th&gt;Annual Validator Interest&lt;&#x2F;th&gt;&lt;th&gt;Funding Crunch&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2.5M ETH&lt;&#x2F;td&gt;&lt;td&gt;10.12%&lt;&#x2F;td&gt;&lt;td&gt;~4 years&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;10M ETH&lt;&#x2F;td&gt;&lt;td&gt;5.00%&lt;&#x2F;td&gt;&lt;td&gt;~2 years&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;20M ETH&lt;&#x2F;td&gt;&lt;td&gt;3.52%&lt;&#x2F;td&gt;&lt;td&gt;~1.4 years&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;40M ETH&lt;&#x2F;td&gt;&lt;td&gt;2.48%&lt;&#x2F;td&gt;&lt;td&gt;~1 year&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;gas-changes&quot;&gt;Gas Changes&lt;&#x2F;h4&gt;
&lt;p&gt;Normal block transactions cannot affect casper &lt;code&gt;vote&lt;&#x2F;code&gt; validation results, but casper &lt;code&gt;vote&lt;&#x2F;code&gt; validation results can affect normal block transaction execution. Due to this asymmetrical relationship, &lt;code&gt;vote&lt;&#x2F;code&gt; transactions can be processed in parallel with normal block transactions if &lt;code&gt;vote&lt;&#x2F;code&gt; transactions are placed after all normal block transactions. Because &lt;code&gt;vote&lt;&#x2F;code&gt; transactions can be processed in parallel to normal block transactions, &lt;code&gt;vote&lt;&#x2F;code&gt; transactions cost 0 gas for validators, ensuring that validators can submit votes even in highly congested or high gas-price periods.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;vote_gas_used&lt;&#x2F;code&gt; is introduced to ensure that &lt;code&gt;vote&lt;&#x2F;code&gt; transactions do not put an undue burden on block processing. The additional overhead from &lt;code&gt;vote&lt;&#x2F;code&gt; transactions is capped at the same limit as normal block transactions so that, when run in parallel, neither sets of transactions exceed the overhead defined by the &lt;code&gt;block_gas_limit&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The call to &lt;code&gt;initialize_epoch&lt;&#x2F;code&gt; at the beginning of each epoch requires 0 gas so that this protocol state transition does not take any gas allowance away from normal transactions.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;null-sender-and-account-abstraction&quot;&gt;NULL_SENDER and Account Abstraction&lt;&#x2F;h4&gt;
&lt;p&gt;This EIP implements a limited version of account abstraction for validators&#x27; &lt;code&gt;vote&lt;&#x2F;code&gt; transactions. The general design was borrowed from &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;86&#x2F;&quot;&gt;EIP-86&lt;&#x2F;a&gt;. Rather than relying upon native transaction signatures, each validator specifies a signature contract when sending their &lt;code&gt;deposit&lt;&#x2F;code&gt; to &lt;code&gt;CASPER_ADDR&lt;&#x2F;code&gt;. When casting a &lt;code&gt;vote&lt;&#x2F;code&gt;, the validator bundles and signs the parameters of their &lt;code&gt;vote&lt;&#x2F;code&gt; according to the requirements of their signature contract. The &lt;code&gt;vote&lt;&#x2F;code&gt; method of the casper contract checks the signature of the parameters against the validator&#x27;s signature contract, exiting the transaction as unsuccessful if the signature is not successfully verified.&lt;&#x2F;p&gt;
&lt;p&gt;This allows validators to customize their own signing scheme for votes. Use cases include:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;quantum-secure signature schemes&lt;&#x2F;li&gt;
&lt;li&gt;multisig wallets&lt;&#x2F;li&gt;
&lt;li&gt;threshold schemes&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For more details on validator account abstraction, see the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;casper&#x2F;blob&#x2F;master&#x2F;VALIDATOR_GUIDE.md&quot;&gt;Validator Implementation Guide&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;client-settings-1&quot;&gt;Client Settings&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;enable-casper-fork-choice-1&quot;&gt;Enable Casper Fork Choice&lt;&#x2F;h5&gt;
&lt;p&gt;Releasing client versions with the casper fork choice as initially default disabled allows for a more conservative transition to hybrid Casper FFG. Under normal operating conditions there are no disparities between the PoW fork choice and the hybrid Casper FFG fork choice. The two fork choice rules can only diverge if either 51% of miners or 51% of validators are faulty.&lt;&#x2F;p&gt;
&lt;p&gt;Validators will begin to log on, vote, and finalize the FFG contract before the majority of the network begins explicitly relying upon the new finality mechanism. Once a significant number of validators have logged on and the finality mechanism has been tested on the live network, new client software versions that change the default to enabled will be released.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;non-revert-min-deposit-1&quot;&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;h5&gt;
&lt;p&gt;&lt;code&gt;NON_REVERT_MIN_DEPOSIT&lt;&#x2F;code&gt; is defined and configurable locally by each client. Clients are in charge of deciding upon the minimum deposits (security) at which they will accept the chain as finalized. In the general case, differing values in the choice of this local constant will not create any fork inconsistencies because clients with very strict finalization requirements will revert to follow the longest PoW chain.&lt;&#x2F;p&gt;
&lt;p&gt;Arguments have been made to hardcode a value into clients or the contract, but we cannot reasonably define security required for all clients especially in the context of massive fluctuations in the value of ETH.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;exclusion-1&quot;&gt;Exclusion&lt;&#x2F;h5&gt;
&lt;p&gt;This setting is useful in coordinating minority forks in cases of majority collusion.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;join-fork-1&quot;&gt;Join Fork&lt;&#x2F;h5&gt;
&lt;p&gt;This setting is to be used by new clients that are syncing the network for the first time. Due to weak subjectivity, a blockhash should be supplied to successfully sync the network when initially starting a node.&lt;&#x2F;p&gt;
&lt;p&gt;This setting is also useful for coordinating minority forks in cases of majority collusion.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;monitor-votes-1&quot;&gt;Monitor Votes&lt;&#x2F;h5&gt;
&lt;p&gt;Monitoring the network for slashing conditions is key to Casper FFG&#x27;s &quot;accountable safety&quot; as submitting proof of nefarious activity burns a validator&#x27;s deposit.&lt;&#x2F;p&gt;
&lt;p&gt;This setting is suggested default disabled because the block producer will almost certainly frontrun anyone else submitting a &lt;code&gt;slash&lt;&#x2F;code&gt; transaction. To prevent every client on the network from submitting a &lt;code&gt;slash&lt;&#x2F;code&gt; transaction in the event of a slashing condition, this setting should only be enabled by block producers and those clients who explicitly choose to monitor votes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the state, fork choice rule, block reward, transaction validity, and gas calculations on certain transactions. Therefore, all changes should be included in a scheduled hardfork at &lt;code&gt;HYBRID_CASPER_FORK_BLKNUM&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Skinny CREATE2</title>
        <published>2018-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1014/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/1014/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:1014"
            label="EIP-1014" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1014/">&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;Adds a new opcode (&lt;code&gt;CREATE2&lt;&#x2F;code&gt;) at &lt;code&gt;0xf5&lt;&#x2F;code&gt;, which takes 4 stack arguments: endowment, memory_start, memory_length, salt. Behaves identically to &lt;code&gt;CREATE&lt;&#x2F;code&gt; (&lt;code&gt;0xf0&lt;&#x2F;code&gt;), except using &lt;code&gt;keccak256( 0xff ++ address ++ salt ++ keccak256(init_code))[12:]&lt;&#x2F;code&gt; instead of the usual sender-and-nonce-hash as the address where the contract is initialized at.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;CREATE2&lt;&#x2F;code&gt; has the same &lt;code&gt;gas&lt;&#x2F;code&gt; schema as &lt;code&gt;CREATE&lt;&#x2F;code&gt;, but also an extra &lt;code&gt;hashcost&lt;&#x2F;code&gt; of &lt;code&gt;GSHA3WORD * ceil(len(init_code) &#x2F; 32)&lt;&#x2F;code&gt;, to account for the hashing that must be performed. The &lt;code&gt;hashcost&lt;&#x2F;code&gt; is deducted at the same time as memory-expansion gas and &lt;code&gt;CreateGas&lt;&#x2F;code&gt; is deducted: &lt;em&gt;before&lt;&#x2F;em&gt; evaluation of the resulting address and the execution of &lt;code&gt;init_code&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0xff&lt;&#x2F;code&gt; is a single byte,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;address&lt;&#x2F;code&gt; is always &lt;code&gt;20&lt;&#x2F;code&gt; bytes,&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;salt&lt;&#x2F;code&gt; is always &lt;code&gt;32&lt;&#x2F;code&gt; bytes (a stack item).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The preimage for the final hashing round is thus always exactly &lt;code&gt;85&lt;&#x2F;code&gt; bytes long.&lt;&#x2F;p&gt;
&lt;p&gt;The coredev-call at 2018-08-10 decided to use the formula above.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;Allows interactions to (actually or counterfactually in channels) be made with addresses that do not exist yet on-chain but can be relied on to only possibly eventually contain code that has been created by a particular piece of init code. Important for state-channel use cases that involve counterfactual interactions with contracts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;address-formula&quot;&gt;Address formula&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;Ensures that addresses created with this scheme cannot collide with addresses created using the traditional &lt;code&gt;keccak256(rlp([sender, nonce]))&lt;&#x2F;code&gt; formula, as &lt;code&gt;0xff&lt;&#x2F;code&gt; can only be a starting byte for RLP for data many petabytes long.&lt;&#x2F;li&gt;
&lt;li&gt;Ensures that the hash preimage has a fixed size,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h4&gt;
&lt;p&gt;Since address calculation depends on hashing the &lt;code&gt;init_code&lt;&#x2F;code&gt;, it would leave clients open to DoS attacks if executions could repeatedly cause hashing of large pieces of &lt;code&gt;init_code&lt;&#x2F;code&gt;, since expansion of memory is paid for only once. This EIP uses the same cost-per-word as the &lt;code&gt;SHA3&lt;&#x2F;code&gt; opcode.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;clarifications&quot;&gt;Clarifications&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;init_code&lt;&#x2F;code&gt; is the code that, when executed, produces the runtime bytecode that will be placed into the state, and which typically is used by high level languages to implement a &#x27;constructor&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP makes collisions possible. The behaviour at collisions is specified by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;684&quot;&gt;EIP-684&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;If a contract creation is attempted, due to either a creation transaction or the &lt;code&gt;CREATE&lt;&#x2F;code&gt; (or future &lt;code&gt;CREATE2&lt;&#x2F;code&gt;) opcode, and the destination address already has either nonzero nonce, or nonempty code, then the creation throws immediately, with exactly the same behavior as would arise if the first byte in the init code were an invalid opcode. This applies retroactively starting from genesis.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Specifically, if &lt;code&gt;nonce&lt;&#x2F;code&gt; or &lt;code&gt;code&lt;&#x2F;code&gt; is nonzero, then the create-operation fails.&lt;&#x2F;p&gt;
&lt;p&gt;With &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;161&#x2F;&quot;&gt;EIP-161&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Account creation transactions and the &lt;code&gt;CREATE&lt;&#x2F;code&gt; operation SHALL, prior to the execution of the initialisation code, increment the nonce over and above its normal starting value by one&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;This means that if a contract is created in a transaction, the &lt;code&gt;nonce&lt;&#x2F;code&gt; is immediately non-zero, with the side-effect that a collision within the same transaction will always fail -- even if it&#x27;s carried out from the &lt;code&gt;init_code&lt;&#x2F;code&gt; itself.&lt;&#x2F;p&gt;
&lt;p&gt;It should also be noted that &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt; (&lt;code&gt;0xff&lt;&#x2F;code&gt;) has no immediate effect on &lt;code&gt;nonce&lt;&#x2F;code&gt; or &lt;code&gt;code&lt;&#x2F;code&gt;, thus a contract cannot be destroyed and recreated within one transaction.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;examples&quot;&gt;Examples&lt;&#x2F;h3&gt;
&lt;p&gt;Example 0&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 1&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xB928f69Bb1D91Cd65274e3c79d8986362984fDA3&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 2&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0xdeadbeef00000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x000000000000000000000000feed000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x00&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xD04116cDd17beBE565EB2422F2497E06cC1C9833&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 3&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x70f2b2914A2a4b783FaEFb75f459A580616Fcb5e&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 4&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x00000000000000000000000000000000deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x00000000000000000000000000000000000000000000000000000000cafebabe&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0xdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32006&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x60f3f640a8508fC6a86d45DF051962668E1e8AC7&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 5&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x00000000000000000000000000000000deadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x00000000000000000000000000000000000000000000000000000000cafebabe&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32012&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0x1d8bfDC5D46DC4f61D6b6115972536eBE6A8854C&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Example 6&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;address &lt;code&gt;0x0000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;salt &lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;init_code &lt;code&gt;0x&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;gas (assuming no mem expansion): &lt;code&gt;32000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;result: &lt;code&gt;0xE33C0C7F7df4809055C3ebA6c09CFe4BaF1BD9e0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Configurable On Chain Issuance</title>
        <published>2018-04-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Van de Sande</name><email>avsa@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1015/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-dynamic-block-rewards-with-governance-contract/204" />
        

        <id>https://wg-eips.ritovision.com/1015/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1015"
            label="EIP-1015" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1015/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP changes the block reward step by instead of setting it to be hard coded on the clients and to be given to the miner&#x2F;validator etherbase, it should instead go to an address decided by an on-chain contract, with hard limits on how it would be issued (six month lock-in; issuance can only decrease or be maintained, but not increase;). A decision method is suggested but not essential to the notion of this EIP. This would &lt;strong&gt;not be a generic governance solution&lt;&#x2F;strong&gt;, which is a much broader and harder topic, would &lt;strong&gt;not&lt;&#x2F;strong&gt; affect technical upgrade decisions or other hard forks, but seen as &lt;em&gt;a forum to attempt to prevent contentious hard forks&lt;&#x2F;em&gt; that can be solved with the issuance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;thesis-many-controversial-issues-boil-down-to-resources&quot;&gt;Thesis: many controversial issues boil down to resources&lt;&#x2F;h3&gt;
&lt;p&gt;These are current EIPs that are being developed or debated. They might seem unrelated but they have something in common, that they can be resolved by proper channel of funds.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;casper-and-pos&quot;&gt;Casper and PoS&lt;&#x2F;h4&gt;
&lt;p&gt;Moving to PoS has been on the roadmap since day 0 for ethereum, along with a reduction in issuance to a cost equivalent to the Validator&#x27;s cost of security (considered to be more efficient than PoW). But the exact issuance necessary for PoS has yet to be determined and is currently being researched. Casper validation will be an on chain contract and therefore it will need to be funded. It&#x27;s unlikely that a definitive final answer on how much issuance is needed for validation will be reached in the next years as new research will uncover new arguments, so it would make sense to allow some flexibility on this matter&lt;&#x2F;p&gt;
&lt;h4 id=&quot;issuance-cap-at-120-million&quot;&gt;Issuance Cap at 120 Million&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;960&quot;&gt;EIP-960&lt;&#x2F;a&gt;, Vitalik&#x27;s not so jokey april&#x27;s fool has been taken seriously. It proposes the issuance to be slowly reduced until it reaches 120 million ether. One of the main counterpoints by Vlad can be simplified by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@Vlad_Zamfir&#x2F;against-vitaliks-fixed-supply-eip-eip-960-18e182a7e5bd&quot;&gt;we don&#x27;t know enough to know what that ether can be used for&lt;&#x2F;a&gt; and Vitalik&#x27;s counterpoint is that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@VitalikButerin&#x2F;to-be-clear-im-not-necessarily-wedded-to-a-finite-supply-cap-a7aa48ab880c&quot;&gt;reducing emissions can be a way to reduce future abuse of these funds by finding a schelling point at 0&lt;&#x2F;a&gt;. Issuance has already been reduced once, from 5 ether to the current 3 ether per block. The main point of a hard cap is that a lot of people consider &lt;em&gt;not issuing&lt;&#x2F;em&gt; as having a positive contribution, that can outweigh other actions. Burning ether is also a valid issuance decision.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;asics-and-advantages-of-pow&quot;&gt;Asics and advantages of PoW&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-969&quot;&gt;EIP-960&lt;&#x2F;a&gt; proposes a change in algorithm to avoid mining being dominated by ASICS. Counter arguments by Phil Daian argue among others than &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;pdaian.com&#x2F;blog&#x2F;anti-asic-forks-considered-harmful&#x2F;&quot;&gt;resisting economies of scale is futile and there might be specific security advantages to specialized hardware&lt;&#x2F;a&gt;. One of the main arguments for PoW mining, even when it doesn&#x27;t provide security, it is useful as a fair distribution mechanism, that &lt;strong&gt;PoW allows any person with a computer, internet access and electricity to obtain currency without having to deal with government imposed currency controls&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;recovery-forks&quot;&gt;Recovery Forks&lt;&#x2F;h4&gt;
&lt;p&gt;After the Parity Multisig library self destruction, three different strategies have been attempted to recover the funds: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;5chdn&#x2F;a9bb8617cc8523a030126a3d1c60baf3&quot;&gt;a general protocol improvement to allow reviving self destructed contracts&lt;&#x2F;a&gt; (which was considered dangerous), a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;867&quot;&gt;general process to recover funds&lt;&#x2F;a&gt; and a &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;999&#x2F;&quot;&gt;specific recovery of the multisig library&lt;&#x2F;a&gt;. The latter two are finding a lot of resistance from the community, but it&#x27;s unlikely that these issues are going away soon. The affected parties have a large incentive (fluctuating at almost half a billion dollars) to keep trying, and it&#x27;s an issue that is likely to occur again in the future. If they get reimbursed, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;156&quot;&gt;there are many other special cases of ether provably burnt or stuck&lt;&#x2F;a&gt; that might deserve the same treatment. If they get shut down, they have an incentive to move forward a fork implementation: even if they are a minority chain, it&#x27;s likely they&#x27;ll recover an amount larger than 0, which is what they would otherwise, and it means the main ethereum community might lose a valuable team of developers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;other-public-goods&quot;&gt;Other Public Goods&lt;&#x2F;h4&gt;
&lt;p&gt;There are many other types of public goods that could be funded by issuance. By &lt;em&gt;Public Good&lt;&#x2F;em&gt;, I&#x27;m using a strict definition of something that brings value to everyone, both those who funded it and free-loaders, making it hard to fund it exclusively by traditional private incentives. They can be research, whole network security, &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;908&#x2F;&quot;&gt;incentivize full clients and networking&lt;&#x2F;a&gt;, fair distribution of tokens etc.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;proposed-solution&quot;&gt;Proposed Solution&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;issuance-contract&quot;&gt;Issuance Contract&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP proposes a future hard fork where block reward is not issued to miners&#x2F;validators etherbase, but instead to a single contract, that then will activate the default function (with a fixed amount of gas) and then it will forward the ether to other contracts which will finally distribute to their final destinations.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;limits-on-the-contract&quot;&gt;Limits on the contract&lt;&#x2F;h4&gt;
&lt;h5 id=&quot;it-can-only-deal-with-issuance&quot;&gt;It can only deal with issuance&lt;&#x2F;h5&gt;
&lt;p&gt;It&#x27;s not meant to be a general governance contract. The contract &lt;strong&gt;should NOT be used&lt;&#x2F;strong&gt; to decide software updates, to freeze funds, change contract balances or anything on the consensus layer other than the strict definition of &lt;em&gt;where block rewards go&lt;&#x2F;em&gt;. It should be seen as a platform to settle disputes to avoid the implementation of contentious hard forks, not as a mean to remove the power of users and developers to execute them.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;it-cannot-only-decrease-issuance-and-once-decreased-it-cannot-be-increased-again&quot;&gt;It cannot only decrease issuance, and once decreased it cannot be increased again&lt;&#x2F;h5&gt;
&lt;p&gt;In order to reduce future abuse and uncertainty, &lt;strong&gt;once issuance is reduced, it cannot be increased&lt;&#x2F;strong&gt;. To prevent a single action reducing it to 0, the reduction is limited up to a percentage per time, so if the &lt;strong&gt;decision assembly&lt;&#x2F;strong&gt; is aggressively to reduce issuance to zero, it would take a known number of years.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;results-are-locked-for-s&quot;&gt;Results are locked for s&lt;&#x2F;h5&gt;
&lt;p&gt;Whenever a new decision on either reducing the issuance or changing the target is made, the effects will have a six-month delay to it. Once a decision is made it is final, it will take place six months after that, but if it&#x27;s shortly reversed, then that change will be short lived. The rationale behind is that it allows time to anyone disagreeing with the decision to:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Sell their coins so that if a bad actor takes over they will have a reduced reward&lt;&#x2F;li&gt;
&lt;li&gt;Attempt to revert the decision as soon as possible, to reduce the duration that the change will take place&lt;&#x2F;li&gt;
&lt;li&gt;Organize to create counter measures against the decision&lt;&#x2F;li&gt;
&lt;li&gt;Implement a hard fork changing the decision contract or to remove the issuance contract altogether, as a last resort measure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h5 id=&quot;interface&quot;&gt;Interface&lt;&#x2F;h5&gt;
&lt;p&gt;It would have the following interface:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function targetContract() returns (address)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;There&#x27;s a single target contract that should ether issued to. At each new block, that contract would have the default function called so it would forward to the intended addresses.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function decisionAssembly() returns (address)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;A contract that would represent the internal governance of decisions. More on this later.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function reduceIssuance(uint)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Can only be called by &lt;strong&gt;decision assembly&lt;&#x2F;strong&gt;. The contract is allowed to reduce or maintain the issuance per block. &lt;strong&gt;Change is not executed immediately, effects only happen six months later, but once a decision is committed it is irrevocable&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function changeTargetContract(address)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Can only be called by &lt;strong&gt;decision assembly&lt;&#x2F;strong&gt;. It changes the contract that will receive the funds in the future. Only one contract can be appointed, but if the community desires to split issuance or even burn a part of it (in a non-irrevocable manner) it can be done in that contract. Change is not executed immediately, &lt;strong&gt;effects only happen six months later&lt;&#x2F;strong&gt;, but once a decision is committed it is certain, even if it&#x27;s later reverted: if a new target contract is changed after a few hours, then it still means that in six month&#x27;s time, it would issue for that contract for a few hours.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;function executeDecision(uint)&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Can be called by anyone: it executes a change to issuance amount or target that had been scheduled six months prior.&lt;&#x2F;p&gt;
&lt;h5 id=&quot;decision-assembly&quot;&gt;Decision Assembly&lt;&#x2F;h5&gt;
&lt;p&gt;A contract that has the power to decide the changes to issuance, the core of the governance of these decisions. The exact format of this governance is open to debate, but what follows is a suggestion:&lt;&#x2F;p&gt;
&lt;p&gt;The decision would be made by multiple signalling contracts, each one implemented by separate groups and representing one aspect of the community or one sort of measurement. Each signaling process would have a &lt;code&gt;int&lt;&#x2F;code&gt; bound in which they could vote and they would have their own internal process to decide that. As new governance methods are tested and debated, new signalling contracts should be added and removed. Suggested signalling contracts:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Futarchy and prediction markets based on multiple measures&lt;&#x2F;li&gt;
&lt;li&gt;Votes weighted by ether balance (optionally with multipliers if the voters were committed to locking votes)&lt;&#x2F;li&gt;
&lt;li&gt;Token votes, weighted by their own relative ether exchange rate&lt;&#x2F;li&gt;
&lt;li&gt;Votes by individual humans if a good sybil resistance, coercion mechanism is developed&lt;&#x2F;li&gt;
&lt;li&gt;Block-signalling, as a way to measure validators&#x2F;miners choices&lt;&#x2F;li&gt;
&lt;li&gt;Some sort of signalling representing developers, exchanges or other stakeholders&lt;&#x2F;li&gt;
&lt;li&gt;Any other proposed manner&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Since adding and removing signalling contracts, as well as changing their total weight would be controlled by the contract itself, it would be crucial that the first signalling contracts were a diverse set of interests, and that they were open to adding more signals as new governance is experimented as well as removing signals that stop representing the community.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;questions-to-be-debated&quot;&gt;Questions to be debated&lt;&#x2F;h3&gt;
&lt;p&gt;A lot of things are suggested in this EIP, so I would like to propose these questions to be debated:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Do we want to have dynamically changing block rewards, instead of having them be hard coded in the protocol?&lt;&#x2F;li&gt;
&lt;li&gt;If the answer above is yes, then what would be the best governance process to decide it, and what sorts of limits would we want that governance contract to have?&lt;&#x2F;li&gt;
&lt;li&gt;If the answer is a multi-signalling contract, then what sorts of signals would we want, what sort of relative weight should they have and what would be the process to add and remove them?&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Uniformity Between 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B and 0x15E55EF43efA8348dDaeAa455F16C43B64917e3c</title>
        <published>2018-04-18T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Anderson Wesley</name><uri>https://github.com/andywesley</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1010/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/andywesley/EIPs/issues/1" />
        

        <id>https://wg-eips.ritovision.com/1010/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:1010"
            label="EIP-1010" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1010/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This document proposes to improve the uniformity of ether distribution
between wallet address &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt; and
wallet address &lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt; which are
currently experiencing a significant non-uniformity.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;As of the date of this EIP, the difference in balance between
address &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt; and address
&lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt; is far from equitable
or uniform, with the former having more than 365,000 ether
more than the latter. The distribution of ether between these two
addresses must be improved in order to protect the Ethereum economy
from centralized control. This will be accomplished by transferring
100,000 ether from the former address to the latter. This is a properly
motivated improvement in keeping with the core Ethereum philosophy of
decentralization.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is necessary because the Ethereum protocol does not allow
the owner of an address which does not own an equitable amount of ether
to claim their share of ether from an address which owns a dangerously
centralized quantity. Rather than proposing an overly complicated generic
mechanism for any user to claim ether to which they believe they are
equitably entitled, this proposal will take the simple route of a one-time
transfer of 100,000 ether from &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt;
to &lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt;. This avoids duplicating
the effort of other proposals and provides a net improvement to the
Ethereum project and community.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The balance of &lt;code&gt;0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B&lt;&#x2F;code&gt; will be decreased
by 100,000 ether. The balance of &lt;code&gt;0x15E55EF43efA8348dDaeAa455F16C43B64917e3c&lt;&#x2F;code&gt;
will be increased by 100,000 ether. No net change in the amount of extant
ether will occur unless at the time of implementation the former address does not
contain sufficient ether for such a deduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The value 100,000 was chosen after careful technically sound analysis of various economic theories
developed over the past century. In spite of the fact that it is a convenient round
number, it is actually the exact output of a complex statistical process iterated to
determine the optimal distribution of ether between these addresses.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Clients that fail to implement this change will not be aware of the correct balances
for these addresses. This will create a hard fork. The implementation of this change
consistently among all clients as intended by the proposal process will be sufficient
to ensure that backwards compatibility is not a concern.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Restore Contract Code at 0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4</title>
        <published>2018-04-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/5chdn</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/999/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-999-restore-contract-code-at-0x863df6bfa4/130" />
        

        <id>https://wg-eips.ritovision.com/999/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:999"
            label="EIP-999" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/999/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This document proposes to restore the contract code of the &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt;
contract at &lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt; with a patched version.
The contract was accidentally self-destructed and renders a significant amount
of Ether inaccessible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt; contract was used by the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.parity.io&#x2F;&quot;&gt;Parity Wallet&lt;&#x2F;a&gt; to reduce gas costs for users deploying
multi-signature wallets on the Ethereum blockchain. It contained basic
functionality such as confirming or revoking multi-signature transactions for
any wallet deployed that depends on this library. The
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;issues&#x2F;6995&quot;&gt;accidental self-destruction&lt;&#x2F;a&gt;
of the library contract caused significant amounts of Ether and other assets
owned by many different parties to be inaccessible. This proposal suggests
restoring the &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt; by a
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&quot;&gt;patched&lt;&#x2F;a&gt; version to allow the
owners of the dependent multi-signature wallets regain access to their assets.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal is necessary because the Ethereum protocol does not allow the
restoration of self-destructed contracts and there is no other simple way to
enable the affected users and companies regaining access to their tokens and
Ether. In opposite to previously discussed proposals, this will not change any
EVM semantics and tries to achieve the goal of unfreezing the funds by a single
state transition as specified in the next section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The self-destructed contract code at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x863df6bfa4469f3ead0be8f9f2aae51c91a907b4#code&quot;&gt;&lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
shall be replaced with a patched version of the
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&#x2F;blob&#x2F;master&#x2F;contracts&#x2F;walletLibrary.sol&quot;&gt;&lt;code&gt;walletLibrary.sol&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
as reviewed, tested, and approved in
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&quot;&gt;parity-contracts&#x2F;0x863df6bfa4&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;object&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;606060405234156200000d57fe5b5b6000808054806001018281620000259190620002d9565b916000526020600020900160005b6000909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506200012081805480602002602001604051908101604052809291908181526020018280548015620000fd57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311620000b2575b505050505060016000620001286401000000000262001d46176401000000009004565b5b5062000330565b600060015411156200013a5760006000fd5b6200015981620001806401000000000262001d71176401000000009004565b620001798383620001c26401000000000262001d9c176401000000009004565b5b5b505050565b60006001541115620001925760006000fd5b80600281905550620001b7620002c16401000000000262001bcf176401000000009004565b6004819055505b5b50565b600060006001541115620001d65760006000fd5b600082111515620001e75760006000fd5b81835110151515620001f95760006000fd5b8251600181905550600090505b8251811015620002b35782818151811015156200021f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff16600582600101610100811015156200025357fe5b0160005b508190555080600101610105600085848151811015156200027457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b80600101905062000206565b816000819055505b5b505050565b60006201518042811515620002d257fe5b0490505b90565b815481835581811511620003035781836000526020600020918201910162000302919062000308565b5b505050565b6200032d91905b80821115620003295760008160009055506001016200030f565b5090565b90565b611ebf80620003406000396000f300606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063173825d91461016d5780632f54bf6e146101a35780634123cb6b146101f157806352375093146102175780635c52c2f51461023d578063659010e71461024f5780637065cb4814610275578063746c9171146102ab578063797af627146102d1578063b20d30a91461030d578063b61d27f61461032d578063b75c7dc61461039c578063ba51a6df146103c0578063c2cf7326146103e0578063c41a360a1461043b578063f00d4b5d1461049b578063f1736d86146104f0575b61016b5b6000341115610168577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b565b005b341561017557fe5b6101a1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610516565b005b34156101ab57fe5b6101d7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610659565b604051808215151515815260200191505060405180910390f35b34156101f957fe5b610201610691565b6040518082815260200191505060405180910390f35b341561021f57fe5b610227610697565b6040518082815260200191505060405180910390f35b341561024557fe5b61024d61069d565b005b341561025757fe5b61025f6106d7565b6040518082815260200191505060405180910390f35b341561027d57fe5b6102a9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106dd565b005b34156102b357fe5b6102bb610829565b6040518082815260200191505060405180910390f35b34156102d957fe5b6102f360048080356000191690602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561031557fe5b61032b6004808035906020019091905050610dcc565b005b341561033557fe5b61037e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190820180359060200191909192905050610e06565b60405180826000191660001916815260200191505060405180910390f35b34156103a457fe5b6103be60048080356000191690602001909190505061127d565b005b34156103c857fe5b6103de6004808035906020019091905050611392565b005b34156103e857fe5b61042160048080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061141a565b604051808215151515815260200191505060405180910390f35b341561044357fe5b610459600480803590602001909190505061149c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a357fe5b6104ee600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114bf565b005b34156104f857fe5b610500611672565b6040518082815260200191505060405180910390f35b600060003660405180838380828437820191505092505050604051809103902061053f81611678565b156106535761010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561057f57610652565b600160015403600054111561059357610652565b6000600583610100811015156105a557fe5b0160005b5081905550600061010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105e6611890565b6105ee6119d0565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da83604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b505050565b6000600061010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541190505b919050565b60015481565b60045481565b6000366040518083838082843782019150509250505060405180910390206106c481611678565b156106d35760006003819055505b5b5b50565b60035481565b60003660405180838380828437820191505092505050604051809103902061070481611678565b156108245761071282610659565b1561071c57610823565b610724611890565b60fa600154101515610739576107386119d0565b5b60fa60015410151561074a57610823565b6001600081548092919060010191905055508173ffffffffffffffffffffffffffffffffffffffff1660056001546101008110151561078557fe5b0160005b508190555060015461010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c382604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b5050565b60005481565b600060008261083d81611678565b15610dc45760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415806108c757506000610108600086600019166000191681526020019081526020016000206001015414155b80610906575060006101086000866000191660001916815260200190815260200160002060020180546001816001161561010002031660029004905014155b15610dc25760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a5057610a496101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a3f5780601f10610a1457610100808354040283529160200191610a3f565b820191906000526020600020905b815481529060010190602001808311610a2257829003601f168201915b5050505050611b37565b9150610b71565b6101086000856000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002016040518082805460018160011615610100020316600290048015610b4a5780601f10610b1f57610100808354040283529160200191610b4a565b820191906000526020600020905b815481529060010190602001808311610b2d57829003601f168201915b505091505060006040518083038185876185025a03f1925050501515610b705760006000fd5b5b7fe3a3a4111a84df27d76b68dc721e65c7711605ea5eee4afd3a9c58195217365c338561010860008860001916600019168152602001908152602001600020600101546101086000896000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661010860008a6000191660001916815260200190815260200160002060020187604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015610d475780601f10610d1c57610100808354040283529160200191610d47565b820191906000526020600020905b815481529060010190602001808311610d2a57829003601f168201915b505097505050505050505060405180910390a16101086000856000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055600282016000610db79190611be6565b505060019250610dc3565b5b5b5b5050919050565b600036604051808383808284378201915050925050506040518091039020610df381611678565b15610e0157816002819055505b5b5b5050565b60006000610e1333610659565b1561127357600084849050148015610e305750610e2f85611b51565b5b80610e3d57506001600054145b15610fed5760008673ffffffffffffffffffffffffffffffffffffffff161415610ea457610e9d8585858080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050611b37565b9050610ef3565b8573ffffffffffffffffffffffffffffffffffffffff168585856040518083838082843782019150509250505060006040518083038185876185025a03f1925050501515610ef25760006000fd5b5b7f9738cd1a8777c86b011f7b01d87d484217dc6ab5154a9d41eda5d14af8caf292338688878786604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252858582818152602001925080828437820191505097505050505050505060405180910390a1611271565b6000364360405180848480828437820191505082815260200193505050506040518091039020915060006101086000846000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015611099575060006101086000846000191660001916815260200190815260200160002060010154145b80156110d85750600061010860008460001916600019168152602001908152602001600020600201805460018160011615610100020316600290049050145b1561118f57856101086000846000191660001916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846101086000846000191660001916815260200190815260200160002060010181905550838361010860008560001916600019168152602001908152602001600020600201919061118d929190611c2e565b505b6111988261082f565b1515611270577f1733cbb53659d713b79580f79f3f9ff215f78a7c7aa45890f3b89fc5cddfbf328233878988886040518087600019166000191681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437820191505097505050505050505060405180910390a15b5b5b5b5b50949350505050565b60006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156112be5761138c565b8260020a9150610106600085600019166000191681526020019081526020016000209050600082826001015416111561138b5780600001600081548092919060010191905055508181600101600082825403925050819055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3385604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a15b5b50505050565b6000366040518083838082843782019150509250505060405180910390206113b981611678565b15611415576001548211156113cd57611414565b816000819055506113dc611890565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da826040518082815260200191505060405180910390a15b5b5b5050565b600060006000600061010660008760001916600019168152602001908152602001600020925061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561147f5760009350611493565b8160020a9050600081846001015416141593505b50505092915050565b6000600560018301610100811015156114b157fe5b0160005b505490505b919050565b60006000366040518083838082843782019150509250505060405180910390206114e881611678565b1561166b576114f683610659565b156115005761166a565b61010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561153b5761166a565b611543611890565b8273ffffffffffffffffffffffffffffffffffffffff166005836101008110151561156a57fe5b0160005b5081905550600061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508161010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15b5b5b50505050565b60025481565b600060006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156116bb57611888565b6101066000866000191660001916815260200190815260200160002091506000826000015414156117455760005482600001819055506000826001018190555061010780548091906001016117109190611cae565b826002018190555084610107836002015481548110151561172d57fe5b906000526020600020900160005b5081600019169055505b8260020a90506000818360010154161415611887577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3386604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a16001826000015411151561185e57610107610106600087600019166000191681526020019081526020016000206002015481548110151561180a57fe5b906000526020600020900160005b5060009055610106600086600019166000191681526020019081526020016000206000600082016000905560018201600090556002820160009055505060019350611888565b8160000160008154809291906001900391905055508082600101600082825417925050819055505b5b5b505050919050565b60006000610107805490509150600090505b818110156119bc576101086000610107838154811015156118bf57fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006119269190611be6565b505060006001026101078281548110151561193d57fe5b906000526020600020900160005b5054600019161415156119b05761010660006101078381548110151561196d57fe5b906000526020600020900160005b505460001916600019168152602001908152602001600020600060008201600090556001820160009055600282016000905550505b5b8060010190506118a2565b61010760006119cb9190611cda565b5b5050565b6000600190505b600154811015611b33575b60015481108015611a095750600060058261010081101515611a0057fe5b0160005b505414155b15611a1b5780806001019150506119e2565b5b6001600154118015611a4557506000600560015461010081101515611a3d57fe5b0160005b5054145b15611a625760016000815480929190600190039190505550611a1c565b60015481108015611a8b57506000600560015461010081101515611a8257fe5b0160005b505414155b8015611aac5750600060058261010081101515611aa457fe5b0160005b5054145b15611b2e57600560015461010081101515611ac357fe5b0160005b505460058261010081101515611ad957fe5b0160005b508190555080610105600060058461010081101515611af857fe5b0160005b50548152602001908152602001600020819055506000600560015461010081101515611b2457fe5b0160005b50819055505b6119d7565b5b50565b600081516020830184f09050803b15610000575b92915050565b6000611b5c33610659565b15611bc957600454611b6c611bcf565b1115611b89576000600381905550611b82611bcf565b6004819055505b600354826003540110158015611ba55750600254826003540111155b15611bc3578160036000828254019250508190555060019050611bc8565b600090505b5b5b919050565b60006201518042811515611bdf57fe5b0490505b90565b50805460018160011615610100020316600290046000825580601f10611c0c5750611c2b565b601f016020900490600052602060002090810190611c2a9190611cfc565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c6f57803560ff1916838001178555611c9d565b82800160010185558215611c9d579182015b82811115611c9c578235825591602001919060010190611c81565b5b509050611caa9190611cfc565b5090565b815481835581811511611cd557818360005260206000209182019101611cd49190611d21565b5b505050565b5080546000825590600052602060002090810190611cf89190611d21565b5b50565b611d1e91905b80821115611d1a576000816000905550600101611d02565b5090565b90565b611d4391905b80821115611d3f576000816000905550600101611d27565b5090565b90565b60006001541115611d575760006000fd5b611d6081611d71565b611d6a8383611d9c565b5b5b505050565b60006001541115611d825760006000fd5b80600281905550611d91611bcf565b6004819055505b5b50565b600060006001541115611daf5760006000fd5b600082111515611dbf5760006000fd5b81835110151515611dd05760006000fd5b8251600181905550600090505b8251811015611e85578281815181101515611df457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1660058260010161010081101515611e2757fe5b0160005b50819055508060010161010560008584815181101515611e4757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b806001019050611ddd565b816000819055505b5b5050505600a165627a7a7230582016889f0740f073d397f9d00b0d19900fb050b957e3e2942f861085beb9baab180029&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;opcodes&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;PUSH1 0x60 PUSH1 0x40 MSTORE CALLVALUE ISZERO PUSH3 0xD JUMPI INVALID JUMPDEST JUMPDEST PUSH1 0x0 DUP1 DUP1 SLOAD DUP1 PUSH1 0x1 ADD DUP3 DUP2 PUSH3 0x25 SWAP2 SWAP1 PUSH3 0x2D9 JUMP JUMPDEST SWAP2 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST PUSH1 0x0 SWAP1 SWAP2 SWAP1 SWAP2 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP POP PUSH3 0x120 DUP2 DUP1 SLOAD DUP1 PUSH1 0x20 MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD DUP1 ISZERO PUSH3 0xFD JUMPI PUSH1 0x20 MUL DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 PUSH1 0x1 ADD SWAP1 DUP1 DUP4 GT PUSH3 0xB2 JUMPI JUMPDEST POP POP POP POP POP PUSH1 0x1 PUSH1 0x0 PUSH3 0x128 PUSH5 0x100000000 MUL PUSH3 0x1D46 OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST JUMPDEST POP PUSH3 0x330 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH3 0x13A JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH3 0x159 DUP2 PUSH3 0x180 PUSH5 0x100000000 MUL PUSH3 0x1D71 OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST PUSH3 0x179 DUP4 DUP4 PUSH3 0x1C2 PUSH5 0x100000000 MUL PUSH3 0x1D9C OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH3 0x192 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP1 PUSH1 0x2 DUP2 SWAP1 SSTORE POP PUSH3 0x1B7 PUSH3 0x2C1 PUSH5 0x100000000 MUL PUSH3 0x1BCF OR PUSH5 0x100000000 SWAP1 DIV JUMP JUMPDEST PUSH1 0x4 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH3 0x1D6 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP3 GT ISZERO ISZERO PUSH3 0x1E7 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP2 DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH3 0x1F9 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP3 MLOAD DUP2 LT ISZERO PUSH3 0x2B3 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x21F JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 DUP3 PUSH1 0x1 ADD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH3 0x253 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x1 ADD PUSH2 0x105 PUSH1 0x0 DUP6 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH3 0x274 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP JUMPDEST DUP1 PUSH1 0x1 ADD SWAP1 POP PUSH3 0x206 JUMP JUMPDEST DUP2 PUSH1 0x0 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x15180 TIMESTAMP DUP2 ISZERO ISZERO PUSH3 0x2D2 JUMPI INVALID JUMPDEST DIV SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 ISZERO GT PUSH3 0x303 JUMPI DUP2 DUP4 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP2 DUP3 ADD SWAP2 ADD PUSH3 0x302 SWAP2 SWAP1 PUSH3 0x308 JUMP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH3 0x32D SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH3 0x329 JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH3 0x30F JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x1EBF DUP1 PUSH3 0x340 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN STOP PUSH1 0x60 PUSH1 0x40 MSTORE CALLDATASIZE ISZERO PUSH2 0xEF JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV PUSH4 0xFFFFFFFF AND DUP1 PUSH4 0x173825D9 EQ PUSH2 0x16D JUMPI DUP1 PUSH4 0x2F54BF6E EQ PUSH2 0x1A3 JUMPI DUP1 PUSH4 0x4123CB6B EQ PUSH2 0x1F1 JUMPI DUP1 PUSH4 0x52375093 EQ PUSH2 0x217 JUMPI DUP1 PUSH4 0x5C52C2F5 EQ PUSH2 0x23D JUMPI DUP1 PUSH4 0x659010E7 EQ PUSH2 0x24F JUMPI DUP1 PUSH4 0x7065CB48 EQ PUSH2 0x275 JUMPI DUP1 PUSH4 0x746C9171 EQ PUSH2 0x2AB JUMPI DUP1 PUSH4 0x797AF627 EQ PUSH2 0x2D1 JUMPI DUP1 PUSH4 0xB20D30A9 EQ PUSH2 0x30D JUMPI DUP1 PUSH4 0xB61D27F6 EQ PUSH2 0x32D JUMPI DUP1 PUSH4 0xB75C7DC6 EQ PUSH2 0x39C JUMPI DUP1 PUSH4 0xBA51A6DF EQ PUSH2 0x3C0 JUMPI DUP1 PUSH4 0xC2CF7326 EQ PUSH2 0x3E0 JUMPI DUP1 PUSH4 0xC41A360A EQ PUSH2 0x43B JUMPI DUP1 PUSH4 0xF00D4B5D EQ PUSH2 0x49B JUMPI DUP1 PUSH4 0xF1736D86 EQ PUSH2 0x4F0 JUMPI JUMPDEST PUSH2 0x16B JUMPDEST PUSH1 0x0 CALLVALUE GT ISZERO PUSH2 0x168 JUMPI PUSH32 0xE1FFFCC4923D04B559F4D29A8BFC6CDA04EB5B0D3C460751C2402C5C5CC9109C CALLER CALLVALUE PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x175 JUMPI INVALID JUMPDEST PUSH2 0x1A1 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x516 JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x1AB JUMPI INVALID JUMPDEST PUSH2 0x1D7 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x659 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x1F9 JUMPI INVALID JUMPDEST PUSH2 0x201 PUSH2 0x691 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x21F JUMPI INVALID JUMPDEST PUSH2 0x227 PUSH2 0x697 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x245 JUMPI INVALID JUMPDEST PUSH2 0x24D PUSH2 0x69D JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x257 JUMPI INVALID JUMPDEST PUSH2 0x25F PUSH2 0x6D7 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x27D JUMPI INVALID JUMPDEST PUSH2 0x2A9 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x6DD JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x2B3 JUMPI INVALID JUMPDEST PUSH2 0x2BB PUSH2 0x829 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x2D9 JUMPI INVALID JUMPDEST PUSH2 0x2F3 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH1 0x0 NOT AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x82F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x315 JUMPI INVALID JUMPDEST PUSH2 0x32B PUSH1 0x4 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0xDCC JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x335 JUMPI INVALID JUMPDEST PUSH2 0x37E PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 DUP3 ADD DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 SWAP1 SWAP2 SWAP3 SWAP1 POP POP PUSH2 0xE06 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x3A4 JUMPI INVALID JUMPDEST PUSH2 0x3BE PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH1 0x0 NOT AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x127D JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x3C8 JUMPI INVALID JUMPDEST PUSH2 0x3DE PUSH1 0x4 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x1392 JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x3E8 JUMPI INVALID JUMPDEST PUSH2 0x421 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH1 0x0 NOT AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x141A JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 ISZERO ISZERO ISZERO ISZERO DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x443 JUMPI INVALID JUMPDEST PUSH2 0x459 PUSH1 0x4 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x149C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST CALLVALUE ISZERO PUSH2 0x4A3 JUMPI INVALID JUMPDEST PUSH2 0x4EE PUSH1 0x4 DUP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 DUP1 CALLDATALOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x20 ADD SWAP1 SWAP2 SWAP1 POP POP PUSH2 0x14BF JUMP JUMPDEST STOP JUMPDEST CALLVALUE ISZERO PUSH2 0x4F8 JUMPI INVALID JUMPDEST PUSH2 0x500 PUSH2 0x1672 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x53F DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x653 JUMPI PUSH2 0x105 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0x57F JUMPI PUSH2 0x652 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 SLOAD SUB PUSH1 0x0 SLOAD GT ISZERO PUSH2 0x593 JUMPI PUSH2 0x652 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x5 DUP4 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x5A5 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH2 0x5E6 PUSH2 0x1890 JUMP JUMPDEST PUSH2 0x5EE PUSH2 0x19D0 JUMP JUMPDEST PUSH32 0x58619076ADF5BB0943D100EF88D52D7C3FD691B19D3A9071B555B651FBF418DA DUP4 PUSH1 0x40 MLOAD DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD GT SWAP1 POP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x4 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x6C4 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x6D3 JUMPI PUSH1 0x0 PUSH1 0x3 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x3 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x704 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x824 JUMPI PUSH2 0x712 DUP3 PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x71C JUMPI PUSH2 0x823 JUMP JUMPDEST PUSH2 0x724 PUSH2 0x1890 JUMP JUMPDEST PUSH1 0xFA PUSH1 0x1 SLOAD LT ISZERO ISZERO PUSH2 0x739 JUMPI PUSH2 0x738 PUSH2 0x19D0 JUMP JUMPDEST JUMPDEST PUSH1 0xFA PUSH1 0x1 SLOAD LT ISZERO ISZERO PUSH2 0x74A JUMPI PUSH2 0x823 JUMP JUMPDEST PUSH1 0x1 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 ADD SWAP2 SWAP1 POP SSTORE POP DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x785 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP PUSH1 0x1 SLOAD PUSH2 0x105 PUSH1 0x0 DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH32 0x994A936646FE87FFE4F1E469D3D6AA417D6B855598397F323DE5B449F765F0C3 DUP3 PUSH1 0x40 MLOAD DUP1 DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 DUP3 PUSH2 0x83D DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0xDC4 JUMPI PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO DUP1 PUSH2 0x8C7 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD EQ ISZERO JUMPDEST DUP1 PUSH2 0x906 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 POP EQ ISZERO JUMPDEST ISZERO PUSH2 0xDC2 JUMPI PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0xA50 JUMPI PUSH2 0xA49 PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD PUSH2 0x108 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 ISZERO PUSH2 0xA3F JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xA14 JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xA3F JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xA22 JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP POP POP POP PUSH2 0x1B37 JUMP JUMPDEST SWAP2 POP PUSH2 0xB71 JUMP JUMPDEST PUSH2 0x108 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x108 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD PUSH2 0x108 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD PUSH1 0x40 MLOAD DUP1 DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 ISZERO PUSH2 0xB4A JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xB1F JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xB4A JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xB2D JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP SWAP2 POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 PUSH2 0x8502 GAS SUB CALL SWAP3 POP POP POP ISZERO ISZERO PUSH2 0xB70 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST JUMPDEST PUSH32 0xE3A3A4111A84DF27D76B68DC721E65C7711605EA5EEE4AFD3A9C58195217365C CALLER DUP6 PUSH2 0x108 PUSH1 0x0 DUP9 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD PUSH2 0x108 PUSH1 0x0 DUP10 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH2 0x108 PUSH1 0x0 DUP11 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP8 PUSH1 0x40 MLOAD DUP1 DUP8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 DUP2 MSTORE PUSH1 0x20 ADD DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP2 DUP2 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV DUP1 ISZERO PUSH2 0xD47 JUMPI DUP1 PUSH1 0x1F LT PUSH2 0xD1C JUMPI PUSH2 0x100 DUP1 DUP4 SLOAD DIV MUL DUP4 MSTORE SWAP2 PUSH1 0x20 ADD SWAP2 PUSH2 0xD47 JUMP JUMPDEST DUP3 ADD SWAP2 SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 JUMPDEST DUP2 SLOAD DUP2 MSTORE SWAP1 PUSH1 0x1 ADD SWAP1 PUSH1 0x20 ADD DUP1 DUP4 GT PUSH2 0xD2A JUMPI DUP3 SWAP1 SUB PUSH1 0x1F AND DUP3 ADD SWAP2 JUMPDEST POP POP SWAP8 POP POP POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH2 0x108 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 PUSH2 0xDB7 SWAP2 SWAP1 PUSH2 0x1BE6 JUMP JUMPDEST POP POP PUSH1 0x1 SWAP3 POP PUSH2 0xDC3 JUMP JUMPDEST JUMPDEST JUMPDEST JUMPDEST POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0xDF3 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0xE01 JUMPI DUP2 PUSH1 0x2 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH2 0xE13 CALLER PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x1273 JUMPI PUSH1 0x0 DUP5 DUP5 SWAP1 POP EQ DUP1 ISZERO PUSH2 0xE30 JUMPI POP PUSH2 0xE2F DUP6 PUSH2 0x1B51 JUMP JUMPDEST JUMPDEST DUP1 PUSH2 0xE3D JUMPI POP PUSH1 0x1 PUSH1 0x0 SLOAD EQ JUMPDEST ISZERO PUSH2 0xFED JUMPI PUSH1 0x0 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ ISZERO PUSH2 0xEA4 JUMPI PUSH2 0xE9D DUP6 DUP6 DUP6 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP POP POP POP POP PUSH2 0x1B37 JUMP JUMPDEST SWAP1 POP PUSH2 0xEF3 JUMP JUMPDEST DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP6 DUP6 DUP6 PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 DUP8 PUSH2 0x8502 GAS SUB CALL SWAP3 POP POP POP ISZERO ISZERO PUSH2 0xEF2 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST JUMPDEST PUSH32 0x9738CD1A8777C86B011F7B01D87D484217DC6AB5154A9D41EDA5D14AF8CAF292 CALLER DUP7 DUP9 DUP8 DUP8 DUP7 PUSH1 0x40 MLOAD DUP1 DUP8 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP7 DUP2 MSTORE PUSH1 0x20 ADD DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP6 DUP6 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP8 POP POP POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH2 0x1271 JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE NUMBER PUSH1 0x40 MLOAD DUP1 DUP5 DUP5 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP4 POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 SWAP2 POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 SWAP1 SLOAD SWAP1 PUSH2 0x100 EXP SWAP1 DIV PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND EQ DUP1 ISZERO PUSH2 0x1099 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD SLOAD EQ JUMPDEST DUP1 ISZERO PUSH2 0x10D8 JUMPI POP PUSH1 0x0 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 POP EQ JUMPDEST ISZERO PUSH2 0x118F JUMPI DUP6 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD DUP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND MUL OR SWAP1 SSTORE POP DUP5 PUSH2 0x108 PUSH1 0x0 DUP5 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x1 ADD DUP2 SWAP1 SSTORE POP DUP4 DUP4 PUSH2 0x108 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD SWAP2 SWAP1 PUSH2 0x118D SWAP3 SWAP2 SWAP1 PUSH2 0x1C2E JUMP JUMPDEST POP JUMPDEST PUSH2 0x1198 DUP3 PUSH2 0x82F JUMP JUMPDEST ISZERO ISZERO PUSH2 0x1270 JUMPI PUSH32 0x1733CBB53659D713B79580F79F3F9FF215F78A7C7AA45890F3B89FC5CDDFBF32 DUP3 CALLER DUP8 DUP10 DUP9 DUP9 PUSH1 0x40 MLOAD DUP1 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP6 DUP2 MSTORE PUSH1 0x20 ADD DUP5 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP1 PUSH1 0x20 ADD DUP3 DUP2 SUB DUP3 MSTORE DUP5 DUP5 DUP3 DUP2 DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP8 POP POP POP POP POP POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST JUMPDEST JUMPDEST POP SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP3 POP PUSH1 0x0 DUP4 EQ ISZERO PUSH2 0x12BE JUMPI PUSH2 0x138C JUMP JUMPDEST DUP3 PUSH1 0x2 EXP SWAP2 POP PUSH2 0x106 PUSH1 0x0 DUP6 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SWAP1 POP PUSH1 0x0 DUP3 DUP3 PUSH1 0x1 ADD SLOAD AND GT ISZERO PUSH2 0x138B JUMPI DUP1 PUSH1 0x0 ADD PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 ADD SWAP2 SWAP1 POP SSTORE POP DUP2 DUP2 PUSH1 0x1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD SUB SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH32 0xC7FB647E59B18047309AA15AAD418E5D7CA96D173AD704F1031A2C3D7591734B CALLER DUP6 PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x13B9 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x1415 JUMPI PUSH1 0x1 SLOAD DUP3 GT ISZERO PUSH2 0x13CD JUMPI PUSH2 0x1414 JUMP JUMPDEST DUP2 PUSH1 0x0 DUP2 SWAP1 SSTORE POP PUSH2 0x13DC PUSH2 0x1890 JUMP JUMPDEST PUSH32 0xACBDB084C721332AC59F9B8E392196C9EB0E4932862DA8EB9BEAF0DAD4F550DA DUP3 PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH2 0x106 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SWAP3 POP PUSH2 0x105 PUSH1 0x0 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0x147F JUMPI PUSH1 0x0 SWAP4 POP PUSH2 0x1493 JUMP JUMPDEST DUP2 PUSH1 0x2 EXP SWAP1 POP PUSH1 0x0 DUP2 DUP5 PUSH1 0x1 ADD SLOAD AND EQ ISZERO SWAP4 POP JUMPDEST POP POP POP SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 DUP4 ADD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x14B1 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD SWAP1 POP JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 CALLDATASIZE PUSH1 0x40 MLOAD DUP1 DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY DUP3 ADD SWAP2 POP POP SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 SHA3 PUSH2 0x14E8 DUP2 PUSH2 0x1678 JUMP JUMPDEST ISZERO PUSH2 0x166B JUMPI PUSH2 0x14F6 DUP4 PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x1500 JUMPI PUSH2 0x166A JUMP JUMPDEST PUSH2 0x105 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP2 POP PUSH1 0x0 DUP3 EQ ISZERO PUSH2 0x153B JUMPI PUSH2 0x166A JUMP JUMPDEST PUSH2 0x1543 PUSH2 0x1890 JUMP JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 DUP4 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x156A JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 DUP7 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP DUP2 PUSH2 0x105 PUSH1 0x0 DUP6 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH32 0xB532073B38C83145E3E5135377A08BF9AAB55BC0FD7C1179CD4FB995D2A5159C DUP5 DUP5 PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 JUMPDEST JUMPDEST JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x2 SLOAD DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH1 0x0 PUSH2 0x105 PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SLOAD SWAP3 POP PUSH1 0x0 DUP4 EQ ISZERO PUSH2 0x16BB JUMPI PUSH2 0x1888 JUMP JUMPDEST PUSH2 0x106 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 SWAP2 POP PUSH1 0x0 DUP3 PUSH1 0x0 ADD SLOAD EQ ISZERO PUSH2 0x1745 JUMPI PUSH1 0x0 SLOAD DUP3 PUSH1 0x0 ADD DUP2 SWAP1 SSTORE POP PUSH1 0x0 DUP3 PUSH1 0x1 ADD DUP2 SWAP1 SSTORE POP PUSH2 0x107 DUP1 SLOAD DUP1 SWAP2 SWAP1 PUSH1 0x1 ADD PUSH2 0x1710 SWAP2 SWAP1 PUSH2 0x1CAE JUMP JUMPDEST DUP3 PUSH1 0x2 ADD DUP2 SWAP1 SSTORE POP DUP5 PUSH2 0x107 DUP4 PUSH1 0x2 ADD SLOAD DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x172D JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP DUP2 PUSH1 0x0 NOT AND SWAP1 SSTORE POP JUMPDEST DUP3 PUSH1 0x2 EXP SWAP1 POP PUSH1 0x0 DUP2 DUP4 PUSH1 0x1 ADD SLOAD AND EQ ISZERO PUSH2 0x1887 JUMPI PUSH32 0xE1C52DC63B719ADE82E8BEA94CC41A0D5D28E4AAF536ADB5E9CCCC9FF8C1AEDA CALLER DUP7 PUSH1 0x40 MLOAD DUP1 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD DUP3 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 LOG1 PUSH1 0x1 DUP3 PUSH1 0x0 ADD SLOAD GT ISZERO ISZERO PUSH2 0x185E JUMPI PUSH2 0x107 PUSH2 0x106 PUSH1 0x0 DUP8 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x2 ADD SLOAD DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x180A JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP PUSH1 0x0 SWAP1 SSTORE PUSH2 0x106 PUSH1 0x0 DUP7 PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE POP POP PUSH1 0x1 SWAP4 POP PUSH2 0x1888 JUMP JUMPDEST DUP2 PUSH1 0x0 ADD PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 SWAP1 SUB SWAP2 SWAP1 POP SSTORE POP DUP1 DUP3 PUSH1 0x1 ADD PUSH1 0x0 DUP3 DUP3 SLOAD OR SWAP3 POP POP DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST JUMPDEST POP POP POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH2 0x107 DUP1 SLOAD SWAP1 POP SWAP2 POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP2 DUP2 LT ISZERO PUSH2 0x19BC JUMPI PUSH2 0x108 PUSH1 0x0 PUSH2 0x107 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x18BF JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 PUSH2 0x100 EXP DUP2 SLOAD SWAP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF MUL NOT AND SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 PUSH2 0x1926 SWAP2 SWAP1 PUSH2 0x1BE6 JUMP JUMPDEST POP POP PUSH1 0x0 PUSH1 0x1 MUL PUSH2 0x107 DUP3 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x193D JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x0 NOT AND EQ ISZERO ISZERO PUSH2 0x19B0 JUMPI PUSH2 0x106 PUSH1 0x0 PUSH2 0x107 DUP4 DUP2 SLOAD DUP2 LT ISZERO ISZERO PUSH2 0x196D JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x0 NOT AND PUSH1 0x0 NOT AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 PUSH1 0x0 PUSH1 0x0 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x1 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE PUSH1 0x2 DUP3 ADD PUSH1 0x0 SWAP1 SSTORE POP POP JUMPDEST JUMPDEST DUP1 PUSH1 0x1 ADD SWAP1 POP PUSH2 0x18A2 JUMP JUMPDEST PUSH2 0x107 PUSH1 0x0 PUSH2 0x19CB SWAP2 SWAP1 PUSH2 0x1CDA JUMP JUMPDEST JUMPDEST POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SWAP1 POP JUMPDEST PUSH1 0x1 SLOAD DUP2 LT ISZERO PUSH2 0x1B33 JUMPI JUMPDEST PUSH1 0x1 SLOAD DUP2 LT DUP1 ISZERO PUSH2 0x1A09 JUMPI POP PUSH1 0x0 PUSH1 0x5 DUP3 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1A00 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ ISZERO JUMPDEST ISZERO PUSH2 0x1A1B JUMPI DUP1 DUP1 PUSH1 0x1 ADD SWAP2 POP POP PUSH2 0x19E2 JUMP JUMPDEST JUMPDEST PUSH1 0x1 PUSH1 0x1 SLOAD GT DUP1 ISZERO PUSH2 0x1A45 JUMPI POP PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1A3D JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ JUMPDEST ISZERO PUSH2 0x1A62 JUMPI PUSH1 0x1 PUSH1 0x0 DUP2 SLOAD DUP1 SWAP3 SWAP2 SWAP1 PUSH1 0x1 SWAP1 SUB SWAP2 SWAP1 POP SSTORE POP PUSH2 0x1A1C JUMP JUMPDEST PUSH1 0x1 SLOAD DUP2 LT DUP1 ISZERO PUSH2 0x1A8B JUMPI POP PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1A82 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ ISZERO JUMPDEST DUP1 ISZERO PUSH2 0x1AAC JUMPI POP PUSH1 0x0 PUSH1 0x5 DUP3 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AA4 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD EQ JUMPDEST ISZERO PUSH2 0x1B2E JUMPI PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AC3 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD PUSH1 0x5 DUP3 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AD9 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP DUP1 PUSH2 0x105 PUSH1 0x0 PUSH1 0x5 DUP5 PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1AF8 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP SLOAD DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP PUSH1 0x0 PUSH1 0x5 PUSH1 0x1 SLOAD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1B24 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP JUMPDEST PUSH2 0x19D7 JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD PUSH1 0x20 DUP4 ADD DUP5 CREATE SWAP1 POP DUP1 EXTCODESIZE ISZERO PUSH2 0x0 JUMPI JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x1B5C CALLER PUSH2 0x659 JUMP JUMPDEST ISZERO PUSH2 0x1BC9 JUMPI PUSH1 0x4 SLOAD PUSH2 0x1B6C PUSH2 0x1BCF JUMP JUMPDEST GT ISZERO PUSH2 0x1B89 JUMPI PUSH1 0x0 PUSH1 0x3 DUP2 SWAP1 SSTORE POP PUSH2 0x1B82 PUSH2 0x1BCF JUMP JUMPDEST PUSH1 0x4 DUP2 SWAP1 SSTORE POP JUMPDEST PUSH1 0x3 SLOAD DUP3 PUSH1 0x3 SLOAD ADD LT ISZERO DUP1 ISZERO PUSH2 0x1BA5 JUMPI POP PUSH1 0x2 SLOAD DUP3 PUSH1 0x3 SLOAD ADD GT ISZERO JUMPDEST ISZERO PUSH2 0x1BC3 JUMPI DUP2 PUSH1 0x3 PUSH1 0x0 DUP3 DUP3 SLOAD ADD SWAP3 POP POP DUP2 SWAP1 SSTORE POP PUSH1 0x1 SWAP1 POP PUSH2 0x1BC8 JUMP JUMPDEST PUSH1 0x0 SWAP1 POP JUMPDEST JUMPDEST JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH3 0x15180 TIMESTAMP DUP2 ISZERO ISZERO PUSH2 0x1BDF JUMPI INVALID JUMPDEST DIV SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST POP DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV PUSH1 0x0 DUP3 SSTORE DUP1 PUSH1 0x1F LT PUSH2 0x1C0C JUMPI POP PUSH2 0x1C2B JUMP JUMPDEST PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1C2A SWAP2 SWAP1 PUSH2 0x1CFC JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x1C6F JUMPI DUP1 CALLDATALOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x1C9D JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x1C9D JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x1C9C JUMPI DUP3 CALLDATALOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x1C81 JUMP JUMPDEST JUMPDEST POP SWAP1 POP PUSH2 0x1CAA SWAP2 SWAP1 PUSH2 0x1CFC JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST DUP2 SLOAD DUP2 DUP4 SSTORE DUP2 DUP2 ISZERO GT PUSH2 0x1CD5 JUMPI DUP2 DUP4 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP2 DUP3 ADD SWAP2 ADD PUSH2 0x1CD4 SWAP2 SWAP1 PUSH2 0x1D21 JUMP JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST POP DUP1 SLOAD PUSH1 0x0 DUP3 SSTORE SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 SHA3 SWAP1 DUP2 ADD SWAP1 PUSH2 0x1CF8 SWAP2 SWAP1 PUSH2 0x1D21 JUMP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH2 0x1D1E SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x1D1A JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH2 0x1D02 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x1D43 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x1D3F JUMPI PUSH1 0x0 DUP2 PUSH1 0x0 SWAP1 SSTORE POP PUSH1 0x1 ADD PUSH2 0x1D27 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH2 0x1D57 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH2 0x1D60 DUP2 PUSH2 0x1D71 JUMP JUMPDEST PUSH2 0x1D6A DUP4 DUP4 PUSH2 0x1D9C JUMP JUMPDEST JUMPDEST JUMPDEST POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH2 0x1D82 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP1 PUSH1 0x2 DUP2 SWAP1 SSTORE POP PUSH2 0x1D91 PUSH2 0x1BCF JUMP JUMPDEST PUSH1 0x4 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x0 PUSH1 0x1 SLOAD GT ISZERO PUSH2 0x1DAF JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST PUSH1 0x0 DUP3 GT ISZERO ISZERO PUSH2 0x1DBF JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP2 DUP4 MLOAD LT ISZERO ISZERO ISZERO PUSH2 0x1DD0 JUMPI PUSH1 0x0 PUSH1 0x0 REVERT JUMPDEST DUP3 MLOAD PUSH1 0x1 DUP2 SWAP1 SSTORE POP PUSH1 0x0 SWAP1 POP JUMPDEST DUP3 MLOAD DUP2 LT ISZERO PUSH2 0x1E85 JUMPI DUP3 DUP2 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1DF4 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x5 DUP3 PUSH1 0x1 ADD PUSH2 0x100 DUP2 LT ISZERO ISZERO PUSH2 0x1E27 JUMPI INVALID JUMPDEST ADD PUSH1 0x0 JUMPDEST POP DUP2 SWAP1 SSTORE POP DUP1 PUSH1 0x1 ADD PUSH2 0x105 PUSH1 0x0 DUP6 DUP5 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x1E47 JUMPI INVALID JUMPDEST SWAP1 PUSH1 0x20 ADD SWAP1 PUSH1 0x20 MUL ADD MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x0 SHA3 DUP2 SWAP1 SSTORE POP JUMPDEST DUP1 PUSH1 0x1 ADD SWAP1 POP PUSH2 0x1DDD JUMP JUMPDEST DUP2 PUSH1 0x0 DUP2 SWAP1 SSTORE POP JUMPDEST JUMPDEST POP POP POP JUMP STOP LOG1 PUSH6 0x627A7A723058 SHA3 AND DUP9 SWAP16 SMOD BLOCKHASH CREATE PUSH20 0xD397F9D00B0D19900FB050B957E3E2942F861085 0xbe 0xb9 0xba 0xab XOR STOP 0x29 &lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sourceMap&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;2715:10853:0:-;;;3523:112;;;;;;;3552:18;3574:8;:27;;;;;;;;;;;:::i;:::-;;;;;;;;;;;3596:3;3574:27;;;;;;;;;;;;;;;;;;;;;;;3605:26;3616:8;3605:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3626:1;3629;3605:10;;;;;:26;;;:::i;:::-;3523:112;;2715:10853;;7697:168;7585:1;7571:11;;:15;7567:26;;;7588:5;;;7567:26;7800:23;7813:9;7800:12;;;;;:23;;;:::i;:::-;7827:34;7842:7;7851:9;7827:14;;;;;:34;;;:::i;:::-;7595:1;7697:168;;;;:::o;6966:115::-;7585:1;7571:11;;:15;7567:26;;;7588:5;;;7567:26;7048:6;7033:12;:21;;;;7070:7;:5;;;;;:7;;;:::i;:::-;7058:9;:19;;;;7595:1;6966:115;;:::o;3977:349::-;4171:6;7585:1;7571:11;;:15;7567:26;;;7588:5;;;7567:26;4088:1;4076:9;:13;4068:22;;;;;;;;4120:9;4102:7;:14;:27;;4094:36;;;;;;;;4148:7;:14;4134:11;:28;;;;4180:1;4171:10;;4166:131;4187:7;:14;4183:1;:18;4166:131;;;4238:7;4246:1;4238:10;;;;;;;;;;;;;;;;;;4233:16;;4215:8;4228:1;4224;:5;4215:15;;;;;;;;;;;;:34;;;;;4291:1;4287;:5;4254:12;:30;4272:7;4280:1;4272:10;;;;;;;;;;;;;;;;;;4267:16;;4254:30;;;;;;;;;;;:38;;;;4166:131;4203:3;;;;;4166:131;;;4313:9;4300:10;:22;;;;7595:1;3977:349;;;;:::o;12529:73::-;12572:4;12593:6;12587:3;:12;;;;;;;;12580:19;;12529:73;;:::o;2715:10853::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;	&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;linkReferences&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;To verify the byte-code above, a patched version is deployed at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;etherscan.io&#x2F;address&#x2F;0x21C9E434c669c4d73f55215A6F2130A185E127AC#code&quot;&gt;&lt;code&gt;0x21C9E434c669c4d73f55215A6F2130A185E127AC&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
to be reviewed. The compiler settings used can be extracted from the following
meta-data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compiler&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0.4.10+commit.f0d539ae&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;language&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Solidity&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;output&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;abi&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;removeOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;isOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_numOwners&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_lastDay&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;resetSpentToday&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_spentToday&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;addOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_required&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;confirm&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o_success&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_newLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;setDailyLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;execute&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;o_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;revoke&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_newRequired&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;changeRequirement&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;hasConfirmed&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ownerIndex&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;getOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;changeOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;constant&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;m_dailyLimit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;outputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;constructor&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;payable&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;true&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;fallback&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Confirmation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Revoke&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oldOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OwnerChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OwnerAdded&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;oldOwner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;OwnerRemoved&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;newRequirement&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;RequirementChanged&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;_from&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;Deposit&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;created&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;SingleTransact&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;created&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;MultiTransact&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;anonymous&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;inputs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;operation&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;initiator&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;value&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;uint256&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;to&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;address&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;indexed&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;data&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;name&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;ConfirmationNeeded&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;event&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;devdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;userdoc&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;methods&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;settings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;compilationTarget&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;browser&#x2F;WalletLibrary.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;WalletLibrary&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;libraries&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;optimizer&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;enabled&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;false&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;runs&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;200&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;remappings&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;sources&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;browser&#x2F;WalletLibrary.sol&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;keccak256&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0xf72fcdc85e15f93172878ca6a61fb81604d1052e9e724bc3896d65b3b4ab1bb0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;urls&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;bzzr:&#x2F;&#x2F;009bd59bd78f59804eaffb6111d341caea58888f8e5b5f75aebdf009fc6136c0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;version&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The differences to the originally deployed contract code can be reviewed at:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&#x2F;pull&#x2F;2&quot;&gt;parity-contracts&#x2F;0x863df6bfa4#2&lt;&#x2F;a&gt;:
Remove the &lt;code&gt;selfdestruct()&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;parity-contracts&#x2F;0x863df6bfa4&#x2F;pull&#x2F;3&quot;&gt;parity-contracts&#x2F;0x863df6bfa4#3&lt;&#x2F;a&gt;:
Initialize the library owner to &lt;code&gt;0x0&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The following sections propose two equivalent specifications, 999a and 999b,
which technically achieve the same results. To implement this proposal only one
of them has to be applied.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;direct-state-transition-via-bytecode-999a&quot;&gt;Direct State Transition via Bytecode (999a)&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt;, directly recreate the account
&lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt; with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Nonce: &lt;code&gt;0x1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Code:&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x606060405236156100ef576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063173825d91461016d5780632f54bf6e146101a35780634123cb6b146101f157806352375093146102175780635c52c2f51461023d578063659010e71461024f5780637065cb4814610275578063746c9171146102ab578063797af627146102d1578063b20d30a91461030d578063b61d27f61461032d578063b75c7dc61461039c578063ba51a6df146103c0578063c2cf7326146103e0578063c41a360a1461043b578063f00d4b5d1461049b578063f1736d86146104f0575b61016b5b6000341115610168577fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c3334604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5b565b005b341561017557fe5b6101a1600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610516565b005b34156101ab57fe5b6101d7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610659565b604051808215151515815260200191505060405180910390f35b34156101f957fe5b610201610691565b6040518082815260200191505060405180910390f35b341561021f57fe5b610227610697565b6040518082815260200191505060405180910390f35b341561024557fe5b61024d61069d565b005b341561025757fe5b61025f6106d7565b6040518082815260200191505060405180910390f35b341561027d57fe5b6102a9600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106dd565b005b34156102b357fe5b6102bb610829565b6040518082815260200191505060405180910390f35b34156102d957fe5b6102f360048080356000191690602001909190505061082f565b604051808215151515815260200191505060405180910390f35b341561031557fe5b61032b6004808035906020019091905050610dcc565b005b341561033557fe5b61037e600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190820180359060200191909192905050610e06565b60405180826000191660001916815260200191505060405180910390f35b34156103a457fe5b6103be60048080356000191690602001909190505061127d565b005b34156103c857fe5b6103de6004808035906020019091905050611392565b005b34156103e857fe5b61042160048080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061141a565b604051808215151515815260200191505060405180910390f35b341561044357fe5b610459600480803590602001909190505061149c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104a357fe5b6104ee600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506114bf565b005b34156104f857fe5b610500611672565b6040518082815260200191505060405180910390f35b600060003660405180838380828437820191505092505050604051809103902061053f81611678565b156106535761010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561057f57610652565b600160015403600054111561059357610652565b6000600583610100811015156105a557fe5b0160005b5081905550600061010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105e6611890565b6105ee6119d0565b7f58619076adf5bb0943d100ef88d52d7c3fd691b19d3a9071b555b651fbf418da83604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b505050565b6000600061010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541190505b919050565b60015481565b60045481565b6000366040518083838082843782019150509250505060405180910390206106c481611678565b156106d35760006003819055505b5b5b50565b60035481565b60003660405180838380828437820191505092505050604051809103902061070481611678565b156108245761071282610659565b1561071c57610823565b610724611890565b60fa600154101515610739576107386119d0565b5b60fa60015410151561074a57610823565b6001600081548092919060010191905055508173ffffffffffffffffffffffffffffffffffffffff1660056001546101008110151561078557fe5b0160005b508190555060015461010560008473ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f994a936646fe87ffe4f1e469d3d6aa417d6b855598397f323de5b449f765f0c382604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15b5b5b5050565b60005481565b600060008261083d81611678565b15610dc45760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415806108c757506000610108600086600019166000191681526020019081526020016000206001015414155b80610906575060006101086000866000191660001916815260200190815260200160002060020180546001816001161561010002031660029004905014155b15610dc25760006101086000866000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610a5057610a496101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a3f5780601f10610a1457610100808354040283529160200191610a3f565b820191906000526020600020905b815481529060010190602001808311610a2257829003601f168201915b5050505050611b37565b9150610b71565b6101086000856000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166101086000866000191660001916815260200190815260200160002060010154610108600087600019166000191681526020019081526020016000206002016040518082805460018160011615610100020316600290048015610b4a5780601f10610b1f57610100808354040283529160200191610b4a565b820191906000526020600020905b815481529060010190602001808311610b2d57829003601f168201915b505091505060006040518083038185876185025a03f1925050501515610b705760006000fd5b5b7fe3a3a4111a84df27d76b68dc721e65c7711605ea5eee4afd3a9c58195217365c338561010860008860001916600019168152602001908152602001600020600101546101086000896000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661010860008a6000191660001916815260200190815260200160002060020187604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200186600019166000191681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828103825284818154600181600116156101000203166002900481526020019150805460018160011615610100020316600290048015610d475780601f10610d1c57610100808354040283529160200191610d47565b820191906000526020600020905b815481529060010190602001808311610d2a57829003601f168201915b505097505050505050505060405180910390a16101086000856000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690556001820160009055600282016000610db79190611be6565b505060019250610dc3565b5b5b5b5050919050565b600036604051808383808284378201915050925050506040518091039020610df381611678565b15610e0157816002819055505b5b5b5050565b60006000610e1333610659565b1561127357600084849050148015610e305750610e2f85611b51565b5b80610e3d57506001600054145b15610fed5760008673ffffffffffffffffffffffffffffffffffffffff161415610ea457610e9d8585858080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050611b37565b9050610ef3565b8573ffffffffffffffffffffffffffffffffffffffff168585856040518083838082843782019150509250505060006040518083038185876185025a03f1925050501515610ef25760006000fd5b5b7f9738cd1a8777c86b011f7b01d87d484217dc6ab5154a9d41eda5d14af8caf292338688878786604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281038252858582818152602001925080828437820191505097505050505050505060405180910390a1611271565b6000364360405180848480828437820191505082815260200193505050506040518091039020915060006101086000846000191660001916815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015611099575060006101086000846000191660001916815260200190815260200160002060010154145b80156110d85750600061010860008460001916600019168152602001908152602001600020600201805460018160011615610100020316600290049050145b1561118f57856101086000846000191660001916815260200190815260200160002060000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550846101086000846000191660001916815260200190815260200160002060010181905550838361010860008560001916600019168152602001908152602001600020600201919061118d929190611c2e565b505b6111988261082f565b1515611270577f1733cbb53659d713b79580f79f3f9ff215f78a7c7aa45890f3b89fc5cddfbf328233878988886040518087600019166000191681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018281038252848482818152602001925080828437820191505097505050505050505060405180910390a15b5b5b5b5b50949350505050565b60006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156112be5761138c565b8260020a9150610106600085600019166000191681526020019081526020016000209050600082826001015416111561138b5780600001600081548092919060010191905055508181600101600082825403925050819055507fc7fb647e59b18047309aa15aad418e5d7ca96d173ad704f1031a2c3d7591734b3385604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a15b5b50505050565b6000366040518083838082843782019150509250505060405180910390206113b981611678565b15611415576001548211156113cd57611414565b816000819055506113dc611890565b7facbdb084c721332ac59f9b8e392196c9eb0e4932862da8eb9beaf0dad4f550da826040518082815260200191505060405180910390a15b5b5b5050565b600060006000600061010660008760001916600019168152602001908152602001600020925061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561147f5760009350611493565b8160020a9050600081846001015416141593505b50505092915050565b6000600560018301610100811015156114b157fe5b0160005b505490505b919050565b60006000366040518083838082843782019150509250505060405180910390206114e881611678565b1561166b576114f683610659565b156115005761166a565b61010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600082141561153b5761166a565b611543611890565b8273ffffffffffffffffffffffffffffffffffffffff166005836101008110151561156a57fe5b0160005b5081905550600061010560008673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508161010560008573ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c8484604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15b5b5b50505050565b60025481565b600060006000600061010560003373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054925060008314156116bb57611888565b6101066000866000191660001916815260200190815260200160002091506000826000015414156117455760005482600001819055506000826001018190555061010780548091906001016117109190611cae565b826002018190555084610107836002015481548110151561172d57fe5b906000526020600020900160005b5081600019169055505b8260020a90506000818360010154161415611887577fe1c52dc63b719ade82e8bea94cc41a0d5d28e4aaf536adb5e9cccc9ff8c1aeda3386604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182600019166000191681526020019250505060405180910390a16001826000015411151561185e57610107610106600087600019166000191681526020019081526020016000206002015481548110151561180a57fe5b906000526020600020900160005b5060009055610106600086600019166000191681526020019081526020016000206000600082016000905560018201600090556002820160009055505060019350611888565b8160000160008154809291906001900391905055508082600101600082825417925050819055505b5b5b505050919050565b60006000610107805490509150600090505b818110156119bc576101086000610107838154811015156118bf57fe5b906000526020600020900160005b50546000191660001916815260200190815260200160002060006000820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160006119269190611be6565b505060006001026101078281548110151561193d57fe5b906000526020600020900160005b5054600019161415156119b05761010660006101078381548110151561196d57fe5b906000526020600020900160005b505460001916600019168152602001908152602001600020600060008201600090556001820160009055600282016000905550505b5b8060010190506118a2565b61010760006119cb9190611cda565b5b5050565b6000600190505b600154811015611b33575b60015481108015611a095750600060058261010081101515611a0057fe5b0160005b505414155b15611a1b5780806001019150506119e2565b5b6001600154118015611a4557506000600560015461010081101515611a3d57fe5b0160005b5054145b15611a625760016000815480929190600190039190505550611a1c565b60015481108015611a8b57506000600560015461010081101515611a8257fe5b0160005b505414155b8015611aac5750600060058261010081101515611aa457fe5b0160005b5054145b15611b2e57600560015461010081101515611ac357fe5b0160005b505460058261010081101515611ad957fe5b0160005b508190555080610105600060058461010081101515611af857fe5b0160005b50548152602001908152602001600020819055506000600560015461010081101515611b2457fe5b0160005b50819055505b6119d7565b5b50565b600081516020830184f09050803b15610000575b92915050565b6000611b5c33610659565b15611bc957600454611b6c611bcf565b1115611b89576000600381905550611b82611bcf565b6004819055505b600354826003540110158015611ba55750600254826003540111155b15611bc3578160036000828254019250508190555060019050611bc8565b600090505b5b5b919050565b60006201518042811515611bdf57fe5b0490505b90565b50805460018160011615610100020316600290046000825580601f10611c0c5750611c2b565b601f016020900490600052602060002090810190611c2a9190611cfc565b5b50565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c6f57803560ff1916838001178555611c9d565b82800160010185558215611c9d579182015b82811115611c9c578235825591602001919060010190611c81565b5b509050611caa9190611cfc565b5090565b815481835581811511611cd557818360005260206000209182019101611cd49190611d21565b5b505050565b5080546000825590600052602060002090810190611cf89190611d21565b5b50565b611d1e91905b80821115611d1a576000816000905550600101611d02565b5090565b90565b611d4391905b80821115611d3f576000816000905550600101611d27565b5090565b90565b60006001541115611d575760006000fd5b611d6081611d71565b611d6a8383611d9c565b5b5b505050565b60006001541115611d825760006000fd5b80600281905550611d91611bcf565b6004819055505b5b50565b600060006001541115611daf5760006000fd5b600082111515611dbf5760006000fd5b81835110151515611dd05760006000fd5b8251600181905550600090505b8251811015611e85578281815181101515611df457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1660058260010161010081101515611e2757fe5b0160005b50819055508060010161010560008584815181101515611e4757fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b806001019050611ddd565b816000819055505b5b5050505600a165627a7a7230582084feb3505964efa62a6ffa78d913a175fe7bc168dd50067d25b1d5ddb6d10a1e0029&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;ul&gt;
&lt;li&gt;Storage:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;code&gt;:
&lt;code&gt;0x00000000000000000000000000000000000000000000000000000000000044e1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0xa5baec7d73105a3c7298203bb205bbc41b63fa384ae73a6016b890a7ca29ae2d&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The balance of the account shall be left unchanged.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alternate-specification-via-codehash-999b&quot;&gt;Alternate Specification via Codehash (999b)&lt;&#x2F;h3&gt;
&lt;p&gt;At &lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt;, directly recreate the account
&lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt; with the following parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Nonce: &lt;code&gt;0x1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Storage:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000004&lt;&#x2F;code&gt;:
&lt;code&gt;0x00000000000000000000000000000000000000000000000000000000000044e1&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0xa5baec7d73105a3c7298203bb205bbc41b63fa384ae73a6016b890a7ca29ae2d&lt;&#x2F;code&gt;:
&lt;code&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In addition, the codehash at that address shall be replaced by the codehash at
address &lt;code&gt;0x21C9E434c669c4d73f55215A6F2130A185E127AC&lt;&#x2F;code&gt;. The codehash is
&lt;code&gt;0x6209d55547da7b035d54ef8d73275e863d3072b91da6ace1614fa6381f4e2c09&lt;&#x2F;code&gt;. The
balance of the account shall be left unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The design decision to restore the &lt;code&gt;WalletLibrary&lt;&#x2F;code&gt; contract code in a single
state transition was made after lengthy discussions of
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;5chdn&#x2F;a9bb8617cc8523a030126a3d1c60baf3&quot;&gt;alternate proposals&lt;&#x2F;a&gt;
that explored different ways to improve the Ethereum protocol to allow contract
revivals by adding different built-in contracts. It was eventually concluded
that all of these proposals changing the EVM semantics around self-destructed
contracts were introducing unwanted side-effects and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@weka&#x2F;on-paritys-proposed-changes-to-selfdestruct-behaviour-c3f0e5bc0f49&quot;&gt;potential risks&lt;&#x2F;a&gt;
to the existing smart-contract ecosystem on the Ethereum platform.&lt;&#x2F;p&gt;
&lt;p&gt;The total supply of Ether is neither changed nor does this proposal require the
transfer of any tokens or assets including Ether. It is assumed that this change
is aligned with the interests both of (A) Parity Technologies that intended to
provide a smart-contracts library for multi-signature wallets to last forever
for its users and (B) the users of the multi-signature wallets that meant to
safely store their assets in a contract accessible any time they desire. Lastly,
the client-side implementation cost of this proposal is estimated to be low. A
sample implementation will be attached and linked in the following sections.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces backwards incompatibilities in the state of the
contract at &lt;code&gt;0x863DF6BFa4469f3ead0bE8f9F2AAE51c91A907b4&lt;&#x2F;code&gt;. The Ethereum protocol
does not allow the restoration of self-destructed contracts. To implement this
on the Ethereum blockchain, it is recommended to add the necessary state
transition in a future hard-fork at a well-defined block number, e.g.,
&lt;code&gt;CNSTNTNPL_FORK_BLKNUM&lt;&#x2F;code&gt; for the Constantinople milestone which is supposed to be
the next scheduled hard-fork on the Ethereum road-map.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A proof-of-concept implementation is available for the Parity client on branch
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;compare&#x2F;a5-eip999-poc&quot;&gt;&lt;code&gt;a5-eip999-poc&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
(&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;8406&quot;&gt;#8406&lt;&#x2F;a&gt;). A sample chain
configuration for Parity can be found at the same branch in
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;blob&#x2F;891e633021eec78dd62104bf5a99af50f66b06c7&#x2F;ethcore&#x2F;res&#x2F;ethereum&#x2F;multisig_test.json#L38-L51&quot;&gt;&lt;code&gt;multisig_test.json&lt;&#x2F;code&gt;&lt;&#x2F;a&gt;
describing the state change as specified above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Modifications to ethash to invalidate existing dedicated hardware implementations</title>
        <published>2018-04-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>David Stanfill</name><email>david@airsquirrels.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/969/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/969/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:969"
            label="EIP-969" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/969/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP modifies ethash in order to break ASIC miners specialized for the current ethash
mining algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;There are companies who currently have dedicated hardware based ethereum miners in
production, and may be actively mining.  This EIP aims to &quot;poison
the well&quot; by modifying the block mining algorithm in a low risk manner that
may &lt;em&gt;&quot;break&quot;&lt;&#x2F;em&gt; these miners if they are in-fact built as traditional ASICs.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;ASIC-based miners will have lower operational costs than GPU-based miners, which
will result in GPU-based mining quickly becoming unprofitable.  Given that
production of ASIC-based miners has a high barrier to entry and few market players,
this will cause a trend towards centralization of mining power.&lt;&#x2F;p&gt;
&lt;p&gt;Risks include market dominance by a single manufacturer that may utilize production
stock to mine themselves, introduce backdoors in their hardware, or facilitate a 51%
attack that would otherwise be infeasible.&lt;&#x2F;p&gt;
&lt;p&gt;This trend towards centralization has a negative effect on network security,
putting significant control of the network in the hands of only a few entities.&lt;&#x2F;p&gt;
&lt;p&gt;Ethash remains ASIC-resistant, however ASIC manufacturer technology is advancing
and ethash may require further changes in order to remain resistant to unforeseen
design techniques. This EIP seeks explicitly to buy time during which newly-developed
ASIC technology will face a barrier while more long-term mechanisms to ensure
continued ASIC resistance can be explored.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= ASIC_MITIGATION_FORK_BLKNUM&lt;&#x2F;code&gt;, require that the ethash solution
sealing the block has been mined using &lt;code&gt;ethashV2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;ethashv2&quot;&gt;EthashV2&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;code&gt;ethashV2&lt;&#x2F;code&gt; will be identical in specification to the current &lt;code&gt;ethash&lt;&#x2F;code&gt;(v1) algorithm, with
the exception of the implementation of &lt;code&gt;fnv&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The new algorithm replaces the 5 current uses of &lt;code&gt;fnv&lt;&#x2F;code&gt; inside &lt;code&gt;hashimoto&lt;&#x2F;code&gt; with 5
separate instances defined as &lt;code&gt;fnvA&lt;&#x2F;code&gt;, &lt;code&gt;fnvB&lt;&#x2F;code&gt;, &lt;code&gt;fnvC&lt;&#x2F;code&gt;, &lt;code&gt;fnvD&lt;&#x2F;code&gt;, and &lt;code&gt;fnvE&lt;&#x2F;code&gt;, utilizing&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_A&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001a7&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_B&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001ab&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_C&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001cf&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_D&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001e3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;FNV_PRIME_E&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001f9&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;fnvA&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv&lt;&#x2F;code&gt; in the DAG item selection step;
&lt;code&gt;fnvB&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv&lt;&#x2F;code&gt; in the DAG item mix step;
&lt;code&gt;fnvC(fnvD(fnvE&lt;&#x2F;code&gt; replaces &lt;code&gt;fnv(fnv(fnv(&lt;&#x2F;code&gt; in the compress mix step.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;fnv&lt;&#x2F;code&gt; as utilized in DAG-item creation should remain unchanged.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;agent-changes-optional-variant&quot;&gt;Agent Changes (Optional Variant)&lt;&#x2F;h2&gt;
&lt;p&gt;The JSON-RPC &lt;code&gt;eth_GetWork&lt;&#x2F;code&gt; call may optionally return the proposed blocks algorithm.
While a miner or pool may infer the requirement for &lt;code&gt;ethashV2&lt;&#x2F;code&gt; based on the computed
epoch of the provided seedHash, it is beneficial to explicitly provide this
field so a miner does not require special configuration when mining on a chain
that chooses not to implement the &lt;code&gt;ASIC_Mitigation&lt;&#x2F;code&gt; hardfork.&lt;&#x2F;p&gt;
&lt;p&gt;Due to compatibility concerns with implementations that already add additional
parameters to &lt;code&gt;GetWork&lt;&#x2F;code&gt;, it is desired to add &lt;code&gt;BlockNumber&lt;&#x2F;code&gt; as an explicit 4th parameter
as suggested in https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;issues&#x2F;2333. Algorithm
should then be returned as either &lt;code&gt;&quot;ethash&quot;&lt;&#x2F;code&gt; or &lt;code&gt;&quot;ethashV2&quot;&lt;&#x2F;code&gt; according to the
&lt;code&gt;block.number &amp;gt;= ASIC_MITIGATION_FORK_BLKNUM&lt;&#x2F;code&gt; criteria.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is aimed at breaking existing ASIC-based miners via small changes to the
existing ethash algorithm.  We hope to accomplish the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Break existing ASIC-based miners.&lt;&#x2F;li&gt;
&lt;li&gt;Demonstrate a willingness to fork in the event of future ASIC miner production.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Goal #1 is something that we can only do probabilistically without detailed
knowledge of existing ASIC miner design. The known released miner is available for
purchase &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;shop.bitmain.com&#x2F;product&#x2F;detail?pid=00020180403174908564M8dMJKtz06B7&quot;&gt;here&lt;&#x2F;a&gt;,
with delivery slated for mid-summer 2018.&lt;&#x2F;p&gt;
&lt;p&gt;Our approach should balance the inherent security risks involved with changing
the mining algorithm with the risk that the change we make does not break existing
ASIC miners.  This EIP leans towards minimizing the security risks by making minimal
changes to the algorithm, accepting the risk that the change may not break dedicated
hardware miners that utilize partially- or fully-configurable logic.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, we do not wish to introduce significant algorithm changes that
may alter the power utilization or performance profile of existing GPU hardware.&lt;&#x2F;p&gt;
&lt;p&gt;The change of FNV constant is a minimal change that can be quickly
implemented across the various network node and miner implementations.&lt;&#x2F;p&gt;
&lt;p&gt;It is proposed that &lt;code&gt;ASIC_MITIGATION_FORK_BLKNUM&lt;&#x2F;code&gt; be no more than 5550000 (epoch 185), giving
around 30 days of notice to node and miner developers and a sufficient window
for formal analysis of the changes by experts. We must weigh this window against
the risk introduced by allowing ASICs that may exist to continue to propagate
on the network, as well as the risk of providing too much advanced warning to
ASIC developers.&lt;&#x2F;p&gt;
&lt;p&gt;It is further understood that this change will not prevent redesign of existing
dedicated hardware with new ASIC chips. The intention of this change is only
to disable currently active or mid-production hardware and provide time for
POS development as well as larger algorithm changes to be well analyzed by
experts.&lt;&#x2F;p&gt;
&lt;p&gt;The choice of FNV constants is made based on the formal specification at
https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-eastlake-fnv-14#section-2.1&lt;&#x2F;p&gt;
&lt;p&gt;@goobur provided the following python code to output primes matching this criteria:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; xrange&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;_&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; is_prime&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;_&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%x&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; candidates&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; %&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;24&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;8&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The minimal prime constraint was relaxed, as has already been the case in &lt;code&gt;ethashV1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Typical ASIC synthesis tools would optimize multiplication of a constant
in the FNV algorithm, while reducing the area needed for the multiplier according
to the hamming weight of the constant. To reduce the chance of ASIC adaptation
through minor mask changes, we propose choosing new constants with a larger
hamming weight, however care should be taken not to choose constants with too
large of a weight.&lt;&#x2F;p&gt;
&lt;p&gt;The current FNV prime, &lt;code&gt;0x1000193&lt;&#x2F;code&gt;, has a hamming weight of 6.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001a7&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001ab&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001cf&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001e3&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001ef&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Not chosen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001f9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 8&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;HammingWeight&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001fb&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Not chosen&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;An analysis can be done regarding the dispersion of these constants as compared to
&lt;code&gt;0x01000193&lt;&#x2F;code&gt;, using the following snippet.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;c&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; https:&#x2F;&#x2F;eips.ethereum.org&#x2F;EIPS&#x2F;eip-969&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stdlib.h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;stdio.h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;include&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;string.h&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;int&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; main&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; dups &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; fnv_candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10001a7&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; MODIFY!&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;    u_int8_t&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt;counts &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; malloc&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    memset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;counts&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;FFFFFFFF&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;span&gt; candidate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        u_int32_t&lt;&#x2F;span&gt;&lt;span&gt; result &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;u_int32_t&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;candidate &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;*&lt;&#x2F;span&gt;&lt;span&gt; fnv_candidate&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;        u_int8_t&lt;&#x2F;span&gt;&lt;span&gt; oldCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; counts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable&quot;&gt;        counts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; counts&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;result&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;+&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        if&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;oldCount &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;!=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            dups&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;++&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; progress display: remove comment to speed down&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;        &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt;if ((candidate &amp;amp; 0xFFFFF) == 0xFFFFF) printf(&amp;quot;0x%08x\n&amp;quot;, candidate);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;    printf&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;FNV candidate 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%08x&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; : &lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;%i&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; dups&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; fnv_candidate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dups&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;It can be empirically confirmed that no more than 1 duplicate occurs in the
32-bit word space with these constants.&lt;&#x2F;p&gt;
&lt;p&gt;It is worth noting that FNV is not a cryptographic hash, and it is not used as
such in ethash. That said, a more invasive hash algorithm change could be considered.&lt;&#x2F;p&gt;
&lt;p&gt;One suggestion has been &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;aappleby&#x2F;smhasher&#x2F;blob&#x2F;master&#x2F;src&#x2F;MurmurHash3.cpp&quot;&gt;MurmurHash3&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;el33th4xor&#x2F;status&#x2F;981292363627810818&quot;&gt;Other suggestions have been made&lt;&#x2F;a&gt;:
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;P-H-C&#x2F;phc-winner-argon2&quot;&gt;Argon2&lt;&#x2F;a&gt;,
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;blog.z.cash&#x2F;why-equihash&#x2F;&quot;&gt;Equihash&lt;&#x2F;a&gt; of Zcash fame, and
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;crypto.stanford.edu&#x2F;balloon&#x2F;&quot;&gt;Balloon Hashing&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Another possible candidate is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;tromp&#x2F;cuckoo&quot;&gt;Cuckoo Cycle&lt;&#x2F;a&gt;,
although there are some concerns regarding unaddressed optimization
vulnerabilities. One review can be found
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;da-data.blogspot.com&#x2F;2014&#x2F;03&#x2F;a-public-review-of-cuckoo-cycle.html&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;This may be considered once the exact mechanism of the released ASICs is known and
their effectiveness against its optimisations can be fully evaluated.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change implements a backwards incompatible change to proof of work based
block mining.  All existing miners will be required to update to clients which
implement this new algorithm, and all nodes will require updates to accept
solutions from the new proof of work algorithm.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO: will need to generate test cases for &lt;code&gt;ethereum&#x2F;tests&lt;&#x2F;code&gt; repository corresponding to the consensus
changes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Support for an Elliptic Curve Cycle</title>
        <published>2018-03-31T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:28+00:00</updated>
	
	
	<author>
		<name>Alexandre Belling</name><email>alexandrebelling8@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1895/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethresear.ch/t/reducing-the-verification-cost-of-a-snark-through-hierarchical-aggregation/5128" />
        

        <id>https://wg-eips.ritovision.com/1895/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1895"
            label="EIP-1895" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1895/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The EVM currently supports elliptic curves operations for curve &lt;em&gt;alt-bn128&lt;&#x2F;em&gt; thanks to precompiles &lt;code&gt;ecadd&lt;&#x2F;code&gt; and &lt;code&gt;ecmul&lt;&#x2F;code&gt; and &lt;code&gt;ecpairing&lt;&#x2F;code&gt;. The classes MNT4 and 6 contain cycles of curves. Those cycles enable doing operations on one curve inside a SNARK on the other curve (and reversely). This EIP suggests adding support for those curves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Adds supports for the following operations through precompiles:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ecadd&lt;&#x2F;code&gt; on MNT4&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ecmul&lt;&#x2F;code&gt; on MNT4&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;ecpairing&lt;&#x2F;code&gt; on MNT4&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Elliptic curve is the basic block of recursive SNARKs (ie: verifying a SNARK inside a SNARK) and this addresses the issue of scalable zero-knowledge. More generally this addresses partly the scalability issue as SNARKs verification are constant time in the size of the circuit being verified.&lt;&#x2F;p&gt;
&lt;p&gt;More concretely, today if the EVM has to deal with 1000s of SNARK verification it would take around 1.5 billion gas and would be impractical for Ethereum. Recursive SNARKs for instance make it possible to aggregate multiple proofs into a single one that can be verified like any other SNARK. It results in a massive cost reduction for the verification.&lt;&#x2F;p&gt;
&lt;p&gt;However, this is impossible using &lt;em&gt;alt-bn128&lt;&#x2F;em&gt; and in my knowledge, the only family of pairing-friendly curves known to produce cycles are MNT4 and MNT6. A complete characterization of the cycles existing between those two families is proposed in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1803.02067.pdf&quot;&gt;On cycles of pairing-friendly elliptic curves
&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;the-curve&quot;&gt;The curve&lt;&#x2F;h3&gt;
&lt;p&gt;The proposed cycle has been introduced in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;595.pdf&quot;&gt;Scalable Zero Knowledge via Cycles of Elliptic Curves&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;mnt4-definition&quot;&gt;MNT4 definition&lt;&#x2F;h3&gt;
&lt;p&gt;The groups &lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are cyclic groups of prime order :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;q = 475922286169261325753349249653048451545124878552823515553267735739164647307408490559963137&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;G_1&lt;&#x2F;code&gt; is defined over the field &lt;code&gt;F_p&lt;&#x2F;code&gt; of prime order :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p = 475922286169261325753349249653048451545124879242694725395555128576210262817955800483758081&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with generator P:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    60760244141852568949126569781626075788424196370144486719385562369396875346601926534016838,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    363732850702582978263902770815145784459747722357071843971107674179038674942891694705904306&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Both p and q can be written in 298 bits.&lt;&#x2F;p&gt;
&lt;p&gt;The group G_1 is defined on the curve defined by the equation &lt;code&gt;Y² = X³ + aX + b&lt;&#x2F;code&gt; where:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a = 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b = 423894536526684178289416011533888240029318103673896002803341544124054745019340795360841685&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The twisted group G_2 is defined over the field &lt;code&gt;F_p^2 = F_p &#x2F; &amp;lt;&amp;lt;To be completed&amp;gt;&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The twisted group G_2 is defined on the curve defined by the equation &lt;code&gt;Y² = X² + aX + b&lt;&#x2F;code&gt; where :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    a = 34 + i * 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    b = 0 + i * 67372828414711144619833451280373307321534573815811166723479321465776723059456513877937430&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;G_2 generator is generated by :&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    P2 = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        438374926219350099854919100077809681842783509163790991847867546339851681564223481322252708 +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i * 37620953615500480110935514360923278605464476459712393277679280819942849043649216370485641,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        37437409008528968268352521034936931842973546441370663118543015118291998305624025037512482 +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        i * 424621479598893882672393190337420680597584695892317197646113820787463109735345923009077489&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;the-operations-and-gas-cost&quot;&gt;The operations and gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The following operations and their gas cost would be implemented&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MNT_X_ADD = &amp;lt;&amp;lt;To be estimated&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MNT_X_MUL = &amp;lt;&amp;lt;To be estimated&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MNT_X_PAIRING = &amp;lt;&amp;lt;To be estimated&amp;gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where &lt;code&gt;X&lt;&#x2F;code&gt; is either 4.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;The curves points P(X, Y) over F_p are represented in their compressed form C(X, Y):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    C = X | s&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;where &lt;code&gt;s&lt;&#x2F;code&gt; represents &lt;code&gt;Y&lt;&#x2F;code&gt; as follow:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    |  `s&amp;#39;`  | `Y`                      |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    |--------|--------------------------|&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    | `0x00` | Point at infinity        |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    | `0x02` | Solution with `y` even   |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    | `0x03` | Solution with `y` odd    |&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Compression operation from affine coordinate is trivial:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    s = 0x02 | (s &amp;amp; 0x01)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the EVM the compressed form allows us to represents curve points with 2 uint256 instead of 3.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;edge-cases&quot;&gt;Edge cases&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Several acceptable representations for the point at infinity&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The curve has 80 bits of security (whereas MNT6 has 120 bits) which might not be considered enough for critical security level, (for instance transferring several billions), but enough for others. If it turns out this is not enough security for adoption, there is another option : another cycle is being used by Coda but is defined over a 753 bits sized field which might also be prohibitively low (no reference to this curve from Coda&#x27;s publications found).&lt;&#x2F;p&gt;
&lt;p&gt;Independently of the cycle chosen, the groups and field elements are represented with integers larger than 256 bits (even for the 80 bits of security), therefore it might be necessary to also add support for larger field size operations.&lt;&#x2F;p&gt;
&lt;p&gt;We currently don&#x27;t know more efficient pairing-friendly cycles and don&#x27;t know if there are. It might be possible to circumvent this problem though by relaxing the constraint that all the curves of the cycle must be pairing friendly). If we had a cycle with only one pairing friendly curve we would still be able to compose proofs by alternating between SNARKs and any other general purpose zero-knowledge cryptosystems.&lt;&#x2F;p&gt;
&lt;p&gt;Assuming we find a convenient cycle, we don&#x27;t need to implement support for all the curves it contains, only one. The best choice would be the fastest one as the overall security of the recursive snark do not depends on which curve the verification is made.&lt;&#x2F;p&gt;
&lt;p&gt;Proper benchmarks will be done in order to make this choice and to price the operations in gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Eli-Ben-Sasson, Alessandro Chiesa, Eran Tromer, Madars Virza, [BCTV14], April 28, 2015, Scalable Zero Knowledge via Cycles of Elliptic Curves : https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;595.pdf&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;em&gt;Alessandro Chiesa, Lynn Chua, Matthew Weidner, [CCW18], November 5, 2018, On cycles of pairing-friendly elliptic curves : https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1803.02067.pdf&lt;&#x2F;em&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;AlexandreBelling&#x2F;go-boojum&quot;&gt;go-boojum&lt;&#x2F;a&gt; : A PoC demo of an application of recursive SNARKs&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&quot;&gt;libff&lt;&#x2F;a&gt; : a C++ library for finite fields and elliptic curves&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;CodaProtocol&#x2F;coda&quot;&gt;coda&lt;&#x2F;a&gt; : a new cryptocurrency protocol with a lightweight, constant sized blockchain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add precompiled contract for Ed25519 signature verification</title>
        <published>2018-03-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tobias Oberstein</name><email>tobias.oberstein@crossbario.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/665/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/665/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:665"
            label="EIP-665" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/665/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Support performant and cheap verification of Ed25519 cryptographic signatures in smart contracts in general by adding a precompiled contract for Ed25519 signature verification to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Verification of Ed25519 cryptographic signatures is obviously possible in EVM bytecode. However, the gas cost will be very high, and computationally expensive, as such tight, wide word operations intensive code as required for Ed25519 is not a good fit for the EVM bytecode model.&lt;&#x2F;p&gt;
&lt;p&gt;The addition of a native compiled function, in a precompiled contract, to the EVM solves both cost and performance problems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ed25519 and Ed448 (that is, EdDSA using Curve25519 or Curve448) are IETF recommendations (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7748&quot;&gt;RFC7748&lt;&#x2F;a&gt;) with some attractive properties:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Ed25519 is intended to operate at around the 128-bit security level and Ed448 at around the 224-bit security level&lt;&#x2F;li&gt;
&lt;li&gt;EdDSA uses small public keys (32 or 57 octets) and signatures (64 or 114 octets) for Ed25519 and Ed448, respectively&lt;&#x2F;li&gt;
&lt;li&gt;Ed25519&#x2F;Ed448 are designed so that fast, constant-time (timing attack resistant) and generally side-channel resistant  implementations are easier to produce&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Despite being around only for some years, post-Snowden, these curves &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ianix.com&#x2F;pub&#x2F;ed25519-deployment.html&quot;&gt;have gained wide use&lt;&#x2F;a&gt; quickly in various protocols and systems:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;TLS &#x2F; ECDH(E) (session keys)&lt;&#x2F;li&gt;
&lt;li&gt;TLS &#x2F; x.509 (client and server certificates)&lt;&#x2F;li&gt;
&lt;li&gt;DNSSEC (zone signing)&lt;&#x2F;li&gt;
&lt;li&gt;OpenSSH (user keys)&lt;&#x2F;li&gt;
&lt;li&gt;GNUPG&#x2F;OpenPGP (user keys)&lt;&#x2F;li&gt;
&lt;li&gt;OpenBSD Signify (software signing)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;One motivation for Ed25519 signature verification in smart contracts is to &lt;strong&gt;associate&lt;&#x2F;strong&gt; existing off-chain systems, records or accounts that use Ed25519 (like above) with blockchain addresses or &lt;strong&gt;delegate&lt;&#x2F;strong&gt; by allowing to sign data with Ed25519 (only), and then submit this Ed25519-signed data anonymously (via any Eth sender address) to the blockchain, having the contract check the Ed25519 signature of the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;Another motivation is the processing of external, Ed25519 proof-of-stake based blockchains within Ethereum smart contracts.&lt;&#x2F;p&gt;
&lt;p&gt;When a transactions contains data that comes with an Ed25519 signature, that proves that the sender of the Ethereum transaction was also in control of the private key (and the data), and this allows the contract to establish an association between the blockchain and the external system or account, and the external system establish the reverse relation.&lt;&#x2F;p&gt;
&lt;p&gt;For example, a contract might check a Ed25519 signed piece of data submitted to the Ethereum transaction like the current block number. That proves to the contract, that the sender is in possession of both the Ethereum private key and the Ed25519 private key, and hence the contract will accept an association between both. This again can be the root anchor for various powerful applications, as now a potentially crypto holding key owner has proven to be in control of some external off-chain system or account, like e.g. a DNS server, a DNS domain, a cluster node and so on.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, add a precompiled contract for Ed25519 signature verification (&lt;code&gt;ED25519VFY&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;The proposal adds a new precompiled function &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; with the following input and output.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; takes as &lt;strong&gt;input 128 octets&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;message&lt;&#x2F;strong&gt;: the 32-octet message that was signed&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;public key&lt;&#x2F;strong&gt;: the 32-octet Ed25519 public key of the signer&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;signature&lt;&#x2F;strong&gt;: the 64-octet Ed25519 signature&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; returns as &lt;strong&gt;output 4 octets&lt;&#x2F;strong&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0x00000000&lt;&#x2F;code&gt; if signature is valid&lt;&#x2F;li&gt;
&lt;li&gt;any non-zero value indicates a signature verification failure&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;address&quot;&gt;Address&lt;&#x2F;h3&gt;
&lt;p&gt;The address of &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; is &lt;strong&gt;&lt;code&gt;0x9&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;Gas cost for &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; is &lt;strong&gt;2000&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The proposed &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; function takes the signer public key as a call parameter, as with Ed25519, I don&#x27;t believe it is possible to derive the signers public key from the signature and message alone.&lt;&#x2F;p&gt;
&lt;p&gt;The proposed &lt;code&gt;ED25519VFY&lt;&#x2F;code&gt; function uses a zero return value to indicate success, since this allows for different errors to be distinguished by return value, as all non-zero return values signal a verification failure.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ECRECOVER&lt;&#x2F;code&gt; has a gas cost of 3000. Since Ed25519 is computationally cheaper, the gas price should be less.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As the proposed precompiled contract is deployed at a reserved (&amp;lt;255) and previously unused address, an implementation of the proposal should not introduce any backward compatibility issues.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test vectors for Ed25519 can be found in this IETF ID https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-josefsson-eddsa-ed25519-03#section-6.&lt;&#x2F;p&gt;
&lt;p&gt;More test vectors can be found in the regression tests of NaCl (see references).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;libsodium&quot;&gt;libsodium&lt;&#x2F;h3&gt;
&lt;p&gt;libsodium is a mature, high-quality C implementation of Ed25519, with bindings for many languages.&lt;&#x2F;p&gt;
&lt;p&gt;Further, libsodium is (to my knowledge, and as of today 2018&#x2F;04) the only Ed25519 implementation that has gone through a &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.privateinternetaccess.com&#x2F;blog&#x2F;2017&#x2F;08&#x2F;libsodium-v1-0-12-and-v1-0-13-security-assessment&#x2F;&quot;&gt;Security Assessment&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To minimize consensus failure risks, the proposal recommends to use libsodium for adding the precompile in all Ethereum client implementations.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: as an alternative to libsodium, I looked into HACL, an implementation of Ed25519 in F* (a ML dialect) that can be transpiled to C, and that was formally verified for functional correctness and memory safety of the resulting C code. However, this is new and compared to libsodium which is a &quot;know thing&quot; seems risky nevertheless.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;libsodium-bindings&quot;&gt;libsodium bindings&lt;&#x2F;h3&gt;
&lt;p&gt;Here is an overview of the language bindings to libsodium for four Ethereum clients this proposal recommends:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Client&lt;&#x2F;th&gt;&lt;th&gt;Language&lt;&#x2F;th&gt;&lt;th&gt;libsodium binding&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Geth&lt;&#x2F;td&gt;&lt;td&gt;Go&lt;&#x2F;td&gt;&lt;td&gt;use cgo with C &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jedisct1&#x2F;libsodium&quot;&gt;libsodium&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;Parity&lt;&#x2F;td&gt;&lt;td&gt;Rust&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dnaq&#x2F;sodiumoxide&quot;&gt;sodiumoxide&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;PyEthereum&lt;&#x2F;td&gt;&lt;td&gt;Python&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pyca&#x2F;pynacl&quot;&gt;PyNaCl&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;cpp-ethereum&lt;&#x2F;td&gt;&lt;td&gt;C++&lt;&#x2F;td&gt;&lt;td&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;jedisct1&#x2F;libsodium&quot;&gt;libsodium&lt;&#x2F;a&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;hr &#x2F;&gt;
&lt;h3 id=&quot;prs&quot;&gt;PRs&lt;&#x2F;h3&gt;
&lt;p&gt;Implementations of this proposal are here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;16453&quot;&gt;go-ethereum PR #16453&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;pull&#x2F;862&quot;&gt;pyethereum PR #862&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;8330&quot;&gt;parity PR #8330&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;cpp-ethereum&#x2F;pull&#x2F;4945&quot;&gt;cpp-ethereum PR #4945&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;RFC7748 - Elliptic Curves for Security https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7748&lt;&#x2F;li&gt;
&lt;li&gt;Definition of Ed25519: https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;ed25519-20110926.pdf&lt;&#x2F;li&gt;
&lt;li&gt;Ed25519 - high-speed high-security signatures: https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;&lt;&#x2F;li&gt;
&lt;li&gt;NaCl - Networking and Cryptography library: https:&#x2F;&#x2F;nacl.cr.yp.to&#x2F;sign.html&lt;&#x2F;li&gt;
&lt;li&gt;NaCl Crypto Libraries (which contains Ed25519): https:&#x2F;&#x2F;ianix.com&#x2F;pub&#x2F;ed25519-deployment.html&lt;&#x2F;li&gt;
&lt;li&gt;Test vectors for Ed25519: https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;draft-josefsson-eddsa-ed25519-03#section-6&lt;&#x2F;li&gt;
&lt;li&gt;NaCl regression tests: https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;python&#x2F;sign.py and https:&#x2F;&#x2F;ed25519.cr.yp.to&#x2F;python&#x2F;sign.input&lt;&#x2F;li&gt;
&lt;li&gt;On the recoverability of public keys from signature+message (alone): https:&#x2F;&#x2F;crypto.stackexchange.com&#x2F;questions&#x2F;9936&#x2F;what-signature-schemes-allow-recovering-the-public-key-from-a-signature&lt;&#x2F;li&gt;
&lt;li&gt;Bernstein, D., &quot;Curve25519: new Diffie-Hellman speed records&quot;, DOI 10.1007&#x2F;11745853_14, February 2006, https:&#x2F;&#x2F;cr.yp.to&#x2F;ecdh.html&lt;&#x2F;li&gt;
&lt;li&gt;Hamburg, M., &quot;Ed448-Goldilocks, a new elliptic curve&quot;, June 2015, https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2015&#x2F;625&amp;gt;&lt;&#x2F;li&gt;
&lt;li&gt;RFC8080: Edwards-Curve Digital Security Algorithm (EdDSA) for DNSSEC (https:&#x2F;&#x2F;datatracker.ietf.org&#x2F;doc&#x2F;html&#x2F;rfc8080)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reward clients for a sustainable network</title>
        <published>2018-03-01T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>James Ray</name><uri>https://github.com/jamesray1</uri>
	</author>
	
	<author>
		<name>Micah Zoltu</name><uri>https://github.com/MicahZoltu</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/908/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-908-reward-full-nodes-and-clients/241" />
        

        <id>https://wg-eips.ritovision.com/908/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:908"
            label="EIP-908" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/908/">&lt;h2 id=&quot;a-reward-for-running-a-full-node-is-deprecated-but-the-proposal-for-a-reward-for-clients-remains&quot;&gt;A reward for running a full node is deprecated, but the proposal for a reward for clients remains&lt;&#x2F;h2&gt;
&lt;p&gt;While Casper validators are incentivized to validate transactions, there are still no incentives for relaying blocks and storing data (which includes state). This paper is more a high-level analysis and discussion rather than attempting to provide a concrete solution. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.pokt.network&#x2F;&quot;&gt;Pocket Network&lt;&#x2F;a&gt; is a separate blockchain being designed as of Sept 2018 that incentivises relaying transactions, that is intended to be compatible with other blockchains. Note also that &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;rocket-pool&#x2F;rocketpool&quot;&gt;Rocket Pool&lt;&#x2F;a&gt; is under development and is planned to be a pool for Casper, which will help to incentivise running a full node. Another alternative is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;vipnode&#x2F;vipnode.org&quot;&gt;VIPnode&lt;&#x2F;a&gt; which charges fees to light clients for full nodes that serve them. In light of these solutions being developed, perhaps a more appropriate approach to generally rewarding clients would be to incentivize bandwidth (relaying and downloading), storage and I&#x2F;O (while computation is already incentivized with gas for miners and will be for proposers under sharding and Casper). Note also that notaries will be incentivized to download collations under sharding. Outdated (Casper FFG will be implemented with Ethereum 2.0 with sharding: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;notes.ethereum.org&#x2F;SCIg8AH5SA-O4C1G1LYZHQ#&quot;&gt;shasper&lt;&#x2F;a&gt;): given that it looks like Casper FFG will be implemented soon, to minimize undue complexity to the protocol, incentivizing validation in the mean time may be considered not worthwhile. For a previous version of the proposal containing a proposal for rewarding a full node, refer to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;commit&#x2F;97e235d0ba4a88b4ce29834aa2b94107b8d91e12#diff-9a43a8739b5a9e1dec427324cb264921&quot;&gt;here&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;When each transaction is validated, give a reward to clients for developing the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The tragedy of the commons is a phenomenon that is well known in many sectors, most notably in regard to sustainability. It involves the over-utilization of shared finite resources, which detriments all participants and stakeholders involved (which in the case of a global public good can be everyone, including future generations). Without proper management of public resources, a tragedy of the commons can occur. Internalizing externalities (where externalities can be broadly defined as effects that are not accounted for in the intrinsic price of a good, service or resource) is one way of incentivizing the proper management of resources, although other methods that actually properly manage them are necessary. This EIP proposes to make a change to the protocol to provide a reward to clients for providing the software that enables Ethereum to function, where the reward can include a proportion of transaction fees (reducing the full proportion that the miner currently receives), and some newly minted ETH. Thus, clients are incentivized to maintain and improve the security and health of the Ethereum protocol and ecosystem. To summarize the mechanism in the proposal, a user agent is attached to a transaction, where this user agent contains a vector with the index of a client address in an access list. The client address could be inserted by the client and verified that it is the same as a read-only constant in the client&#x27;s storage.&lt;&#x2F;p&gt;
&lt;p&gt;Reward mechanisms that are external to being built in to the protocol are beyond the scope of this EIP. Such extra-protocol reward methods include state channel payments for extra services such as light client servers providing faster information such as receipts; state channel payments for buying state reads from full nodes; archival services (which is only applicable to future proposed versions of Ethereum with stateless clients); and tokens for the client and running full nodes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently there is a lack of incentives for anyone to run a full node, while joining a mining pool is not really economical if one has to purchase a mining rig (several GPUs) now, since there is unlikely to be a return on investment by the time that Ethereum transitions to hybrid Proof-of-Work&#x2F;Proof-of-Stake with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1011&#x2F;&quot;&gt;Casper FFG&lt;&#x2F;a&gt;, then full PoS with &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;research&#x2F;blob&#x2F;master&#x2F;papers&#x2F;CasperTFG&#x2F;CasperTFG.pdf&quot;&gt;CBC Casper&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, providing a reward for clients gives a revenue stream that is independent of state channels or other layer 2 mechanisms, which are less secure, although this insecurity can be offset by mechanisms such as insurance, bonded payments and time locks. Rationalising that investors may invest in a client because it is an enabler for the Ethereum ecosystem (and thus opening up investment opportunities) may not scale very well, and it seems that it is more sustainable to monetize the client as part of the service(s) that it provides.&lt;&#x2F;p&gt;
&lt;p&gt;While it may be argued that the funds raised by the Ethereum pre-mine (the pre-ICO and the ICO) can be used to fund client development, that argument is questionable, since Parity is VC-funded, and other clients such as Prysmatic Labs &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@XYOracleNetwork?source=search_post&quot;&gt;1&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twitter.com&#x2F;prylabs&#x2F;status&#x2F;996391036753666050&quot;&gt;2&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;prysmatic-labs&#x2F;biweekly-development-update-2-d29d0c91e7d0&quot;&gt;3&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;compound-finance&#x2F;introducing-exthereum-the-newest-ethereum-client-7a5e30d4d6aa&quot;&gt;exthereum&lt;&#x2F;a&gt; have received funding from other parties, whereas perhaps they would not have needed to do so if there was sufficient funding from the Ethereum pre-mine funds. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;Drops-of-Diamond&#x2F;diamond_drops&quot;&gt;Drops of Diamond&lt;&#x2F;a&gt; is yet to receive any funding.&lt;&#x2F;p&gt;
&lt;p&gt;Incentivizing client development would more directly incentivize resource provision in the protocol, preventing a tragedy of the commons, where there is an extreme lack of supply and excess demand, leading to the protocol being unusable.&lt;&#x2F;p&gt;
&lt;p&gt;See &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2014&#x2F;452.pdf#subsection.2.1&quot;&gt;here&lt;&#x2F;a&gt; for an analysis in the context of Bitcoin, PoW, and a hybrid PoW&#x2F;PoS protocol. While Ethereum has a gas limit, the section points out that this is not enough as the market cap increases and the incentive to attack the network increases, while the ratio of security costs to transaction fees does not, while PoS will further alleviate the problem. However, the section points out that PoS is not enough, since the costs of propagating, verifying and storing transactions are not incentivised. Note that the &quot;Proof of Activity: Extending Bitcoin’s Proof of Work via Proof of Stake&quot; paper also contains a scheme for incentivizing a target participation level.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The word “activity” in the phrase Proof of  Activity emphasizes the point that only active stakeholders who maintain a full online node get rewarded, in exchange for the vital services that they provide for the network.  This stands in contrast to earlier Proof  of  Stake schemes in which offline stake can accumulate weight over time, and may ultimately be utilized in double-spending attacks.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We can also incentivize full nodes to propagate transactions and to store transactions or state, in addition to verifying them. While these first two incentivizations are outside the scope of this EIP, there are proposals &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentivizing-a-robust-p2p-network-relay-layer&#x2F;1438&quot;&gt;here&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentivizing-full-state-nodes&#x2F;1640&quot;&gt;here&lt;&#x2F;a&gt;, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;Implementing this as a layer 2 solution may not ensure the sustainability of the protocol, since not everyone would use it; if the protocol doesn&#x27;t have any cost for full nodes to validate transactions, then people will take advantage of that and not use the layer 2 solution. It seems that you should at least have the part where the reward is provided in protocol, but then that and the user agent signature doesn&#x27;t really add anything else to the protocol, so doing some part in-protocol and some part e.g. the verification or a verification-game off-protocol could be done, but it&#x27;s already done in protocol. Note also that some computationally expensive tasks are too challenging to feasibly do in protocol, e.g. due to not fitting in the gas limit, could be done with Truebit, where verifiers have an incentive.&lt;&#x2F;p&gt;
&lt;p&gt;Not providing incentives for clients is an issue now as there is less incentive to build a client that aligns with the needs of users, funds need to be raised externally to the protocol to fund client development, which is not as decentralized. If only a smaller subset is able to fund client development, such as VCs, angel investors and institutional investors, that may not align well with the interests of all current and potential stakeholders of Ethereum (which includes future stakeholders). Ostensibly, one of the goals of Ethereum is to decentralize everything, including wealth, or in other words, to improve wealth equality. Not providing incentives for full nodes validating transactions may not seem like as much of an issue now, but not doing so could hinder the growth of the protocol. Of course, incentives aren&#x27;t enough, it also needs to be technically decentralized so that it is ideally possible for a low-end mainstream computer or perhaps even a mobile or embedded IoT device to be a verifying full node, or at least to be able to help with securing the network if it is deemed impractical for them to be a full node.&lt;&#x2F;p&gt;
&lt;p&gt;Note that with a supply cap (as in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;960&quot;&gt;EIP-960&lt;&#x2F;a&gt;, the issuance can be prevented from increasing indefinitely. Alternatively, it could at least be reduced (still potentially but not necessarily to zero, or to the same rate at which Ether is burnt when slashing participants, such as validators under a Casper PoS scheme or notaries under a sharding scheme), e.g. by hard forks, or as per &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1015&#x2F;&quot;&gt;EIP-1015&lt;&#x2F;a&gt;, an on-chain contract governed by a decision assembly that gets signalling from other contracts that represent some set of stakeholders.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Add a new field to each block called &lt;code&gt;PrevBlockVerifications&lt;&#x2F;code&gt;, which is an arbitrary, unlimited size byte array. When a client verifies that a previous block is &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf#subsubsection.4.3.2&quot;&gt;valid&lt;&#x2F;a&gt;, the client appends a user agent to PrevBlockVerifications via an opcode in a transaction, PREV_BLOCK_VERIF. The user agent is a vector with the  immutable fields: the blockhash of the block that is validated, and the index of a client address in an access list (details are below). A miner validates a transaction before including it in a block, however they are not able to change these fields of the vector because they&#x27;re immutable.&lt;&#x2F;p&gt;
&lt;p&gt;Send 0.15 ETH to the client (see the rationale below), when the block is processed. The amounts could include a proportion of transaction fees (while the miner would then receive less), which would reduce newly issued ETH. These amounts are specified in new &lt;code&gt;ClientReward&lt;&#x2F;code&gt; fields in the block.&lt;&#x2F;p&gt;
&lt;p&gt;In order to only incentivize verifying recent blocks, assert that the block number corresponding to a blockhash is less than 400 blocks ago.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attacks-and-added-specifications-to-prevent-them&quot;&gt;Attacks and added specifications to prevent them&lt;&#x2F;h3&gt;
&lt;p&gt;A miner could create a client and fill their block with transactions that only contain the PREV_BLOCK_VERIF opcode (or alternatively, arbitrarily complex transactions, still with the opcode), with previous blockhashes that they have validated and the address of their client. To prevent this, state would have to store a list containing lists, with each sublist listing the blockhashes up to 400 blocks ago that correspond to a miner, then a miner (or a proposer under Casper CBC) could have to put down a deposit, and be slashed if the proposer inserts such a transaction (that contains a blockhash which they have already proposed, not just in a block but at any time previously). Updating the state to remove blockhashes more than 400 blocks ago would add additional overhead, although you could add an extra window for older blocks, say 120,000 blocks (roughly every 3 weeks), still ignore blocks that are older than 400 blocks ago, and remove these older 120,000 blocks every 120,000 blocks. An attacker could bribe a miner&#x2F;proposer to include transactions like above that contain an address of a client in the access list which they own. However, the above slashing condition should disincentivize this.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;more-details-on-the-access-list&quot;&gt;More details on the access list&lt;&#x2F;h3&gt;
&lt;p&gt;The access list prevents anyone inserting any address to the first element of the vector, where there may be a way to prevent censorship and centralization of authority of who decides to register new addresses in the list, e.g. on-chain governance with signalling (possibly similar to &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1015&#x2F;&quot;&gt;EIP-1015&lt;&#x2F;a&gt;, which also specifies an alternative way of sending funds) or a layer 2 proof of authority network where new addresses can be added via a smart contract. Note that there may be serious drawbacks to implementing either of these listed examples. There is a refutation of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;medium.com&#x2F;@Vlad_Zamfir&#x2F;against-on-chain-governance-a4ceacd040ca&quot;&gt;on-chain governance&lt;&#x2F;a&gt; as well as of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;vitalik.ca&#x2F;general&#x2F;2018&#x2F;03&#x2F;28&#x2F;plutocracy.html&quot;&gt;plutocracy&lt;&#x2F;a&gt;. &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Proof-of-authority&quot;&gt;Proof of Authority&lt;&#x2F;a&gt; isn&#x27;t suitable for a public network since it doesn&#x27;t distribute trust well. However, using signalling in layer 2 contracts is more acceptable, but Vlad Zamfir argues that using that to influence outcomes in the protocol can disenfranchise miners from being necessary participants in the governance process. Thus, in light of these counterpoints, having an access list may not be suitable until a decentralized, trustless way of maintaining it is implemented and ideally accepted by the majority of a random sample that represents the population of Ethereum users.&lt;&#x2F;p&gt;
&lt;p&gt;However, another alternative to managing the access list would be to have decentralized verification that the address produced from querying an index in the access list does correspond to that of a &quot;legitimate&quot; client. Part of this verification would involve checking that there is a client that claims that this address is owned by them, that they are happy to receive funds in this manner and agree or arranged to putting the address in the access list, and that the client passes all tests in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&quot;&gt;Ethereum test suite&lt;&#x2F;a&gt;. However, this last proviso would then preclude new clients being funded from the start of development, although such would-be clients would not be able to receive funds in-protocol until they implement the client anyway (as an aside, they could raise funds in various ways—a DAII, pronounced die-yee, is recommended, while a platform for DAIIs is under development by &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;dogezer.com&#x2F;&quot;&gt;Dogezer&lt;&#x2F;a&gt;). All of this could be done off-chain, and if anyone found that some address in the access list was not legitimate, then they could challenge that address with a proof of illegitimacy, and the participant that submitted the address to the access list could be slashed (while they must hold a deposit in order to register and keep an address in the access list).&lt;&#x2F;p&gt;
&lt;p&gt;Additionally, it should help with being only able to read the client&#x27;s address from the client, and the whole transaction could revert if the address is not in the access list. You could provide the index of the address in the access list, and then you could &lt;code&gt;assert&lt;&#x2F;code&gt; that the address found at that index matches that which can be read by the client (where the latter would be a read-only address).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;a-rough-qualitative-analysis-of-fees&quot;&gt;A rough qualitative analysis of fees&lt;&#x2F;h3&gt;
&lt;p&gt;As of May 4 2018, there are &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180504051128&#x2F;https:&#x2F;&#x2F;ethernodes.org&#x2F;network&#x2F;1&quot;&gt;16428 nodes&lt;&#x2F;a&gt;. Assume that an annual cost for an average client developer organisation is $1 million per annum. Projecting forward (and noting that the number of nodes should increase substantially if this EIP was implemented, thus aiding Ethereum&#x27;s goal of decentralizing everything) assume that there are 10 clients. Thus let us assume that the number of nodes doubles to 30000 nodes within 5 years (this assumption is probably conservative, even if it is forward looking). Assume for simplicity that the costs of a client are entirely covered by this block reward.&lt;&#x2F;p&gt;
&lt;p&gt;Average cost per client = number of nodes * Block reward per client &#x2F; number of clients&lt;&#x2F;p&gt;
&lt;p&gt;Block reward per client (worse case for ETH price) = Average revenue per client * number of clients &#x2F; (ETH exchange rate * number of nodes)&lt;&#x2F;p&gt;
&lt;p&gt;= $2,000,000 * 10 &#x2F; (500 * 30,000)&lt;&#x2F;p&gt;
&lt;p&gt;= 1.333333333 ETH&lt;&#x2F;p&gt;
&lt;p&gt;Block reward per client (better case) = $1,000,000 * 10 &#x2F; (2000 * 30,000) = 0.166666667 ETH&lt;&#x2F;p&gt;
&lt;p&gt;Suppose that we use a block reward of 0.15 ETH for clients.&lt;&#x2F;p&gt;
&lt;!--There are more than 5552465 blocks and counting. With a reward of 0.001 ETH for each block, a full state node that verified every block would receive 5552.465 ETH. However, the difficulty of verifying blocks increases over time, so--&gt;
&lt;h3 id=&quot;more-rationale-outdated-by-above&quot;&gt;More rationale (outdated by above)&lt;&#x2F;h3&gt;
&lt;p&gt;The amount of computation to validate a transaction will be the same as a miner, since the transaction will need to be executed. Thus, if there would be transaction fees for validating full nodes and clients, and transactions need to be executed by validators just like miners have to, it makes sense to have them calculated in the same way as gas fees for miners. This would controversially increase the amount of transaction fees a lot, since there can be many validators for a transaction. In other words, it is controversial whether to provide the same amount of transaction fee for a full node validator as for a miner (which in one respect is fair, since the validator has to do the same amount of computation), or prevent transaction fees from rising much higher, and have a transaction fee for a full node as, say, the transaction fee for a miner, divided by the average number of full nodes validating a transaction. The latter option seems even more controversial (but is still better than the status quo), since while there would be more of an incentive to run a full node than there is now with no incentive, validators would be paid less for performing the same amount of computation.&lt;&#x2F;p&gt;
&lt;p&gt;And as for the absolute amounts, this will require data analysis, but clearly a full node should receive much less than a miner for processing a transaction in a block, since there are many transactions in a block, and there are many confirmations of a block. Data analysis could involve calculating the average number of full nodes verifying transactions in a block. Macroeconomic analysis could entail the economic security benefit that full nodes provide to the network.&lt;&#x2F;p&gt;
&lt;p&gt;Now, as to the ratio of rewards to the client vs the full node, as an initial guess I would suggest something like 99:1. Why such a big difference? Well, I would guess that clients spend roughly 99 times more time on developing and maintaining the client than a full node user spends running and maintaining a full node. During a week there might be several full-time people working on the client, but a full node might only spend half an hour (or less) initially setting it up, plus running it, plus electricity and internet costs. Full node operators probably don&#x27;t need to upgrade their computer (and buying a mining rig isn&#x27;t worth it with Casper PoS planning on being implemented soon).&lt;&#x2F;p&gt;
&lt;p&gt;However, on further analysis, clients would also get the benefit of a large volume of rewards from every full node running the client, so to incentivise full node operation further, the ratio could change to say, 4:1, or even 1:1, and of course could be adjusted with even further actual data analysis, rather than speculation.&lt;&#x2F;p&gt;
&lt;p&gt;Providing rewards to full node validators and to clients would increase the issuance. In order to maintain the issuance at current levels, this EIP could also reduce the mining reward (despite being reduced previously with the Byzantium release in October 2017 from 5 ETH to 3 ETH), but that would generate more controversy and discussion.&lt;&#x2F;p&gt;
&lt;p&gt;Another potential point of controversy with rewarding clients and full nodes is that the work previously done by them has not been paid for until now (except of course by the Ethereum Foundation or Parity VCs funding the work), so existing clients may say that this EIP gives an advantage to new entrants. However, this doesn&#x27;t hold up well, because existing clients have the first mover advantage, with much development to create useful and well-used products.&lt;&#x2F;p&gt;
&lt;p&gt;There is a tradeoff. Higher fees means you may cut out poor people and people who just don&#x27;t want to pay fees. But if a laptop can run a full node and get paid for it then that would offset the fees through usage. Full nodes do provide a security benefit, so the total fees given could at least be some fraction of this benefit. Fees that go towards client development incentivise a higher quality client. To me, I think it makes more sense to internalize costs as much as possible: for computation, storage, bandwidth, I&#x2F;O, client development, running full nodes, mining&#x2F;validating, etc. You avoid a tragedy of the commons through externalizing costs. The more you internalize costs, the more sustainable it is, and the less you rely on rich people being generous, etc. (Although, getting philosophical, ultimately you can&#x27;t force rich people to be generous, they have to do so out of the kindness of their hearts.)&lt;&#x2F;p&gt;
&lt;p&gt;Regarding rewards for full nodes, in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;sharding-phase-1-spec&#x2F;1407&quot;&gt;draft phase 1 sharding spec&lt;&#x2F;a&gt; proposers acting as full nodes have rewards for proposing blobs (without execution) or later in phase 3 transactions (with execution) to be included into collations&#x2F;blocks. So that would help. However, full nodes that do not act as proposers and just verify transactions, or &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentivizing-full-state-nodes&#x2F;1640&quot;&gt;full state nodes&lt;&#x2F;a&gt;, are still not incentivized.&lt;&#x2F;p&gt;
&lt;p&gt;Note that while further quantitative analysis to specify fees should be done, some level of experimentation after implementing this method on-chain may be necessary.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;security&quot;&gt;Security&lt;&#x2F;h3&gt;
&lt;p&gt;All of the below struck out information should be prevented via using an access list and verifying that the read-only address provided by the client matches with an address in the access list, as well as using a layer 2 solution such as a PoA network for censorship resistance and minimization of centralization in the access list.&lt;&#x2F;p&gt;
&lt;p&gt;Further discussion is at https:&#x2F;&#x2F;ethresear.ch&#x2F;t&#x2F;incentives-for-running-full-ethereum-nodes&#x2F;1239.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Introducing in-protocol fees is a backwards-incompatible change, so would be introduced in a hard-fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;TODO&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Reduce block reward and delay difficulty bomb</title>
        <published>2018-01-29T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Carl Larson</name><email>cslarson@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/858/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/858/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:858"
            label="EIP-858" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/858/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Reduce the block reward to 1 ETH and delay the difficulty bomb.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The current public Ethereum network has a hashrate that corresponds to a tremendous level of energy consumption. As this energy consumption has a correlated environmental cost the network participants have an ethical obligation to ensure this cost is not higher than necessary. At this time, the most direct way to reduce this cost is to lower the block reward in order to limit the appeal of ETH mining. Unchecked growth in hashrate is also counterproductive from a security standpoint.
Recent research developments also now time the switch to POS as sometime in 2019 and as a result there is need to further delay the difficulty bomb so the network doesn&#x27;t grind to a halt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The current public Ethereum network has a hashrate of 296 TH&#x2F;s. This hashrate corresponds to a power usage of roughly &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;858&#x2F;assets&#x2F;calculations&#x2F;&quot;&gt;1 TW&lt;&#x2F;a&gt; and yearly energy consumption of 8.8 TWh (roughly 0.04% of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;List_of_countries_by_electricity_consumption&quot;&gt;total&lt;&#x2F;a&gt; global electricity consumption). A future switch to full Proof of Stake will solve this issue entirely. Yet that switch remains enough in the future that action should be taken in the interim to limit excess harmful side affects of the present network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Delay difficulty bomb by 2,000,000 blocks
Adjust block, uncle, and nephew rewards to reflect a new block reward of 1 ETH.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the difficulty bomb by roughly a year. The difficulty bomb remains a community supported mechanism to aid a future transition to POS.&lt;&#x2F;p&gt;
&lt;p&gt;The network hashrate provides security by reducing the likelihood that an adversary could mount a 51% attack. A static block reward means that factors (price) may be such that participation in mining grows unchecked. This growth may be counterproductive and work to also grow and potential pool of adversaries. The means we have to arrest this growth is to reduce the appeal of mining and the most direct way to do that is to reduce the block reward.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is consensus incompatible with the current public Ethereum chain and would cause a hard fork when enacted. The resulting fork would allow users to chose between two chains: a chain with a block reward of 1 ETH&#x2F;block and another with a block reward of 3 ETH&#x2F;block. This is a good choice to allow users to make. In addition, the difficulty bomb would be delayed - ensuring the network would not grind to a halt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Tests have, as yet, not been completed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;No implementation including both block reward and difficulty adjustment is currently available.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Generalized Account Versioning Scheme</title>
        <published>2017-12-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Wei Tang</name><uri>https://github.com/sorpaas</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/1702/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/sorpaas/EIPs/issues/2" />
        

        <id>https://wg-eips.ritovision.com/1702/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:1702"
            label="EIP-1702" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/1702/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce account versioning for smart contracts so upgrading the VM
or introducing new VMs can be easier.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This defines a method of hard forking while maintaining the exact
functionality of existing account by allowing multiple versions of the
virtual machines to execute in the same block. This is also useful to
define future account state structures when we introduce the on-chain
WebAssembly virtual machine.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;By allowing account versioning, we can execute different virtual
machine for contracts created at different times. This allows breaking
features to be implemented while making sure existing contracts work
as expected.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this specification might not apply to all hard forks. We
have emergency hard forks in the past due to network attacks. Whether
they should maintain existing account compatibility should be
evaluated in individual basis. If the attack can only be executed once
against some particular contracts, then the scheme defined here might
still be applicable. Otherwise, having a plain emergency hard fork
might still be a good idea.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;account-state&quot;&gt;Account State&lt;&#x2F;h3&gt;
&lt;p&gt;Re-define account state stored in the world state trie to have 5
items: &lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;, &lt;code&gt;storageRoot&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt;, and
&lt;code&gt;version&lt;&#x2F;code&gt;. The newly added field &lt;code&gt;version&lt;&#x2F;code&gt; is a 256-bit &lt;strong&gt;scalar&lt;&#x2F;strong&gt;. We
use the definition of &quot;scalar&quot; from Yellow Paper. Note that this is
the same type as &lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;balance&lt;&#x2F;code&gt;, and it is equivalent to a RLP
variable-sized byte array with no leading zero, of maximum length 32.&lt;&#x2F;p&gt;
&lt;p&gt;When &lt;code&gt;version&lt;&#x2F;code&gt; is zero, the account is RLP-encoded with the first 4
items. When &lt;code&gt;version&lt;&#x2F;code&gt; is not zero, the account is RLP-encoded with 5
items.&lt;&#x2F;p&gt;
&lt;p&gt;Account versions can also optionally define additional account state
RLP fields, whose meaning are specified through its &lt;code&gt;version&lt;&#x2F;code&gt;
field. In those cases, the parsing strategy is defined in &quot;Additional
Fields in Account State RLP&quot; section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-execution&quot;&gt;Contract Execution&lt;&#x2F;h3&gt;
&lt;p&gt;When fetching an account code from state, we always fetch the
associated version field together. We refer to this as the &lt;em&gt;code&#x27;s
version&lt;&#x2F;em&gt; below. The code of the account is always executed in the
&lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In particular, this means that for &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; and &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, the
version of the execution call frame is the same as
delegating&#x2F;receiving contract&#x27;s version.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-deployment&quot;&gt;Contract Deployment&lt;&#x2F;h3&gt;
&lt;p&gt;In Ethereum, a contract has a deployment method, either by a contract
creation transaction, or by another contract. If we regard this
deployment method a contract&#x27;s &lt;em&gt;parent&lt;&#x2F;em&gt;, then we find them forming a
family of contracts, with the &lt;em&gt;root&lt;&#x2F;em&gt; being a contract creation
transaction.&lt;&#x2F;p&gt;
&lt;p&gt;We let a family of contracts to always have the same &lt;code&gt;version&lt;&#x2F;code&gt;. That
is, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; will always deploy contract that has the
same &lt;code&gt;version&lt;&#x2F;code&gt; as the &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;In other words, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; will execute the init code
using the current &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;, and deploy the contract of the
current &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt;. This holds even if the to-be-deployed code
is empty.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;A new phrase, &lt;em&gt;validation&lt;&#x2F;em&gt; is added to contract deployment (by
&lt;code&gt;CREATE&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CREATE2&lt;&#x2F;code&gt; opcodes, or by contract creation
transaction). When &lt;code&gt;version&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt;, the phrase does nothing and
always succeeds. Future VM versions can define additional validation
that has to be passed.&lt;&#x2F;p&gt;
&lt;p&gt;If the validation phrase fails, deployment does not proceed and return
out-of-gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contract-creation-transaction&quot;&gt;Contract Creation Transaction&lt;&#x2F;h3&gt;
&lt;p&gt;Define &lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt; in a hard fork to be the latest supported VM
version. A contract creation transaction is always executed in
&lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt; (which means the &lt;em&gt;code&#x27;s version&lt;&#x2F;em&gt; is
&lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt;), and deploys contracts of &lt;code&gt;LATEST_VERSION&lt;&#x2F;code&gt;. Before a
contract creation transaction is executed, run &lt;em&gt;validation&lt;&#x2F;em&gt; on the
contract creation code. If it does not pass, return out-of-gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;precompiled-contract-and-externally-owned-address&quot;&gt;Precompiled Contract and Externally-owned Address&lt;&#x2F;h3&gt;
&lt;p&gt;Precompiled contracts and externally-owned addresses do not have
&lt;code&gt;version&lt;&#x2F;code&gt;. If a message-call transaction or &lt;code&gt;CALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; &#x2F;
&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; touches a new externally-owned address
or a non-existing precompiled contract address, it is always created
with &lt;code&gt;version&lt;&#x2F;code&gt; field being &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;additional-fields-in-account-state-rlp&quot;&gt;Additional Fields in Account State RLP&lt;&#x2F;h3&gt;
&lt;p&gt;In the future we may need to associate more information into an
account, and we already have some EIPs that define new additional
fields in the account state RLP. In this section, we define the
parsing strategy when additional fields are added.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Check the RLP list length, if it is 4, then set account version to
&lt;code&gt;0&lt;&#x2F;code&gt;, and do not parse any additional fields.&lt;&#x2F;li&gt;
&lt;li&gt;If the RLP list length more than 4, set the account version to the
scalar at position &lt;code&gt;4&lt;&#x2F;code&gt; (counting from &lt;code&gt;0&lt;&#x2F;code&gt;).
&lt;ul&gt;
&lt;li&gt;Check version specification for the number of additional fields
defined &lt;code&gt;N&lt;&#x2F;code&gt;, if the RLP list length is not equal to &lt;code&gt;5 + N&lt;&#x2F;code&gt;,
return parse error.&lt;&#x2F;li&gt;
&lt;li&gt;Parse RLP position &lt;code&gt;5&lt;&#x2F;code&gt; to &lt;code&gt;4 + N&lt;&#x2F;code&gt; as the meaning specified in
additional fields.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;extensions&quot;&gt;Extensions&lt;&#x2F;h2&gt;
&lt;p&gt;In relation to the above &quot;Specification&quot; section, we have defined the
base account versioning layer. The base account versioning layer is
already useful by itself and can handle most EVM improvements. Below
we define two specifications that can be deployed separately, which
improves functionality of base layer account versioning.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this section is provided only for documentation
purpose. When &quot;enabling EIP-1702&quot;, those extensions should not be
enabled unless the extension specification is also included.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#extensions-for-state-based-account-versioning&quot;&gt;44-VERTXN: Account Versioning Extension for Contract Creation
Transaction&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#create-and-create2-extension&quot;&gt;45-VEROP: Account Versioning Extension for CREATE and
CREATE2&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;usage-template&quot;&gt;Usage Template&lt;&#x2F;h2&gt;
&lt;p&gt;This section defines how other EIPs might use this account
versioning specification. Note that currently we only define the usage
template for base layer.&lt;&#x2F;p&gt;
&lt;p&gt;Account versioning is usually applied directly to a hard fork
meta. EIPs in the hard fork are grouped by the virtual machine
type, for example, EVM and eWASM. For each of them, we define:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Version&lt;&#x2F;strong&gt;: a non-zero scalar less than &lt;code&gt;2^256&lt;&#x2F;code&gt; that uniquely
identifies this version. Note that it does not need to be
sequential.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Parent version&lt;&#x2F;strong&gt;: the base that all new features derived
from. With parent version of &lt;code&gt;0&lt;&#x2F;code&gt; we define the base to be legacy
VM. Note that once a version other than &lt;code&gt;0&lt;&#x2F;code&gt; is defined, the legacy
VM&#x27;s feature set must be frozen. When defining an entirely new VM
(such as eWASM), parent version does not apply.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Features&lt;&#x2F;strong&gt;: all additional features that are enabled upon this
version.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If a meta EIP includes EIPs that provide additional account state RLP
fields, we also define:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Account fields&lt;&#x2F;strong&gt;: all account fields up to the end of this meta
EIP, excluding the basic 5 fields (&lt;code&gt;nonce&lt;&#x2F;code&gt;, &lt;code&gt;balance&lt;&#x2F;code&gt;,
&lt;code&gt;storageRoot&lt;&#x2F;code&gt;, &lt;code&gt;codeHash&lt;&#x2F;code&gt; and &lt;code&gt;version&lt;&#x2F;code&gt;). If EIPs included that are
specific to modifying account fields do not modify VM execution
logic, it is recommended that we specify an additional version whose
execution logic is the same as previous version, but only the
account fields are changed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This introduces account versioning via a new RLP item in account
state. The design above gets account versioning by making the contract
&lt;em&gt;family&lt;&#x2F;em&gt; always have the same version. In this way, versions are only
needed to be provided by contract creation transaction, and there is
no restrictions on formats of code for any version. If we want to
support multiple newest VMs (for example, EVM and WebAssembly running
together), then this will requires extensions such as 44-VERTXN and
45-VEROP.&lt;&#x2F;p&gt;
&lt;p&gt;Alternatively, account versioning can also be done through:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#prefix-based-account-versioning&quot;&gt;26-VER&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt; and
&lt;strong&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;forward&#x2F;&quot;&gt;40-UNUSED&lt;&#x2F;a&gt;&lt;&#x2F;strong&gt;: This makes an
account&#x27;s versioning solely dependent on its code header prefix. If
with only 26-VER, it is not possible to certify any code is valid,
because current VM allows treating code as data. This can be fixed
by 40-UNUSED, but the drawback is that it&#x27;s potentially backward
incompatible.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;EIP-1891&lt;&#x2F;strong&gt;: Instead of writing version field into account RLP
state, we write it in a separate contract. This can accomplish the
same thing as this EIP and potentially reduces code complexity, but
the drawback is that every code execution will require an additional
trie traversal, which impacts performance.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;Account versioning is fully backwards compatible, and it does not
change how current contracts are executed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;discussions&quot;&gt;Discussions&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h3&gt;
&lt;p&gt;Currently nearly all full node implementations uses config parameters
to decide which virtual machine version to use. Switching virtual
machine version is simply an operation that changes a pointer using a
different set of config parameters. As a result, this scheme has
nearly zero impact to performance.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;webassembly&quot;&gt;WebAssembly&lt;&#x2F;h3&gt;
&lt;p&gt;This scheme can also be helpful when we deploy on-chain WebAssembly
virtual machine. In that case, WASM contracts and EVM contracts can
co-exist and the execution boundary and interaction model are clearly
defined as above.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases-and-implementations&quot;&gt;Test Cases and Implementations&lt;&#x2F;h2&gt;
&lt;p&gt;To be added.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;The source of this specification can be found at
&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;corepaper.org&#x2F;ethereum&#x2F;compatibility&#x2F;versioning&#x2F;#state-based-account-versioning&quot;&gt;43-VER&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>OPCODE 0x46 BLOCKREWARD</title>
        <published>2017-08-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Cody Burns</name><email>dontPanic@codywburns.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/698/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/698" />
        

        <id>https://wg-eips.ritovision.com/698/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:698"
            label="EIP-698" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/698/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP adds an additional opcode to the EVM which will return a finalized blocks reward value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;In the EVM, the 0x40 opcodes are reserved for &lt;code&gt;Block Information&lt;&#x2F;code&gt;. Currently reserved opcodes are:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;0X40 BLOCKHASH&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X41 COINBASE&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X42 TIMESTAMP&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X43 NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X44 DIFFICULTY&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;0X45 GASLIMIT&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This EIP would add an additional opcode, &lt;code&gt;0x46 BLOCKREWARD&lt;&#x2F;code&gt;, which would return the block reward for any finalized block. The finalized block reward would include the base reward, uncle payments, and gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Per EIP-649 ( #669 ) periodic block reward reductions&#x2F;variance are now planned in the roadmap, however, this EIP is consensus system agnostic and is most useful in decentralized pool operations and for any contract that benefits from knowing a block reward payout(i.e. Merge mined tokens)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;After block &lt;code&gt;n&lt;&#x2F;code&gt; all clients should process opcode &lt;code&gt;0x46&lt;&#x2F;code&gt; as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Value: &lt;code&gt;0x46&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Mnemonic: &lt;code&gt;BLOCKREWARD&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;δ:&lt;code&gt; 0&lt;&#x2F;code&gt; nothing removed from stack&lt;&#x2F;li&gt;
&lt;li&gt;α:&lt;code&gt;1&lt;&#x2F;code&gt; block reward added to stack&lt;&#x2F;li&gt;
&lt;li&gt;Description: &lt;code&gt;Get the block&#x27;s reward emission&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;GasCost: &lt;code&gt;G&amp;lt;sub&amp;gt;base&amp;lt;&#x2F;sub&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Where:&lt;code&gt;µ&#x27;&amp;lt;sub&amp;gt;s&amp;lt;&#x2F;sub&amp;gt;[0] ≡ I&amp;lt;sub&amp;gt;HR&amp;lt;&#x2F;sub&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;contract-mining-pools&quot;&gt;Contract Mining Pools&lt;&#x2F;h3&gt;
&lt;p&gt;For distributed consensus systems(staking pools and mining pools) ad hoc groups combine resources in order to reduce variance in payouts. Broadly, pool operations function by allowing a collective of  miners &#x2F; stakers  to verify their contribution to solving PoW or staking share by periodically submitting solutions which are representative of the miners probability of finding a true block.&lt;&#x2F;p&gt;
&lt;p&gt;In all these schemes &lt;code&gt;B&lt;&#x2F;code&gt; stands for a block reward minus pool fee and &lt;code&gt;p&lt;&#x2F;code&gt; is a probability of finding a block in a share attempt ( &lt;code&gt;p=1&#x2F;D&lt;&#x2F;code&gt;, where &lt;code&gt;D&lt;&#x2F;code&gt; is current block difficulty).&lt;&#x2F;p&gt;
&lt;p&gt;Some common methods of mining pool payout are pay-per-share, &lt;code&gt;R = B * p&lt;&#x2F;code&gt;, proportional [&lt;code&gt;R = B * (n&#x2F;N)&lt;&#x2F;code&gt; where &lt;code&gt;n&lt;&#x2F;code&gt; is amount of a miners shares, and &lt;code&gt;N&lt;&#x2F;code&gt; is amount of all shares in this round.], and pay-per-last-N-shares [&lt;code&gt;R = B * (n&#x2F;N)&lt;&#x2F;code&gt; where miner&#x27;s reward is calculated on a basis of &lt;code&gt;N&lt;&#x2F;code&gt; last shares, instead of all shares for the last round]. All of these methods are predicated on knowing the block reward paid for a given block. In order to provide a trust minimized solution, &lt;code&gt;0x46&lt;&#x2F;code&gt; can be used to call a blocks reward for computing payouts.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;merge-mined-tokens&quot;&gt;Merge mined tokens&lt;&#x2F;h3&gt;
&lt;p&gt;Contracts could create tokens which could be variably ‘minted’ as a function of block reward by calling &lt;code&gt;0x46&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;currently-deployed-contracts&quot;&gt;Currently deployed contracts&lt;&#x2F;h3&gt;
&lt;p&gt;No impact&lt;&#x2F;p&gt;
&lt;h3 id=&quot;current-clients&quot;&gt;Current clients&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP would be incompatible with currently deployed clients that are not able to handle &lt;code&gt;0x46&lt;&#x2F;code&gt; and would process all transactions and block containing the opcode as invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Implementation should occur as part of a coordinated hardfork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;further-reading&quot;&gt;Further reading&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Mining_pool&quot;&gt;Mining Pools&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The Yellow Paper Appendix H. Virtual Machine Specification section H.2&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Address Collision of Contract Address Causes Exceptional Halt</title>
        <published>2017-08-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Yoichi Hirai</name><email>i@yoichihirai.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/689/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/689/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:689"
            label="EIP-689" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/689/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP proposes to make contract creation fail on an account with nonempty code or non-zero nonce.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Some test cases in the consensus test suite try to deploy a contract at an address already with nonempty code. Although such cases can virtually never happen on the main network before the Constantinople fork block, the test cases detected discrepancies in clients&#x27; behavior.  Currently, the Yellow Paper says that the contract creation starts with the empty code and the initial nonce even in the case of address collisions. To simplify the semantics, this EIP proposes that address collisions cause failures of contract creation.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP has no practical relevance to the main net history, but simplifies testing and reasoning.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP has no effects after Constantinople fork because &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;86&#x2F;&quot;&gt;EIP-86&lt;&#x2F;a&gt; contains the changes proposed in this EIP. Even before the Constantinople fork, this EIP has no practical relevance because the change is visible only in case of a hash collision of keccak256.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding testing, this EIP relieves clients from supporting reversion of code overwriting.&lt;&#x2F;p&gt;
&lt;p&gt;Regarding reasoning, this EIP establishes an invariant that non-empty code is never modified.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= 0&lt;&#x2F;code&gt;, when a contract creation is on an account with non-zero nonce or non-empty code, the creation fails as if init code execution resulted in an exceptional halt.  This applies to contract creation triggered by a contract creation transaction and by CREATE instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;It seems impractical to implement never-used features just for passing tests.  Client implementations will be simpler with this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is backwards compatible on the main network.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;At least the BlockchainTest called &lt;code&gt;createJS\_ExampleContract\_d0g0v0\_EIP158&lt;&#x2F;code&gt; will distinguish clients that implement this EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SWAPN, DUPN and EXCHANGE instructions</title>
        <published>2017-07-03T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Charles Cooper</name><uri>https://github.com/charles-cooper</uri>
	</author>
	
	<author>
		<name>Danno Ferrin</name><uri>https://github.com/shemnon</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/663/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-663-unlimited-swap-and-dup-instructions/3346" />
        

        <id>https://wg-eips.ritovision.com/663/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:663"
            label="EIP-663" />
        

        
        

        
        <summary type="html">Introduce additional instructions for manipulating the stack which allow accessing the stack at higher depths</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/663/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, &lt;code&gt;SWAP*&lt;&#x2F;code&gt; and &lt;code&gt;DUP*&lt;&#x2F;code&gt; instructions are limited to a stack depth of 16. Introduce three new instructions, &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; which lift this limitation and allow accessing the stack at higher depths.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;While the stack is 1024 items deep, easy access is only possible for the top 16 items. Supporting more local variables is possible via manually keeping them in memory or through a &quot;stack to memory elevation&quot; in a compiler. This can result in complex and inefficient code.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, implementing higher level constructs, such as functions, on top of EVM will result in a list of input and output parameters as well as an instruction offset to return to.&lt;&#x2F;p&gt;
&lt;p&gt;The number of these arguments (or stack items) can easily exceed 16 and thus will require extra care from a compiler to lay them out in a way that all of them are still accessible.&lt;&#x2F;p&gt;
&lt;p&gt;Lastly, swapping items besides the 1st and Nth items in the stack is very important for compilers implementing stack scheduling algorithms (the analog of register allocation for stack machines), which try to minimize stack traffic given a set of variables and usage analysis.&lt;&#x2F;p&gt;
&lt;p&gt;Introducing &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; will provide an option to compilers to simplify accessing deep stack items.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We introduce three new instructions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt; (&lt;code&gt;0xe6&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt; (&lt;code&gt;0xe7&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; (&lt;code&gt;0xe8&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If the code is legacy bytecode, any of these instructions result in an &lt;em&gt;exceptional halt&lt;&#x2F;em&gt;. (&lt;em&gt;Note: This means no change to behaviour.&lt;&#x2F;em&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;If the code is valid EOF1, the following rules apply:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The instructions are followed by an 8-bit immediate value, which we call &lt;code&gt;imm&lt;&#x2F;code&gt;, and can have a value of 0 to 255.
&lt;ol&gt;
&lt;li&gt;In the case of &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, we introduce the variable &lt;code&gt;n&lt;&#x2F;code&gt; which equals to &lt;code&gt;imm + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;In the case of &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, we introduce the variable &lt;code&gt;n&lt;&#x2F;code&gt; which is equal to &lt;code&gt;(imm &amp;gt;&amp;gt; 4) + 1&lt;&#x2F;code&gt;, and the variable &lt;code&gt;m&lt;&#x2F;code&gt; which is equal to &lt;code&gt;(imm &amp;amp; 0x0F) + 1&lt;&#x2F;code&gt; (i.e., the first and second nibbles of &lt;code&gt;imm&lt;&#x2F;code&gt;, converted to one-indexing).&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Code validation is extended to check that no relative jump instruction (&lt;code&gt;RJUMP&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPI&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;RJUMPV&lt;&#x2F;code&gt;) targets immediate values of &lt;code&gt;DUPN&lt;&#x2F;code&gt;, &lt;code&gt;SWAPN&lt;&#x2F;code&gt; or &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The stack validation algorithm of &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;5450&#x2F;&quot;&gt;EIP-5450&lt;&#x2F;a&gt; is extended:
&lt;ol&gt;
&lt;li&gt;Before &lt;code&gt;DUPN&lt;&#x2F;code&gt; if the current stack height is less than &lt;code&gt;n&lt;&#x2F;code&gt;, code is invalid. After &lt;code&gt;DUPN&lt;&#x2F;code&gt;, the stack height is incremented.&lt;&#x2F;li&gt;
&lt;li&gt;Before &lt;code&gt;SWAPN&lt;&#x2F;code&gt; if the current stack height is less than &lt;code&gt;n + 1&lt;&#x2F;code&gt;, code is invalid. After &lt;code&gt;SWAPN&lt;&#x2F;code&gt;, the stack height is unchanged.&lt;&#x2F;li&gt;
&lt;li&gt;Before &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; if the current stack height is less than &lt;code&gt;n + m + 1&lt;&#x2F;code&gt;, code is invalid. After &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, the stack height is unchanged.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;Execution rules:
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;DUPN&lt;&#x2F;code&gt;: the &lt;code&gt;n&lt;&#x2F;code&gt;&#x27;th stack item is duplicated at the top of the stack. (&lt;em&gt;Note: We use 1-based indexing here.&lt;&#x2F;em&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN&lt;&#x2F;code&gt;: the &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the top of the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;: the &lt;code&gt;n + 1&lt;&#x2F;code&gt;&#x27;th stack item is swapped with the &lt;code&gt;n + m + 1&lt;&#x2F;code&gt;&#x27;th stack item.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The gas cost for all three instructions is set at 3.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;use-of-an-immediate-argument&quot;&gt;Use of an immediate argument&lt;&#x2F;h3&gt;
&lt;p&gt;Allowing dynamic selection of the arguments to swap, dup, or exchange could be used to prevent static analysis of the contents of the stack. Since static analysis is an important tool for security auditors we want to do what we can to make their jobs easier. Hence, the operands require an immediate argument that is not dynamic in nature.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;eof-only&quot;&gt;EOF-only&lt;&#x2F;h3&gt;
&lt;p&gt;Since this instruction depends on an immediate argument encoding, it can only be enabled within EOF. In legacy bytecode that encoding could contradict jumpdest-analysis.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;size-of-immediate-argument&quot;&gt;Size of immediate argument&lt;&#x2F;h3&gt;
&lt;p&gt;For &lt;code&gt;DUPN&lt;&#x2F;code&gt; and &lt;code&gt;SWAPN&lt;&#x2F;code&gt; a 16-bit size was considered to accommodate the full stack space of 1024 items, however:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;that would require an additional restriction&#x2F;check (&lt;code&gt;n &amp;lt; 1024&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;the 256 depth is a large improvement over the current 16 and the overhead of an extra byte would make it less useful&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Similarly for &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt;, the proposed scheme allows addressing of 32 items.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-cost&quot;&gt;Gas cost&lt;&#x2F;h3&gt;
&lt;p&gt;The gas cost for these operations is the same as for existing &lt;code&gt;DUP*&lt;&#x2F;code&gt; and &lt;code&gt;SWAP*&lt;&#x2F;code&gt; instructions, because they are just implemented as pointer swaps.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exchange-vs-swapn&quot;&gt;&lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; vs &lt;code&gt;SWAPN&lt;&#x2F;code&gt;&lt;&#x2F;h3&gt;
&lt;p&gt;As mentioned before, &lt;code&gt;EXCHANGE&lt;&#x2F;code&gt; is important to compilers implementing stack scheduling algorithms. Specifically, in the case that a stack item is scheduled to be consumed deeper in the stack (for instance, the 3rd item in the stack needs to be moved into 2nd position in order to be consumed by the next operation), that currently takes three instructions, &lt;code&gt;SWAP2 SWAP3 SWAP2&lt;&#x2F;code&gt;. However, in the EVM implementation, the implementation is just a pointer swap, so it could be implemented in a single instruction at no extra runtime cost to the client.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This has no effect on backwards compatibility because the opcodes were not previously allocated and the feature is only enabled in EOF.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Given &lt;code&gt;stack[]&lt;&#x2F;code&gt; is a 0-based data structure, and &lt;code&gt;n&lt;&#x2F;code&gt;, &lt;code&gt;m&lt;&#x2F;code&gt; and &lt;code&gt;imm&lt;&#x2F;code&gt; are defined as according to the spec:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt; to fail validation if &lt;code&gt;stack_height &amp;lt; n&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN imm&lt;&#x2F;code&gt; to fail validation if &lt;code&gt;stack_height &amp;lt; n + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE imm&lt;&#x2F;code&gt; to fail validation if &lt;code&gt;stack_height &amp;lt; n + m + 1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt; to increment maximum stack height of a function. Validation fails if maximum stack height exceeds limit of 1023.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt;, &lt;code&gt;SWAPN imm&lt;&#x2F;code&gt;, and &lt;code&gt;EXCHANGE imm&lt;&#x2F;code&gt; to fail at run-time if gas available is less than 3.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DUPN imm&lt;&#x2F;code&gt; should duplicate the &lt;code&gt;stack[n - 1]&lt;&#x2F;code&gt; item and push it to the stack&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SWAPN imm&lt;&#x2F;code&gt; should swap &lt;code&gt;stack[n]&lt;&#x2F;code&gt; with &lt;code&gt;stack[stack.top()]&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;EXCHANGE imm&lt;&#x2F;code&gt; should swap &lt;code&gt;stack[n]&lt;&#x2F;code&gt; with &lt;code&gt;stack[n + m]&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;security-considerations&quot;&gt;Security Considerations&lt;&#x2F;h2&gt;
&lt;p&gt;The authors are not aware of any additional risks introduced here. The EVM stack is fixed at 1024 items and most implementations keep that in memory at all times. This change will increase the number of stack items accessible via single instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Embedding transaction status code in receipts</title>
        <published>2017-06-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Nick Johnson</name><email>nick@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/658/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/658/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:658"
            label="EIP-658" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/658/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP replaces the intermediate state root field of the receipt with a status code indicating if the top-level call succeeded or failed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;With the introduction of the REVERT opcode in EIP140, it is no longer possible for users to assume that a transaction failed iff it consumed all gas. As a result, there is no clear mechanism for callers to determine whether a transaction succeeded and the state changes contained in it were applied.&lt;&#x2F;p&gt;
&lt;p&gt;Full nodes can provide RPCs to get a transaction return status and value by replaying the transaction, but fast nodes can only do this for nodes after their pivot point, and light nodes cannot do this at all, making a non-consensus solution impractical.&lt;&#x2F;p&gt;
&lt;p&gt;Instead, we propose to replace the intermediate state root, already obsoleted by EIP98, with the return status (1 for success, 0 for failure). This both allows callers to determine success status, and remedies the previous omission of return data from the receipt.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For blocks where block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM, the intermediate state root is replaced by a status code, 0 indicating failure (due to any operation that can cause the transaction or top-level call to revert) and 1 indicating success.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This constitutes a minimal possible change that permits fetching the success&#x2F;failure state of transactions, preserving existing capabilities with minimum disruption or additional work for Metropolis.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Metropolis Difficulty Bomb Delay and Block Reward Reduction</title>
        <published>2017-06-21T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Afri Schoedon</name><uri>https://github.com/5chdn</uri>
	</author>
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/649/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/649" />
        

        <id>https://wg-eips.ritovision.com/649/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:649"
            label="EIP-649" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/649/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The average block times are increasing due to the difficulty bomb (also known as the &quot;&lt;em&gt;ice age&lt;&#x2F;em&gt;&quot;) slowly accelerating. This EIP proposes to delay the difficulty bomb for approximately one and a half year and to reduce the block rewards with the Byzantium fork, the first part of the Metropolis fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Starting with &lt;code&gt;BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt; the client will calculate the difficulty based on a fake block number suggesting the client that the difficulty bomb is adjusting around 3 million blocks later than previously specified with the Homestead fork. Furthermore, block rewards will be adjusted to a base of 3 ETH, uncle and nephew rewards will be adjusted accordingly.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The Casper development and switch to proof-of-stake is delayed, the Ethash proof-of-work should be feasible for miners and allow sealing new blocks every 15 seconds on average for another one and a half years. With the delay of the ice age, there is a desire to not suddenly also increase miner rewards. The difficulty bomb has been known about for a long time and now it&#x27;s going to stop from happening. In order to maintain stability of the system, a block reward reduction that offsets the ice age delay would leave the system in the same general state as before. Reducing the reward also decreases the likelihood of a miner driven chain split as Ethereum approaches proof-of-stake.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;relax-difficulty-with-fake-block-number&quot;&gt;Relax Difficulty with Fake Block Number&lt;&#x2F;h4&gt;
&lt;p&gt;For the purposes of &lt;code&gt;calc_difficulty&lt;&#x2F;code&gt;, simply replace the use of &lt;code&gt;block.number&lt;&#x2F;code&gt;, as used in the exponential ice age component, with the formula:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fake_block_number = max(0, block.number - 3_000_000) if block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM else block.number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;adjust-block-uncle-and-nephew-rewards&quot;&gt;Adjust Block, Uncle, and Nephew rewards&lt;&#x2F;h4&gt;
&lt;p&gt;To ensure a constant Ether issuance, adjust the block reward to &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;, where&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_block_reward = 3_000_000_000_000_000_000 if block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM else block.reward&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;(3E18 wei, or 3,000,000,000,000,000,000 wei, or 3 ETH).&lt;&#x2F;p&gt;
&lt;p&gt;Analogue, if an uncle is included in a block for &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt; such that &lt;code&gt;block.number - uncle.number = k&lt;&#x2F;code&gt;, the uncle reward is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_uncle_reward = (8 - k) * new_block_reward &#x2F; 8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Metropolis formula for uncle rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The nephew reward for &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt; is&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;new_nephew_reward = new_block_reward &#x2F; 32&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is the existing pre-Metropolis formula for nephew rewards, simply adjusted with &lt;code&gt;new_block_reward&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This will delay the ice age by 42 million seconds (approximately 1.4 years), so the chain would be back at 30 second block times at the end of 2018. An alternate proposal was to add special rules to the difficulty calculation to effectively &lt;em&gt;pause&lt;&#x2F;em&gt; the difficulty between different blocks. This would lead to similar results.&lt;&#x2F;p&gt;
&lt;p&gt;This was previously discussed at All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%209.md#metropolis-timing-and-roadmap-discussion&quot;&gt;#09&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2012.md#5-metropolis-update&quot;&gt;#12&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2013.md#3-eip-186-reduce-eth-issuance-before-proof-of-stake-hudson&quot;&gt;#13&lt;&#x2F;a&gt;, and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2014.md#1-eip-186-reduce-eth-issuance-before-proof-of-stake-core-devs&quot;&gt;#14&lt;&#x2F;a&gt;. Consensus on the specification was achieved in All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2019.md&quot;&gt;#19&lt;&#x2F;a&gt; and specification drafted in EIP issue &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;649&quot;&gt;#649&lt;&#x2F;a&gt;. It was decided to replace EIP &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;186&quot;&gt;#186&lt;&#x2F;a&gt; and include the block reward reduction along with the difficulty bomb delay in All Core Devs Meeting &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2020.md&quot;&gt;#20&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2021.md&quot;&gt;#21&lt;&#x2F;a&gt;; accepted in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pm&#x2F;blob&#x2F;master&#x2F;AllCoreDevs-EL-Meetings&#x2F;Meeting%2022.md&quot;&gt;#22&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP is not forward compatible and introduces backwards incompatibilities in the difficulty calculation, as well as the block, uncle and nephew reward structure. Therefore, it should be included in a scheduled hardfork at a certain block number. It&#x27;s suggested to include this EIP in the first of the two Metropolis hard-forks, the &lt;em&gt;Byzantium&lt;&#x2F;em&gt; fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Test cases exist in ethereum&#x2F;tests &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;pull&#x2F;269&quot;&gt;#269&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The following clients implemented EIP-649:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Geth &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;pull&#x2F;15028&quot;&gt;#15028&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Parity &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;paritytech&#x2F;parity&#x2F;pull&#x2F;5855&quot;&gt;#5855&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;EthereumJ &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ethereumj&#x2F;pull&#x2F;927&quot;&gt;#927&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Cpp-Ethereum &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;cpp-ethereum&#x2F;issues&#x2F;4050&quot;&gt;#4050&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;PyEthereum &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;pull&#x2F;383&quot;&gt;#383&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The Yellow Paper implements EIP-649 in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;yellowpaper&#x2F;pull&#x2F;333&quot;&gt;#333&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Other notable implementations:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Eth-Isabelle &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pirapira&#x2F;eth-isabelle&#x2F;issues&#x2F;459&quot;&gt;#459&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Py-EVM &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py-evm&#x2F;pull&#x2F;123&quot;&gt;#123&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>SIMD Operations for the EVM</title>
        <published>2017-04-25T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/616/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/616/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:616"
            label="EIP-616" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/616/">&lt;h2 id=&quot;abstract&quot;&gt;ABSTRACT&lt;&#x2F;h2&gt;
&lt;p&gt;A proposal to provide Single Instruction Multiple Data types and operations for the Ethereum Virtual Machine, making full use of the 256-bit wide EVM stack items, and offering substantial performance gains for both vector and scalar operations.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;MOTIVATION&lt;&#x2F;h2&gt;
&lt;p&gt;Most all modern CPUs include SIMD hardware that operates on wide registers of data, applying a Single Instruction to Multiple Data lanes in parallel, where lanes divide a register into a vector of scalar elements of equal size.  This model is an excellent fit for the wide stack items of the EVM, offering substantial performance boosts for operations that can be expressed as parallel operations on vectors of scalars.  For some examples, a brief literature search finds SIMD speedups of&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;up to 7X for &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;keccak.noekeon.org&#x2F;sw_performance.html&quot;&gt;SHA-512&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;4X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;link.springer.com&#x2F;chapter&#x2F;10.1007&#x2F;3-540-45439-X_16&quot;&gt;elliptic curve scalar multiplication&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;3X to 4X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;minio&#x2F;blake2b-simd&quot;&gt;BLAKE2b&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;up to 3X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;software.intel.com&#x2F;en-us&#x2F;articles&#x2F;improving-openssl-performance&quot;&gt;OpenSSL&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;2X to 3X for &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;ieee-hpec.org&#x2F;2013&#x2F;index_htm_files&#x2F;24-Simd-acceleration-Pabbuleti-2886999.pdf&quot;&gt;elliptic curve modular multiplication&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;1.7X to 1.9X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;minio&#x2F;sha256-simd&quot;&gt;SHA-256&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;1.3X for &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;citeseerx.ist.psu.edu&#x2F;viewdoc&#x2F;download?doi=10.1.1.738.1218&amp;amp;rep=rep1&amp;amp;type=pdf&quot;&gt;RSA encryption&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;SPECIFICATION&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;We propose a simple encoding of SIMD operations as extended two-byte codes.  The first byte is the opcode, and the second byte is the SIMD type: scalar type, lane width, and number of elements.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;N bits&lt;&#x2F;th&gt;&lt;th&gt;Field&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;opcode&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;scalar type: 0 = unsigned integer, 1 = IEEE float&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;reserved: 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;lane width: log base 2 of the number of bytes, as an MSB first integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;reserved: 0&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;element count: log base 2 of the number of lanes, as an MSB first integer&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Thus we can specify SIMD types with unsigned integer lanes from 8 to 64 bits in vectors of 32 to 2 lanes, respectively.  Floating point lanes however support only 32- and 64-bit IEEE floating point.  And a type of &lt;em&gt;0x7F&lt;&#x2F;em&gt; represents a normal 256-bit EVM integer.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note that when the element count is one the operation is on one scalar, so this specification also provides for native operations on single scalars of native sizes.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note that floating point operations are &lt;strong&gt;not&lt;&#x2F;strong&gt; proposed for inclusion in the initial release, but we considered it important to reserve code space for possible future expansion.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;We define the following extended versions of the EVM&#x27;s arithmetic, logic, and comparison operations.  As with the normal versions, they consume their arguments from the stack and place their results on the stack, except that their arguments are vectors rather than scalars.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;lo\hi&lt;&#x2F;th&gt;&lt;th&gt;B&lt;&#x2F;th&gt;&lt;th&gt;C&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XLT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;XADD&lt;&#x2F;td&gt;&lt;td&gt;XGT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;XMUL&lt;&#x2F;td&gt;&lt;td&gt;XSLT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;XSUB&lt;&#x2F;td&gt;&lt;td&gt;XSGT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;XDIV&lt;&#x2F;td&gt;&lt;td&gt;XEQ&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;XSDIV&lt;&#x2F;td&gt;&lt;td&gt;XISZERO&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;6&lt;&#x2F;td&gt;&lt;td&gt;XMOD&lt;&#x2F;td&gt;&lt;td&gt;XAND&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;7&lt;&#x2F;td&gt;&lt;td&gt;XSMOD&lt;&#x2F;td&gt;&lt;td&gt;XOR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;8&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XXOR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;9&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XNOT&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;A&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XINDEX&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;B&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XSHL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;C&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XSHR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;D&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;XSAR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;E&lt;&#x2F;td&gt;&lt;td&gt;XCAST&lt;&#x2F;td&gt;&lt;td&gt;XROL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;F&lt;&#x2F;td&gt;&lt;td&gt;XSHUFFLE&lt;&#x2F;td&gt;&lt;td&gt;XROR&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Except for XSHUFFLE, XCAST, and XINDEX all the extended operations on unsigned integer values have the same semantics as the corresponding operations for codes 01 through 1F, except that the modulus varies by scalar type and the operations are applied pair-wise to the elements of the source operands to compute the destination elements.  &lt;em&gt;The source operands must have the same element type and number of elements.&lt;&#x2F;em&gt;  E.g.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint8[1, 2, 3]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint8[4, 5, 6]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;XADD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;leaves&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint8[5, 7, 9]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;on the stack.&lt;&#x2F;p&gt;
&lt;p&gt;XSHUFFLE takes two vectors on the stack: a vector to permute and a permutation mask.  E.g.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint64[4, 5, 6, 0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH uint8[2, 0, 1, 3]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHUFFLE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;leaves&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;uint64[6, 4, 5 , 0]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;on the stack. The mask must have integral type, and the same number of elements as the source vector.&lt;&#x2F;p&gt;
&lt;p&gt;The second byte of the XCAST opcode is applied to the item on the stack to create a new vector of the specified type.  Elements are converted according to the usual C conventions, missing elements are set to zero, and extra elements are discarded.  If the stack item is not a vector it is converted to a vector by taking its bits least-significant-bit first and copying them into the corresponding bits of each element, least-significant-element first.  Again, excess data is truncated and missing data is 0-filled.  Vectors are converted to 256-bit EVM integers via the reverse process., with elements that are floating point NANs normalized to all bits on.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note that MLOAD and MSTORE are valid only on 256-bit EVM integers.  For SIMD vectors an XCAST is needed after a load and before a store to convert vectors to and from 256-bit integers.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;XINDEX has the same semantics as BYTE, except that individual elements of the vector are indexed.&lt;&#x2F;p&gt;
&lt;p&gt;Floating point values follow IEEE 754 semantics.  Since those are not defined for shifting and rotating those operations are defined here as having no effect.&lt;&#x2F;p&gt;
&lt;p&gt;Extended operations other than XSHUFFLE and XCAST are only valid on vectors of the same SIMD type.  This can be validated at contract creation time, or else checked at runtime.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;subroutines&quot;&gt;Subroutines&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;187&quot;&gt;EIP-187&lt;&#x2F;a&gt; is accepted a type-safe syntax for declaring subroutines taking vector arguments will be needed.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;BEGINSUBX n_args, arg_types... n_results, result_types...&lt;&#x2F;code&gt;
marks the &lt;strong&gt;single&lt;&#x2F;strong&gt; entry to a subroutine.  &lt;code&gt;n_args&lt;&#x2F;code&gt; items are taken off of the stack at entry to, and &lt;code&gt;n_results&lt;&#x2F;code&gt; items are placed on the stack at return from the subroutine. &lt;code&gt;n_args&lt;&#x2F;code&gt; and &lt;code&gt;n_results&lt;&#x2F;code&gt; are given as one immediate byte each.  The &lt;code&gt;arg_types&lt;&#x2F;code&gt; and &lt;code&gt;result_types&lt;&#x2F;code&gt; are given in the same encoding as second byte of the SIMD opcodes, and must match the values on the stack.  The bytecode for a subroutine ends at the next &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;, &lt;code&gt;BEGINSUBX&lt;&#x2F;code&gt; or &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; instruction or at the end of the bytecode.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;RATIONALE&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, the lowest common denominator for SIMD hardware (e.g. Intel SSE2 and ARM Neon) is 16-byte registers supporting integer lanes of 1, 2, 4, and 8 bytes, and floating point lanes of 4 and 8 bytes.  More recent SIMD hardware (e.g. Intel AVX) supports 32-byte registers, and EVM stack items are also 32 bytes wide.  The limits above derive from these numbers, assuring that EVM code is within the bounds of available hardware - and the reserved bits provide room for growth.&lt;&#x2F;p&gt;
&lt;p&gt;For most modern languages (including Rust, Python, Go, Java, and C++) compilers can do a good job of generating SIMD code for parallelizable loops, and&#x2F;or there are intrinsics or libraries available for explicit access to SIMD hardware.  So a portable software implementation will likely provide good use of the hardware on most platforms, and intrinsics or libraries can be used as available and needed.  Thus we can expect these operations to take about the same (or for 256-bit vectors on 128-bit hardware up to twice) the time to execute regardless of element size or number of elements.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas&quot;&gt;Gas&lt;&#x2F;h3&gt;
&lt;p&gt;One motivation for these operations, besides taking full advantage of the hardware, is assigning lower gas costs for operations on smaller scalars.&lt;&#x2F;p&gt;
&lt;p&gt;On a machine with 64-bit registers the standard algorithms from Knuth&#x27;s &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;library.aceondo.net&#x2F;ebooks&#x2F;Computer_Science&#x2F;algorithm-the_art_of_computer_programming-knuth.pdf&quot;&gt;Art of Computer Programming&lt;&#x2F;a&gt; require 32-bit digits, using the upper half of a register for overflows, so for 256-bit values N=8 digits are needed, and for 64-bit values N=2 digits are needed.  The cycle counts for these algorithms are:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;operation&lt;&#x2F;th&gt;&lt;th&gt;cycles&lt;&#x2F;th&gt;&lt;th&gt;N = 2&lt;&#x2F;th&gt;&lt;th&gt;N = 4&lt;&#x2F;th&gt;&lt;th&gt;N = 8&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;add&lt;&#x2F;td&gt;&lt;td&gt;10 &lt;em&gt;N&lt;&#x2F;em&gt; + 6&lt;&#x2F;td&gt;&lt;td&gt;26&lt;&#x2F;td&gt;&lt;td&gt;46&lt;&#x2F;td&gt;&lt;td&gt;86&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;subtract&lt;&#x2F;td&gt;&lt;td&gt;12 &lt;em&gt;N&lt;&#x2F;em&gt; + 3&lt;&#x2F;td&gt;&lt;td&gt;27&lt;&#x2F;td&gt;&lt;td&gt;51&lt;&#x2F;td&gt;&lt;td&gt;99&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;multiply&lt;&#x2F;td&gt;&lt;td&gt;28 &lt;em&gt;N&lt;&#x2F;em&gt;**2 + 11 &lt;em&gt;N&lt;&#x2F;em&gt; + 3&lt;&#x2F;td&gt;&lt;td&gt;137&lt;&#x2F;td&gt;&lt;td&gt;495&lt;&#x2F;td&gt;&lt;td&gt;1883&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;divide&lt;&#x2F;td&gt;&lt;td&gt;15 &lt;em&gt;N&lt;&#x2F;em&gt;**2 + 119 &lt;em&gt;N&lt;&#x2F;em&gt; + 111&lt;&#x2F;td&gt;&lt;td&gt;409&lt;&#x2F;td&gt;&lt;td&gt;827&lt;&#x2F;td&gt;&lt;td&gt;2023&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;The remaining operations are of about the same complexity as addition and subtraction, or less. Given that JUMPDEST is a no-op, and is assigned a gas price of 1, this can be taken as the overhead of the interpreter.  All of the arithmetic operations are assigned the same gas price of 5, for a remaining runtime of 4.  The interpreter loop itself takes about 6 to 8 C instructions, so ADD and SUB are reasonably priced, but MUL is some 5 to 21 times slower than ADD or SUB, and DIV is some 15 to 23 times slower, so they are clearly mispriced.&lt;&#x2F;p&gt;
&lt;p&gt;By comparison, on most &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;software.intel.com&#x2F;sites&#x2F;landingpage&#x2F;IntrinsicsGuide&quot;&gt;Intel&lt;&#x2F;a&gt; and &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;developer.arm.com&#x2F;docs&#x2F;100166&#x2F;latest&#x2F;programmers-model&#x2F;instruction-set-summary&#x2F;table-of-processor-instructions&quot;&gt;ARM&lt;&#x2F;a&gt; SIMD units instructions take approximately the following cycle counts, independent of register width.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;operation&lt;&#x2F;th&gt;&lt;th&gt;Intel cycles&lt;&#x2F;th&gt;&lt;th&gt;ARM cycles&lt;&#x2F;th&gt;&lt;th&gt;gas&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;add&lt;&#x2F;td&gt;&lt;td&gt;.5&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;subtract&lt;&#x2F;td&gt;&lt;td&gt;.5&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;multiply&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;divide&lt;&#x2F;td&gt;&lt;td&gt;10&lt;&#x2F;td&gt;&lt;td&gt;12&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Since all but the divide operation take fewer cycles than the interpreter overhead they are assigned the minimal cost of 1.  Division takes slightly more, and is assigned a cost of 2.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Clique proof-of-authority consensus protocol</title>
        <published>2017-03-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Péter Szilágyi</name><email>peterke@gmail.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/225/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/225" />
        

        <id>https://wg-eips.ritovision.com/225/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:225"
            label="EIP-225" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/225/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Clique is a proof-of-authority consensus protocol. It shadows the design of Ethereum mainnet, so it can be added to any client with minimal effort.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Ethereum&#x27;s first official testnet was Morden. It ran from July 2015 to about November 2016, when due to the accumulated junk and some testnet consensus issues between Geth and Parity, it was finally laid to rest in favor of a testnet reboot.&lt;&#x2F;p&gt;
&lt;p&gt;Ropsten was thus born, clearing out all the junk and starting with a clean slate. This ran well until the end of February 2017, when malicious actors decided to abuse the low PoW and gradually inflate the block gas limits to 9 billion (from the normal 4.7 million), at which point sending in gigantic transactions crippling the entire network. Even before that, attackers attempted multiple extremely long reorgs, causing network splits between different clients, and even different versions.&lt;&#x2F;p&gt;
&lt;p&gt;The root cause of these attacks is that a PoW network is only as secure as the computing capacity placed behind it. Restarting a new testnet from zero wouldn&#x27;t solve anything, since the attacker can mount the same attack over and over again. The Parity team decided to go with an emergency solution of rolling back a significant number of blocks, and enacting a soft-fork rule that disallows gas limits above a certain threshold.&lt;&#x2F;p&gt;
&lt;p&gt;While this solution may work in the short term:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;It&#x27;s not elegant: Ethereum supposed to have dynamic block limits&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s not portable: other clients need to implement new fork logic themselves&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s not compatible with sync modes: fast and light clients are both out of luck&lt;&#x2F;li&gt;
&lt;li&gt;It&#x27;s just prolonging the attacks: junk can still be steadily pushed in ad infinitum&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Parity&#x27;s solution although not perfect, is nonetheless workable. I&#x27;d like to propose a longer term alternative solution, which is more involved, yet should be simple enough to allow rolling out in a reasonable amount of time.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;standardized-proof-of-authority&quot;&gt;Standardized proof-of-authority&lt;&#x2F;h3&gt;
&lt;p&gt;As reasoned above, proof-of-work cannot work securely in a network with no value. Ethereum has its long term goal of proof-of-stake based on Casper, but that is heavy research so we cannot rely on that any time soon to fix today&#x27;s problems. One solution however is easy enough to implement, yet effective enough to fix the testnet properly, namely a proof-of-authority scheme.&lt;&#x2F;p&gt;
&lt;p&gt;The main design goals of the PoA protocol described here is that it should be very simple to implement and embed into any existing Ethereum client, while at the same time allow using existing sync technologies (fast, light, warp) without needing client developers to add custom logic to critical software.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;design-constraints&quot;&gt;Design constraints&lt;&#x2F;h2&gt;
&lt;p&gt;There are two approaches to syncing a blockchain in general:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The classical approach is to take the genesis block and crunch through all the transactions one by one. This is tried and proven, but in Ethereum complexity networks quickly turns out to be very costly computationally.&lt;&#x2F;li&gt;
&lt;li&gt;The other is to only download the chain of block headers and verify their validity, after which point an arbitrary recent state may be downloaded from the network and checked against recent headers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;A PoA scheme is based on the idea that blocks may only be minted by trusted signers. As such, every block (or header) that a client sees can be matched against the list of trusted signers. The challenge here is how to maintain a list of authorized signers that can change in time? The obvious answer (store it in an Ethereum contract) is also the wrong answer: fast, light and warp sync don&#x27;t have access to the state during syncing.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The protocol of maintaining the list of authorized signers must be fully contained in the block headers.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The next obvious idea would be to change the structure of the block headers so it drops the notions of PoW, and introduces new fields to cater for voting mechanisms. This is also the wrong answer: changing such a core data structure in multiple implementations would be a nightmare development, maintenance and security wise.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The protocol of maintaining the list of authorized signers must fit fully into the current data models.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;So, according to the above, we can&#x27;t use the EVM for voting, rather have to resort to headers. And we can&#x27;t change header fields, rather have to resort to the currently available ones. Not much wiggle room.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;repurposing-header-fields-for-signing-and-voting&quot;&gt;Repurposing header fields for signing and voting&lt;&#x2F;h3&gt;
&lt;p&gt;The most obvious field that currently is used solely as &lt;em&gt;fun metadata&lt;&#x2F;em&gt; is the 32 byte &lt;strong&gt;extra-data&lt;&#x2F;strong&gt; section in block headers. Miners usually place their client and version in there, but some fill it with alternative &quot;messages&quot;. The protocol would extend this field &lt;del&gt;to&lt;&#x2F;del&gt; with 65 bytes with the purpose of a secp256k1 miner signature. This would allow anyone obtaining a block to verify it against a list of authorized signers. It also makes the &lt;strong&gt;miner&lt;&#x2F;strong&gt; section in block headers obsolete (since the address can be derived from the signature).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Note, changing the length of a header field is a non invasive operation as all code (such as RLP encoding, hashing) is agnostic to that, so clients wouldn&#x27;t need custom logic.&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The above is enough to validate a chain, but how can we update a dynamic list of signers. The answer is that we can repurpose the newly obsoleted &lt;strong&gt;miner&lt;&#x2F;strong&gt; field and the PoA obsoleted &lt;strong&gt;nonce&lt;&#x2F;strong&gt; field to create a voting protocol:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;During regular blocks, both of these fields would be set to zero.&lt;&#x2F;li&gt;
&lt;li&gt;If a signer wishes to enact a change to the list of authorized signers, it will:
&lt;ul&gt;
&lt;li&gt;Set the &lt;strong&gt;miner&lt;&#x2F;strong&gt; to the signer it wishes to vote about&lt;&#x2F;li&gt;
&lt;li&gt;Set the &lt;strong&gt;nonce&lt;&#x2F;strong&gt; to &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;0xff...f&lt;&#x2F;code&gt; to vote in favor of adding or kicking out&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Any clients syncing the chain can &quot;tally&quot; up the votes during block processing, and maintain a dynamically changing list of authorized signers by popular vote.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid having an infinite window to tally up votes in, and also to allow periodically flushing stale proposals, we can reuse the concept of an epoch from ethash, where every epoch transition flushes all pending votes. Furthermore, these epoch transitions can also act as stateless checkpoints containing the list of current authorized signers within the header extra-data. This permits clients to sync up based only on a checkpoint hash without having to replay all the voting that was done on the chain up to that point. It also allows the genesis header to fully define the chain, containing the list of initial signers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-malicious-signer&quot;&gt;Attack vector: Malicious signer&lt;&#x2F;h3&gt;
&lt;p&gt;It may happen that a malicious user gets added to the list of signers, or that a signer key&#x2F;machine is compromised. In such a scenario the protocol needs to be able to defend itself against reorganizations and spamming. The proposed solution is that given a list of N authorized signers, any signer may only mint 1 block out of every K. This ensures that damage is limited, and the remainder of the miners can vote out the malicious user.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-censoring-signer&quot;&gt;Attack vector: Censoring signer&lt;&#x2F;h3&gt;
&lt;p&gt;Another interesting attack vector is if a signer (or group of signers) attempts to censor out blocks that vote on removing them from the authorization list. To work around this, we restrict the allowed minting frequency of signers to 1 out of N&#x2F;2. This ensures that malicious signers need to control at least 51% of signing accounts, at which case it&#x27;s game over anyway.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-spamming-signer&quot;&gt;Attack vector: Spamming signer&lt;&#x2F;h3&gt;
&lt;p&gt;A final small attack vector is that of malicious signers injecting new vote proposals inside every block they mint. Since nodes need to tally up all votes to create the actual list of authorized signers, they need to track all votes through time. Without placing a limit on the vote window, this could grow slowly, yet unbounded. The solution is to place a &lt;del&gt;moving&lt;&#x2F;del&gt; window of W blocks after which votes are considered stale. &lt;del&gt;A sane window might be 1-2 epochs.&lt;&#x2F;del&gt; We&#x27;ll call this an epoch.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;attack-vector-concurrent-blocks&quot;&gt;Attack vector: Concurrent blocks&lt;&#x2F;h3&gt;
&lt;p&gt;If the number of authorized signers are N, and we allow each signer to mint 1 block out of K, then at any point in time N-K+1 miners are allowed to mint. To avoid these racing for blocks, every signer would add a small random &quot;offset&quot; to the time it releases a new block. This ensures that small forks are rare, but occasionally still happen (as on the main net). If a signer is caught abusing it&#x27;s authority and causing chaos, it can be voted out.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We define the following constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;EPOCH_LENGTH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Number of blocks after which to checkpoint and reset the pending votes.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;30000&lt;&#x2F;code&gt; for the testnet to remain analogous to the mainnet &lt;code&gt;ethash&lt;&#x2F;code&gt; epoch.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;BLOCK_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Minimum difference between two consecutive block&#x27;s timestamps.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;15s&lt;&#x2F;code&gt; for the testnet to remain analogous to the mainnet &lt;code&gt;ethash&lt;&#x2F;code&gt; target.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;EXTRA_VANITY&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Fixed number of extra-data prefix bytes reserved for signer &lt;em&gt;vanity&lt;&#x2F;em&gt;.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;32 bytes&lt;&#x2F;code&gt; to retain the current extra-data allowance and&#x2F;or use.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;EXTRA_SEAL&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Fixed number of extra-data suffix bytes reserved for signer seal.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;65 bytes&lt;&#x2F;code&gt; fixed as signatures are based on the standard &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve.&lt;&#x2F;li&gt;
&lt;li&gt;Filled with zeros on genesis block.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;NONCE_AUTH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Magic nonce number &lt;code&gt;0xffffffffffffffff&lt;&#x2F;code&gt; to vote on adding a new signer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;NONCE_DROP&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Magic nonce number &lt;code&gt;0x0000000000000000&lt;&#x2F;code&gt; to vote on removing a signer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;UNCLE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Always &lt;code&gt;Keccak256(RLP([]))&lt;&#x2F;code&gt; as uncles are meaningless outside of PoW.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;DIFF_NOTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block score (difficulty) for blocks containing out-of-turn signatures.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;1&lt;&#x2F;code&gt; since it just needs to be an arbitrary baseline constant.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;DIFF_INTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block score (difficulty) for blocks containing in-turn signatures.
&lt;ul&gt;
&lt;li&gt;Suggested &lt;code&gt;2&lt;&#x2F;code&gt; to show a slight preference over out-of-turn signatures.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We also define the following per-block constants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;BLOCK_NUMBER&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Block height in the chain, where the height of the genesis is block &lt;code&gt;0&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SIGNER_COUNT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Number of authorized signers valid at a particular instance in the chain.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SIGNER_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Zero-based index of the block signer in the sorted list of current authorized signers.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;SIGNER_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Number of consecutive blocks out of which a signer may only sign one.
&lt;ul&gt;
&lt;li&gt;Must be &lt;code&gt;floor(SIGNER_COUNT &#x2F; 2) + 1&lt;&#x2F;code&gt; to enforce majority consensus on a chain.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We repurpose the &lt;code&gt;ethash&lt;&#x2F;code&gt; header fields as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;beneficiary&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &#x2F; &lt;strong&gt;&lt;code&gt;miner&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Address to propose modifying the list of authorized signers with.
&lt;ul&gt;
&lt;li&gt;Should be filled with zeroes normally, modified only while voting.&lt;&#x2F;li&gt;
&lt;li&gt;Arbitrary values are permitted nonetheless (even meaningless ones such as voting out non signers) to avoid extra complexity in implementations around voting mechanics.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be filled with zeroes on checkpoint (i.e. epoch transition) blocks.&lt;&#x2F;li&gt;
&lt;li&gt;Transaction execution &lt;strong&gt;must&lt;&#x2F;strong&gt; use the actual block signer (see &lt;code&gt;extraData&lt;&#x2F;code&gt;) for the &lt;code&gt;COINBASE&lt;&#x2F;code&gt; opcode and transaction fees &lt;strong&gt;must&lt;&#x2F;strong&gt; be attributed to the signer account.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;nonce&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Signer proposal regarding the account defined by the &lt;code&gt;beneficiary&lt;&#x2F;code&gt; field.
&lt;ul&gt;
&lt;li&gt;Should be &lt;strong&gt;&lt;code&gt;NONCE_DROP&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to propose deauthorizing &lt;code&gt;beneficiary&lt;&#x2F;code&gt; as an existing signer.&lt;&#x2F;li&gt;
&lt;li&gt;Should be &lt;strong&gt;&lt;code&gt;NONCE_AUTH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; to propose authorizing &lt;code&gt;beneficiary&lt;&#x2F;code&gt; as a new signer.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be filled with zeroes on checkpoint (i.e. epoch transition) blocks.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; not take up any other value apart from the two above (for now).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;extraData&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Combined field for signer vanity, checkpointing and signer signatures.
&lt;ul&gt;
&lt;li&gt;First &lt;strong&gt;&lt;code&gt;EXTRA_VANITY&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; bytes (fixed) may contain arbitrary signer vanity data.&lt;&#x2F;li&gt;
&lt;li&gt;Last &lt;strong&gt;&lt;code&gt;EXTRA_SEAL&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; bytes (fixed) is the signer&#x27;s signature sealing the header.&lt;&#x2F;li&gt;
&lt;li&gt;Checkpoint blocks &lt;strong&gt;must&lt;&#x2F;strong&gt; contain a list of signers (&lt;code&gt;N*20 bytes&lt;&#x2F;code&gt;) in between, &lt;strong&gt;omitted&lt;&#x2F;strong&gt; otherwise.&lt;&#x2F;li&gt;
&lt;li&gt;The list of signers in checkpoint block extra-data sections &lt;strong&gt;must&lt;&#x2F;strong&gt; be sorted in ascending byte order.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;mixHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Reserved for fork protection logic, similar to the extra-data during the DAO.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be filled with zeroes during normal operation.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;ommersHash&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; be &lt;strong&gt;&lt;code&gt;UNCLE_HASH&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; as uncles are meaningless outside of PoW.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;timestamp&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: &lt;strong&gt;Must&lt;&#x2F;strong&gt; be at least the parent timestamp + &lt;strong&gt;&lt;code&gt;BLOCK_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;difficulty&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Contains the standalone score of the block to derive the quality of a chain.
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be &lt;strong&gt;&lt;code&gt;DIFF_NOTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; if &lt;code&gt;BLOCK_NUMBER % SIGNER_COUNT != SIGNER_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Must&lt;&#x2F;strong&gt; be &lt;strong&gt;&lt;code&gt;DIFF_INTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; if &lt;code&gt;BLOCK_NUMBER % SIGNER_COUNT == SIGNER_INDEX&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;authorizing-a-block&quot;&gt;Authorizing a block&lt;&#x2F;h3&gt;
&lt;p&gt;To authorize a block for the network, the signer needs to sign the block&#x27;s sighash containing &lt;strong&gt;everything except the signature itself&lt;&#x2F;strong&gt;. This means that this hash contains every field of the header (&lt;code&gt;nonce&lt;&#x2F;code&gt; and &lt;code&gt;mixDigest&lt;&#x2F;code&gt; included), and also the  &lt;code&gt;extraData&lt;&#x2F;code&gt; with the exception of the 65 byte signature suffix. The fields are hashed in the order of their definition in the yellow paper. Note that this sighash differs from the final block hash which also includes the signature.&lt;&#x2F;p&gt;
&lt;p&gt;The sighash is signed using the standard &lt;code&gt;secp256k1&lt;&#x2F;code&gt; curve, and the resulting 65 byte signature (&lt;code&gt;R&lt;&#x2F;code&gt;, &lt;code&gt;S&lt;&#x2F;code&gt;, &lt;code&gt;V&lt;&#x2F;code&gt;, where &lt;code&gt;V&lt;&#x2F;code&gt; is &lt;code&gt;0&lt;&#x2F;code&gt; or &lt;code&gt;1&lt;&#x2F;code&gt;) is embedded into the &lt;code&gt;extraData&lt;&#x2F;code&gt; as the trailing 65 byte suffix.&lt;&#x2F;p&gt;
&lt;p&gt;To ensure malicious signers (loss of signing key) cannot wreck havoc in the network, each signer is allowed to sign &lt;strong&gt;maximum one&lt;&#x2F;strong&gt; out of &lt;strong&gt;&lt;code&gt;SIGNER_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; consecutive blocks. The order is not fixed, but in-turn signing weighs more (&lt;strong&gt;&lt;code&gt;DIFF_INTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;) than out of turn one (&lt;strong&gt;&lt;code&gt;DIFF_NOTURN&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;authorization-strategies&quot;&gt;Authorization strategies&lt;&#x2F;h4&gt;
&lt;p&gt;As long as signers conform to the above specs, they can authorize and distribute blocks as they see fit. The following suggested strategy will however reduce network traffic and small forks, so it&#x27;s a suggested feature:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If a signer is allowed to sign a block (is on the authorized list and didn&#x27;t sign recently).
&lt;ul&gt;
&lt;li&gt;Calculate the optimal signing time of the next block (parent + &lt;strong&gt;&lt;code&gt;BLOCK_PERIOD&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;).&lt;&#x2F;li&gt;
&lt;li&gt;If the signer is in-turn, wait for the exact time to arrive, sign and broadcast immediately.&lt;&#x2F;li&gt;
&lt;li&gt;If the signer is out-of-turn, delay signing by &lt;code&gt;rand(SIGNER_COUNT * 500ms)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This small strategy will ensure that the in-turn signer (who&#x27;s block weighs more) has a slight advantage to sign and propagate versus the out-of-turn signers. Also the scheme allows a bit of scale with the increase of the number of signers.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;voting-on-signers&quot;&gt;Voting on signers&lt;&#x2F;h3&gt;
&lt;p&gt;Every epoch transition (genesis block included) acts as a stateless checkpoint, from which capable clients should be able to sync without requiring any previous state. This means epoch headers &lt;strong&gt;must not&lt;&#x2F;strong&gt; contain votes, all non settled votes are discarded, and tallying starts from scratch.&lt;&#x2F;p&gt;
&lt;p&gt;For all non-epoch transition blocks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Signers may cast one vote per own block to propose a change to the authorization list.&lt;&#x2F;li&gt;
&lt;li&gt;Only the latest proposal per target beneficiary is kept from a single signer.&lt;&#x2F;li&gt;
&lt;li&gt;Votes are tallied live as the chain progresses (concurrent proposals allowed).&lt;&#x2F;li&gt;
&lt;li&gt;Proposals reaching majority consensus &lt;strong&gt;&lt;code&gt;SIGNER_LIMIT&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; come into effect immediately.&lt;&#x2F;li&gt;
&lt;li&gt;Invalid proposals are &lt;strong&gt;not&lt;&#x2F;strong&gt; to be penalized for client implementation simplicity.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;A proposal coming into effect entails discarding all pending votes for that proposal (both for and against) and starting with a clean slate.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cascading-votes&quot;&gt;Cascading votes&lt;&#x2F;h4&gt;
&lt;p&gt;A complex corner case may arise during signer deauthorization. When a previously authorized signer is dropped, the number of signers required to approve a proposal might decrease by one. This might cause one or more pending proposals to reach majority consensus, the execution of which might further cascade into new proposals passing.&lt;&#x2F;p&gt;
&lt;p&gt;Handling this scenario is non obvious when multiple conflicting proposals pass simultaneously (e.g. add a new signer vs. drop an existing one), where the evaluation order might drastically change the outcome of the final authorization list. Since signers may invert their own votes in every block they mint, it&#x27;s not so obvious which proposal would be &quot;first&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;To avoid the pitfalls cascading executions would entail, the Clique proposal explicitly forbids cascading effects. In other words: &lt;strong&gt;Only the &lt;code&gt;beneficiary&lt;&#x2F;code&gt; of the current header&#x2F;vote may be added to&#x2F;dropped from the authorization list. If that causes other proposals to reach consensus, those will be executed when their respective beneficiaries are &quot;touched&quot; again (given that majority consensus still holds at that point).&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;voting-strategies&quot;&gt;Voting strategies&lt;&#x2F;h4&gt;
&lt;p&gt;Since the blockchain can have small reorgs, a naive voting mechanism of &quot;cast-and-forget&quot; may not be optimal, since a block containing a singleton vote may not end up on the final chain.&lt;&#x2F;p&gt;
&lt;p&gt;A simplistic but working strategy is to allow users to configure &quot;proposals&quot; on the signers (e.g. &quot;add 0x...&quot;, &quot;drop 0x...&quot;). The signing code can then pick a random proposal for every block it signs and inject it. This ensures that multiple concurrent proposals as well as reorgs get eventually noted on the chain.&lt;&#x2F;p&gt;
&lt;p&gt;This list may be expired after a certain number of blocks &#x2F; epochs, but it&#x27;s important to realize that &quot;seeing&quot; a proposal pass doesn&#x27;t mean it won&#x27;t get reorged, so it should not be immediately dropped when the proposal passes.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;go&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; block represents a single block signed by a particular account, where&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the account may or may not have cast a Clique vote.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;type&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; block&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  signer&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;     string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Account that signed this particular block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  voted&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;      string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Optional value if the signer voted on adding&#x2F;removing someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  auth&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;       bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;     &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Whether the vote was to authorize (or deauthorize)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  checkpoint&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; List of authorized signers if this is an epoch block&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;&#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Define the various voting scenarios to test&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;tests&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; :=&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;struct&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  epoch&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;   uint64&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;   &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Number of blocks in an epoch (unset = 30000)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  signers&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Initial list of authorized signers in the genesis&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  blocks&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Chain of signed blocks, potentially influencing auths&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  results&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Final list of authorized signers after all blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;  failure&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; error&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Failure if some block is invalid according to the rules&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Single signer, no votes cast&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Single signer, voting to add two others (only accept first, second needs 2 votes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two signers, voting to add three others (only accept first two, third needs 3 votes already)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Single signer, dropping itself (weird, but one less cornercase by explicitly allowing this)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two signers, actually needing mutual consent to drop either of them (not fulfilled)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Two signers, actually needing mutual consent to drop either of them (fulfilled)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Three signers, two of them deciding to drop the third&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Four signers, consensus of two not being enough to drop anyone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Four signers, consensus of three already being enough to drop someone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizations are counted once per signer per target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorizing multiple accounts concurrently is permitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorizations are counted once per signer per target&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorizing multiple accounts concurrently is permitted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Votes from deauthorized signers are discarded immediately (deauth votes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Votes from deauthorized signers are discarded immediately (auth votes)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Cascading changes are not allowed, only the account being voted on may change&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes reaching consensus out of bounds (via a deauth) execute on touch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Changes reaching consensus out of bounds (via a deauth) may go out of consensus on first touch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Ensure that pending votes don&amp;#39;t survive authorization status changes. This&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; corner case can only appear if a signer is quickly added, removed and then&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; readded (or the inverse), while one of the original voters dropped. If a&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; past vote is left cached in the system somewhere, this will interfere with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; the final signer outcome.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Authorize F, 3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorize F, 4 votes needed (leave A&amp;#39;s previous vote &amp;quot;unchanged&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Almost authorize F, 2&#x2F;3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Deauthorize A, 3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; false&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Finish authorizing F, 3&#x2F;3 votes needed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;D&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;E&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;F&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Epoch transitions reset all votes to allow chain checkpointing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;   3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; voted&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; auth&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    results&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An unauthorized signer should not be able to sign blocks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    failure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errUnauthorizedSigner&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; An authorized signer that signed recently should not be able to sign again&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    failure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errRecentlySigned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;    &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Recent signatures should not reset on checkpoint blocks imported in a batch&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    epoch&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;   3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    signers&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    blocks&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;  [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;block&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; checkpoint&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;string&lt;&#x2F;span&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;B&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;C&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      {&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;signer&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;A&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-other&quot;&gt;    failure&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other&quot;&gt; errRecentlySigned&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;A reference implementation is part of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;go-ethereum&#x2F;tree&#x2F;master&#x2F;consensus&#x2F;clique&quot;&gt;go-ethereum&lt;&#x2F;a&gt; and has been functioning as the consensus engine behind the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.rinkeby.io&quot;&gt;Rinkeby&lt;&#x2F;a&gt; testnet since April, 2017.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Bitwise shifting instructions in EVM</title>
        <published>2017-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/145/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/145/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:145"
            label="EIP-145" />
        

        
        

        
        <summary type="html">To Provide native bitwise shifting with cost on par with other arithmetic operations.</summary>
        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/145/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Native bitwise shifting instructions are introduced, which are more efficient processing wise on the host and are cheaper to use by a contract.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;EVM is lacking bitwise shifting operators, but supports other logical and arithmetic operators. Shift operations can be implemented via arithmetic operators, but that has a higher cost and requires more processing time from the host. Implementing &lt;code&gt;SHL&lt;&#x2F;code&gt; and &lt;code&gt;SHR&lt;&#x2F;code&gt; using arithmetic cost each 35 gas, while the proposed instructions take 3 gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The following instructions are introduced:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;0x1b-shl-shift-left&quot;&gt;&lt;code&gt;0x1b&lt;&#x2F;code&gt;: &lt;code&gt;SHL&lt;&#x2F;code&gt; (shift left)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SHL&lt;&#x2F;code&gt; instruction (shift left) pops 2 values from the stack, first &lt;code&gt;arg1&lt;&#x2F;code&gt; and then &lt;code&gt;arg2&lt;&#x2F;code&gt;, and pushes on the stack &lt;code&gt;arg2&lt;&#x2F;code&gt; shifted to the left by &lt;code&gt;arg1&lt;&#x2F;code&gt; number of bits. The result is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(arg2 * 2^arg1) mod 2^256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The value (&lt;code&gt;arg2&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;The shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;If the shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is greater or equal 256 the result is 0.&lt;&#x2F;li&gt;
&lt;li&gt;This is equivalent to &lt;code&gt;PUSH1 2 EXP MUL&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;0x1c-shr-logical-shift-right&quot;&gt;&lt;code&gt;0x1c&lt;&#x2F;code&gt;: &lt;code&gt;SHR&lt;&#x2F;code&gt; (logical shift right)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SHR&lt;&#x2F;code&gt; instruction (logical shift right) pops 2 values from the stack, first &lt;code&gt;arg1&lt;&#x2F;code&gt; and then &lt;code&gt;arg2&lt;&#x2F;code&gt;, and pushes on the stack &lt;code&gt;arg2&lt;&#x2F;code&gt; shifted to the right by &lt;code&gt;arg1&lt;&#x2F;code&gt; number of bits with zero fill. The result is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;floor(arg2 &#x2F; 2^arg1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The value (&lt;code&gt;arg2&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;The shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;If the shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is greater or equal 256 the result is 0.&lt;&#x2F;li&gt;
&lt;li&gt;This is equivalent to &lt;code&gt;PUSH1 2 EXP DIV&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;0x1d-sar-arithmetic-shift-right&quot;&gt;&lt;code&gt;0x1d&lt;&#x2F;code&gt;: &lt;code&gt;SAR&lt;&#x2F;code&gt; (arithmetic shift right)&lt;&#x2F;h3&gt;
&lt;p&gt;The &lt;code&gt;SAR&lt;&#x2F;code&gt; instruction (arithmetic shift right) pops 2 values from the stack, first &lt;code&gt;arg1&lt;&#x2F;code&gt; and then &lt;code&gt;arg2&lt;&#x2F;code&gt;, and pushes on the stack &lt;code&gt;arg2&lt;&#x2F;code&gt; shifted to the right by &lt;code&gt;arg1&lt;&#x2F;code&gt; number of bits with sign extension. The result is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;floor(arg2 &#x2F; 2^arg1)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notes:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The value (&lt;code&gt;arg2&lt;&#x2F;code&gt;) is interpreted as a signed number.&lt;&#x2F;li&gt;
&lt;li&gt;The shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is interpreted as an unsigned number.&lt;&#x2F;li&gt;
&lt;li&gt;If the shift amount (&lt;code&gt;arg1&lt;&#x2F;code&gt;) is greater or equal 256 the result is 0 if &lt;code&gt;arg2&lt;&#x2F;code&gt; is non-negative or -1 if &lt;code&gt;arg2&lt;&#x2F;code&gt; is negative.&lt;&#x2F;li&gt;
&lt;li&gt;This is &lt;strong&gt;not&lt;&#x2F;strong&gt; equivalent to &lt;code&gt;PUSH1 2 EXP SDIV&lt;&#x2F;code&gt;, since it rounds differently. See &lt;code&gt;SDIV(-1, 2) == 0&lt;&#x2F;code&gt;, while &lt;code&gt;SAR(-1, 1) == -1&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The cost of the shift instructions is set at &lt;code&gt;verylow&lt;&#x2F;code&gt; tier (3 gas).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Instruction operands were chosen to fit the more natural use case of shifting a value already on the stack. This means the operand order is swapped compared to most arithmetic instructions.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;The newly introduced instructions have no effect on bytecode created in the past.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;shl-shift-left&quot;&gt;&lt;code&gt;SHL&lt;&#x2F;code&gt; (shift left)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;shr-logical-shift-right&quot;&gt;&lt;code&gt;SHR&lt;&#x2F;code&gt; (logical shift right)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x4000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SHR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;sar-arithmetic-shift-right&quot;&gt;&lt;code&gt;SAR&lt;&#x2F;code&gt; (arithmetic shift right)&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xc000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0101&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x00&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x01&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x4000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xf8&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x000000000000000000000000000000000000000000000000000000000000007f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xfe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0xff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 0x0100&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;SAR&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;---&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Client support:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;cpp-ethereum: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;cpp-ethereum&#x2F;pull&#x2F;4054&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Compiler support:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity&#x2F;LLL: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;solidity&#x2F;pull&#x2F;2541&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;tests&quot;&gt;Tests&lt;&#x2F;h3&gt;
&lt;p&gt;Sources:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;tree&#x2F;develop&#x2F;src&#x2F;GeneralStateTestsFiller&#x2F;stShift&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Filled Tests:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;tree&#x2F;develop&#x2F;GeneralStateTests&#x2F;stShift&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;tests&#x2F;tree&#x2F;develop&#x2F;BlockchainTests&#x2F;GeneralStateTests&#x2F;stShift&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>&quot;New opcodes: RETURNDATASIZE and RETURNDATACOPY&quot;</title>
        <published>2017-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/211/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/211/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:211"
            label="EIP-211" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/211/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;A mechanism to allow returning arbitrary-length data inside the EVM has been requested for quite a while now. Existing proposals always had very intricate problems associated with charging gas. This proposal solves the same problem while at the same time, it has a very simple gas charging mechanism and requires minimal changes to the call opcodes. Its workings are very similar to the way calldata is handled already; after a call, return data is kept inside a virtual buffer from which the caller can copy it (or parts thereof) into memory. At the next call, the buffer is overwritten. This mechanism is 100% backwards compatible.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;Please see summary.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;In some situations, it is vital for a function to be able to return data whose length cannot be anticipated before the call. In principle, this can be solved without alterations to the EVM, for example by splitting the call into two calls where the first is used to compute only the size. All of these mechanisms, though, are very expensive in at least some situations. A very useful example of such a worst-case situation is a generic forwarding contract; a contract that takes call data, potentially makes some checks and then forwards it as is to another contract. The return data should of course be transferred in a similar way to the original caller. Since the contract is generic and does not know about the contract it calls, there is no way to determine the size of the output without adapting the called contract accordingly or trying a logarithmic number of calls.&lt;&#x2F;p&gt;
&lt;p&gt;Compiler implementors are advised to reserve a zero-length area for return data if the size of the return data is unknown before the call and then use &lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt; in conjunction with &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt; to actually retrieve the data.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this proposal also makes the EIP that proposes to allow to return data in case of an intentional state reversion (&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;140&#x2F;&quot;&gt;EIP-140&lt;&#x2F;a&gt;) much more useful. Since the size of the failure data might be larger than the regular return data (or even unknown), it is possible to retrieve the failure data after the CALL opcode has signalled a failure, even if the regular output area is not large enough to hold the data.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, add two new opcodes and amend the semantics of any opcode that creates a new call frame (like &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;, ...) called call-like opcodes in the following. It is assumed that the EVM (to be more specific: an EVM call frame) has a new internal buffer of variable size, called the return data buffer. This buffer is created empty for each new call frame. Upon executing any call-like opcode, the buffer is cleared (its size is set to zero). After executing a call-like opcode, the complete return data (or failure data, see &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;140&#x2F;&quot;&gt;EIP-140&lt;&#x2F;a&gt;) of the call is stored in the return data buffer (of the caller), and its size changed accordingly. As an exception, &lt;code&gt;CREATE&lt;&#x2F;code&gt; and &lt;code&gt;CREATE2&lt;&#x2F;code&gt; are considered to return the empty buffer in the success case and the failure data in the failure case. If the call-like opcode is executed but does not really instantiate a call frame (for example due to insufficient funds for a value transfer or if the called contract does not exist), the return data buffer is empty.&lt;&#x2F;p&gt;
&lt;p&gt;As an optimization, it is possible to share the return data buffer across call frames because at most one will be non-empty at any time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;: &lt;code&gt;0x3d&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the size of the return data buffer onto the stack.
Gas costs: 2 (same as &lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;RETURNDATACOPY&lt;&#x2F;code&gt;: &lt;code&gt;0x3e&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This opcode has similar semantics to &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;, but instead of copying data from the call data, it copies data from the return data buffer. Furthermore, accessing the return data buffer beyond its size results in a failure; i.e. if &lt;code&gt;start + length&lt;&#x2F;code&gt; overflows or results in a value larger than &lt;code&gt;RETURNDATASIZE&lt;&#x2F;code&gt;, the current call stops in an out-of-gas condition. In particular, reading 0 bytes from the end of the buffer will read 0 bytes; reading 0 bytes from one-byte out of the buffer causes an exception.&lt;&#x2F;p&gt;
&lt;p&gt;Gas costs: &lt;code&gt;3 + 3 * ceil(amount &#x2F; 32)&lt;&#x2F;code&gt; (same as &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;)&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;Other solutions that would allow returning dynamic data were considered, but they all had to deduct the gas from the call opcode and thus were both complicated to implement and specify (&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;8&quot;&gt;5&#x2F;8&lt;&#x2F;a&gt;). Since this proposal is very similar to the way calldata is handled, it fits nicely into the concept. Furthermore, the eWASM architecture already handles return data in exactly the same way.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the EVM implementation needs to keep the return data until the next call or the return from the current call. Since this resource was already paid for as part of the memory of the callee, it should not be a problem. Implementations may either choose to keep the full memory of the callee alive until the next call or copy only the return data to a special memory area.&lt;&#x2F;p&gt;
&lt;p&gt;Keeping the memory of the callee until the next call-like opcode does not increase the peak memory usage in the following sense; any memory allocation in the caller&#x27;s frame that happens after the return from the call can be moved before the call without a change in gas costs, but will add this allocation to the peak allocation.&lt;&#x2F;p&gt;
&lt;p&gt;The number values of the opcodes were allocated in the same nibble block that also contains &lt;code&gt;CALLDATASIZE&lt;&#x2F;code&gt; and &lt;code&gt;CALLDATACOPY&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal introduces two new opcodes and stays fully backwards compatible apart from that.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>New opcode STATICCALL</title>
        <published>2017-02-13T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><email>vitalik@ethereum.org</email>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/214/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/214/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:214"
            label="EIP-214" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/214/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;To increase smart contract security, this proposal adds a new opcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a new opcode that can be used to call another contract (or itself) while disallowing any modifications to the state during the call (and its subcalls, if present). Any opcode that attempts to perform such a modification (see below for details) will result in an exception instead of performing the modification.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently, there is no restriction about what a called contract can do, as long as the computation can be performed with the amount of gas provided. This poses certain difficulties about smart contract engineers; after a regular call, unless you know the called contract, you cannot make any assumptions about the state of the contracts. Furthermore, because you cannot know the order of transactions before they are confirmed by miners, not even an outside observer can be sure about that in all cases.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP adds a way to call other contracts and restrict what they can do in the simplest way. It can be safely assumed that the state of all accounts is the same before and after a static call.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;Introduce a new &lt;code&gt;STATIC&lt;&#x2F;code&gt; flag to the virtual machine. This flag is set to &lt;code&gt;false&lt;&#x2F;code&gt; initially. Its value is always copied to sub-calls with an exception for the new opcode below.&lt;&#x2F;p&gt;
&lt;p&gt;Opcode: &lt;code&gt;0xfa&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;STATICCALL&lt;&#x2F;code&gt; functions equivalently to a &lt;code&gt;CALL&lt;&#x2F;code&gt;, except it takes only 6 arguments (the &quot;value&quot; argument is not included and taken to be zero), and calls the child with the &lt;code&gt;STATIC&lt;&#x2F;code&gt; flag set to &lt;code&gt;true&lt;&#x2F;code&gt; for the execution of the child. Once this call returns, the flag is reset to its value before the call.&lt;&#x2F;p&gt;
&lt;p&gt;Any attempts to make state-changing operations inside an execution instance with &lt;code&gt;STATIC&lt;&#x2F;code&gt; set to &lt;code&gt;true&lt;&#x2F;code&gt; will instead throw an exception. These operations include &lt;code&gt;CREATE&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, &lt;code&gt;LOG0&lt;&#x2F;code&gt;, &lt;code&gt;LOG1&lt;&#x2F;code&gt;, &lt;code&gt;LOG2&lt;&#x2F;code&gt;, &lt;code&gt;LOG3&lt;&#x2F;code&gt;, &lt;code&gt;LOG4&lt;&#x2F;code&gt;, &lt;code&gt;SSTORE&lt;&#x2F;code&gt;, and &lt;code&gt;SELFDESTRUCT&lt;&#x2F;code&gt;. They also include &lt;code&gt;CALL&lt;&#x2F;code&gt; with a non-zero value. As an exception, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; is not considered state-changing, even with a non-zero value.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This allows contracts to make calls that are clearly non-state-changing, reassuring developers and reviewers that re-entrancy bugs or other problems cannot possibly arise from that particular call; it is a pure function that returns an output and does nothing else. This may also make purely functional HLLs easier to implement.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This proposal adds a new opcode but does not modify the behaviour of other opcodes and thus is backwards compatible for old contracts that do not use the new opcode and are not called via the new opcode.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be written.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Blockhash refactoring</title>
        <published>2017-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/210/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/210/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:210"
            label="EIP-210" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/210/">&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h3&gt;
&lt;p&gt;Stores blockhashes in the state, reducing the protocol complexity and the need for client implementation complexity in order to process the BLOCKHASH opcode. Also extends the range of how far back blockhash checking can go, with the side effect of creating direct links between blocks with very distant block numbers, facilitating much more efficient initial light client syncing.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;: TBD&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SUPER_USER&lt;&#x2F;code&gt;: 2**160 - 2&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH_CONTRACT_ADDR&lt;&#x2F;code&gt;: 0xf0 (ie. 240)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;BLOCKHASH_CONTRACT_CODE&lt;&#x2F;code&gt;: see below&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number == CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, then when processing the block, before processing any transactions set the code of BLOCKHASH_CONTRACT_ADDR to BLOCKHASH_CONTRACT_CODE.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, then when processing a block, before processing any transactions execute a call with the parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: SUPER_USER&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 1000000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: BLOCKHASH_CONTRACT_ADDR&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: &amp;lt;32 bytes corresponding to the block&#x27;s prevhash&amp;gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM + 256&lt;&#x2F;code&gt;, then the BLOCKHASH opcode instead returns the result of executing a call (NOT a transaction) with the parameters:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SENDER&lt;&#x2F;code&gt;: &amp;lt;account from which the opcode was called&amp;gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;GAS&lt;&#x2F;code&gt;: 1000000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;TO&lt;&#x2F;code&gt;: BLOCKHASH_CONTRACT_ADDR&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;VALUE&lt;&#x2F;code&gt;: 0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;DATA&lt;&#x2F;code&gt;: 32 byte zero-byte-leftpadded integer representing the stack argument with which the opcode was called&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Also, for blocks where &lt;code&gt;block.number &amp;gt;= CONSTANTINOPLE_FORK_BLKNUM&lt;&#x2F;code&gt;, the gas cost is increased from 20 to 800 to reflect the higher costs of processing the algorithm in the contract code.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;blockhash-contract-code&quot;&gt;BLOCKHASH_CONTRACT_CODE&lt;&#x2F;h3&gt;
&lt;p&gt;The Serpent source code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;with&lt;&#x2F;span&gt;&lt;span&gt; offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;fffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        with&lt;&#x2F;span&gt;&lt;span&gt; bn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            while&lt;&#x2F;span&gt;&lt;span&gt; bn&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                ~&lt;&#x2F;span&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    ~&lt;&#x2F;span&gt;&lt;span&gt;stop&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                bn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;bn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        with&lt;&#x2F;span&gt;&lt;span&gt; tbn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;            with&lt;&#x2F;span&gt;&lt;span&gt; dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;number&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; tbn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                while&lt;&#x2F;span&gt;&lt;span&gt; dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; &amp;amp;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tbn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    tbn&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tbn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; &lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;div&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dist_minus_one&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                if&lt;&#x2F;span&gt;&lt;span&gt; dist_minus_one&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                    return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;                return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;offset&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;mod&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tbn&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 256&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;        return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM init code is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x6100f58061000e60003961010356600073fffffffffffffffffffffffffffffffffffffffe33141561005857600143035b801561005257600035610100820683015561010081061561003f57005b6101008104905061010082019150610022565b506100f3565b600060003512151561006e574360003512610071565b60005b156100e7576000356001814303035b6101008112151561009857600061010083061461009b565b60005b156100ba57610100830192506101008204915061010081049050610080565b610100811215156100d057600060a052602060a0f35b610100820683015460c052602060c0f350506100f2565b600060e052602060e0f35b5b505b6000f3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The EVM bytecode that the contract code should be set to is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0x600073fffffffffffffffffffffffffffffffffffffffe33141561005857600143035b801561005257600035610100820683015561010081061561003f57005b6101008104905061010082019150610022565b506100f3565b600060003512151561006e574360003512610071565b60005b156100e7576000356001814303035b6101008112151561009857600061010083061461009b565b60005b156100ba57610100830192506101008204915061010081049050610080565b610100811215156100d057600060a052602060a0f35b610100820683015460c052602060c0f350506100f2565b600060e052602060e0f35b5b50&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This removes the need for implementations to have an explicit way to look into historical block hashes, simplifying the protocol definition and removing a large component of the &quot;implied state&quot; (information that is technically state but is not part of the state tree) and thereby making the protocol more &quot;pure&quot;. Additionally, it allows blocks to directly point to blocks far behind them, which enables extremely efficient and secure light client protocols.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Abstraction of transaction origin and signature</title>
        <published>2017-02-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/86/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/86/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:86"
            label="EIP-86" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/86/">&lt;h1 id=&quot;summary&quot;&gt;Summary&lt;&#x2F;h1&gt;
&lt;p&gt;Implements a set of changes that serve the combined purpose of &quot;abstracting out&quot; signature verification and nonce checking, allowing users to create &quot;account contracts&quot; that perform any desired signature&#x2F;nonce checks instead of using the mechanism that is currently hard-coded into transaction processing.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;METROPOLIS_FORK_BLKNUM: TBD&lt;&#x2F;li&gt;
&lt;li&gt;CHAIN_ID: same as used for EIP 155 (ie. 1 for mainnet, 3 for testnet)&lt;&#x2F;li&gt;
&lt;li&gt;NULL_SENDER: 2**160 - 1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= METROPOLIS_FORK_BLKNUM&lt;&#x2F;code&gt;, then:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;If the signature of a transaction is &lt;code&gt;(CHAIN_ID, 0, 0)&lt;&#x2F;code&gt; (ie. &lt;code&gt;r = s = 0&lt;&#x2F;code&gt;, &lt;code&gt;v = CHAIN_ID&lt;&#x2F;code&gt;), then treat it as valid and set the sender address to &lt;code&gt;NULL_SENDER&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;Transactions of this form MUST have gasprice = 0, nonce = 0, value = 0, and do NOT increment the nonce of account NULL_SENDER.&lt;&#x2F;li&gt;
&lt;li&gt;Create a new opcode at &lt;code&gt;0xfb&lt;&#x2F;code&gt;, &lt;code&gt;CREATE2&lt;&#x2F;code&gt;, with 4 stack arguments (value, salt, mem_start, mem_size) which sets the creation address to &lt;code&gt;sha3(sender + salt + sha3(init code)) % 2**160&lt;&#x2F;code&gt;, where &lt;code&gt;salt&lt;&#x2F;code&gt; is always represented as a 32-byte value.&lt;&#x2F;li&gt;
&lt;li&gt;Add to &lt;em&gt;all&lt;&#x2F;em&gt; contract creation operations, including transactions and opcodes, the rule that if a contract at that address already exists and has non-empty code OR non-empty nonce, the operation fails and returns 0 as if the init code had run out of gas. If an account has empty code and nonce but nonempty balance, the creation operation may still succeed.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;The goal of these changes is to set the stage for abstraction of account security. Instead of having an in-protocol mechanism where ECDSA and the default nonce scheme are enshrined as the only &quot;standard&quot; way to secure an account, we take initial steps toward a model where in the long term all accounts are contracts, contracts can pay for gas, and users are free to define their own security model.&lt;&#x2F;p&gt;
&lt;p&gt;Under EIP 86, we can expect users to store their ether in contracts, whose code might look like the following (example in Serpent):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get signature from tx data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig_v&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig_r&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sig_s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get tx arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_to&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;192&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 224&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get signing hash&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; string&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startgas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;signing_hash&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_data&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;str&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Perform usual checks&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;prev_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;sload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; tx_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; prev_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;balance&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;gt;=&lt;&#x2F;span&gt;&lt;span&gt; tx_value&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; tx_gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startgas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;ecrecover&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;signing_hash&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_v&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_r&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; sig_s&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span&gt;pubkey&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; hash&lt;&#x2F;span&gt;&lt;span&gt; here&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Update nonce&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;sstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; prev_nonce&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pay for gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;send&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;MINER_CONTRACT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_gasprice&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;startgas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make the main call&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_to&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_value&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; tx_data&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;tx_data&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get remaining gas payments back&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;20000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MINER_CONTRACT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This can be thought of as a &quot;forwarding contract&quot;. It accepts data from the &quot;entry point&quot; address 2**160 - 1 (an account that anyone can send transactions from), expecting that data to be in the format &lt;code&gt;[sig, nonce, to, value, gasprice, data]&lt;&#x2F;code&gt;. The forwarding contract verifies the signature, and if the signature is correct it sets up a payment to the miner and then sends a call to the desired address with the provided value and data.&lt;&#x2F;p&gt;
&lt;p&gt;The benefits that this provides lie in the most interesting cases:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Multisig wallets&lt;&#x2F;strong&gt;: currently, sending from a multisig wallet requires each operation to be ratified by the participants, and each ratification is a transaction. This could be simplified by having one ratification transaction include signatures from the other participants, but even still it introduces complexity because the participants&#x27; accounts all need to be stocked up with ETH. With this EIP, it will be possible to just have the contract store the ETH, send a transaction containing all signatures to the contract directly, and the contract can pay the fees.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Ring signature mixers&lt;&#x2F;strong&gt;: the way that ring signature mixers work is that N individuals send 1 coin into a contract, and then use a linkable ring signature to withdraw 1 coin later on. The linkable ring signature ensures that the withdrawal transaction cannot be linked to the deposit, but if someone attempts to withdraw twice then those two signatures can be linked and the second one prevented. However, currently there is a privacy risk: to withdraw, you need to have coins to pay for gas, and if these coins are not properly mixed then you risk compromising your privacy. With this EIP, you can pay for gas straight our of your withdrawn coins.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Custom cryptography&lt;&#x2F;strong&gt;: users can upgrade to ed25519 signatures, Lamport hash ladder signatures or whatever other scheme they want on their own terms; they do not need to stick with ECDSA.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Non-cryptographic modifications&lt;&#x2F;strong&gt;: users can require transactions to have expiry times (this being standard would allow old empty&#x2F;dust accounts to be flushed from the state securely), use k-parallelizable nonces (a scheme that allows transactions to be confirmed slightly out-of-order, reducing inter-transaction dependence), or make other modifications.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;(2) and (3) introduce a feature similar to bitcoin&#x27;s P2SH, allowing users to send funds to addresses that provably map to only one particular piece of code. Something like this is crucial in the long term because, in a world where all accounts are contracts, we need to preserve the ability to send to an account before that account exists on-chain, as that&#x27;s a basic functionality that exists in all blockchain protocols today.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;miner-and-transaction-replaying-strategy&quot;&gt;Miner and transaction replaying strategy&lt;&#x2F;h1&gt;
&lt;p&gt;Note that miners would need to have a strategy for accepting these transactions. This strategy would need to be very discriminating, because otherwise they run the risk of accepting transactions that do not pay them any fees, and possibly even transactions that have no effect (eg. because the transaction was already included and so the nonce is no longer current).&lt;&#x2F;p&gt;
&lt;p&gt;One simple strategy is to have a set of regexps that the to address of an account would be checked against, each regexp corresponding to a &quot;standard account type&quot; which is known to be &quot;safe&quot; (in the sense that if an account has that code, and a particular check involving the account balances, account storage and transaction data passes, then if the transaction is included in a block the miner will get paid), and mine and relay transactions that pass these checks.&lt;&#x2F;p&gt;
&lt;p&gt;One example would be to check as follows:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check that the to address has code which is the compiled version of the Serpent code above, with &lt;code&gt;&amp;lt;pubkey hash here&amp;gt;&lt;&#x2F;code&gt; replaced with any public key hash.&lt;&#x2F;li&gt;
&lt;li&gt;Check that the signature in the transaction data verifies with that key hash.&lt;&#x2F;li&gt;
&lt;li&gt;Check that the gasprice in the transaction data is sufficiently high&lt;&#x2F;li&gt;
&lt;li&gt;Check that the nonce in the state matches the nonce in the transaction data&lt;&#x2F;li&gt;
&lt;li&gt;Check that there is enough ether in the account to pay for the fee&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;If all five checks pass, relay and&#x2F;or mine the transaction.&lt;&#x2F;p&gt;
&lt;p&gt;A looser but still effective strategy would be to accept any code that fits the same general format as the above, consuming only a limited amount of gas to perform nonce and signature checks and having a guarantee that transaction fees will be paid to the miner. Another strategy is to, alongside other approaches, try to process any transaction that asks for less than 250,000 gas, and include it only if the miner&#x27;s balance is appropriately higher after executing the transaction than before it.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via CC0.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Designated invalid EVM instruction</title>
        <published>2017-02-09T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/141/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/141/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:141"
            label="EIP-141" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/141/">&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;An instruction is designated to remain as an invalid instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;The invalid instruction can be used as a distinct reason to abort execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;The opcode &lt;code&gt;0xfe&lt;&#x2F;code&gt; is the &lt;code&gt;INVALID&lt;&#x2F;code&gt; instruction. It can be used to abort the execution (i.e. duplicates as an &lt;code&gt;ABORT&lt;&#x2F;code&gt; instruction).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This instruction was never used and therefore has no effect on past contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>REVERT instruction</title>
        <published>2017-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Alex Beregszaszi</name><uri>https://github.com/axic</uri>
	</author>
	
	<author>
		<name>Nikolai Mushegian</name><email>nikolai@nexusdev.us</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/140/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/140/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:140"
            label="EIP-140" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/140/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction provides a way to stop execution and revert state changes, without consuming all provided gas and with the ability to return a reason.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;The &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction will stop execution, roll back all state changes done so far and provide a pointer to a memory section, which can be interpreted as an error code or message. While doing so, it will not consume all the remaining gas.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently this is not possible. There are two practical ways to revert a transaction from within a contract: running out of gas or executing an invalid instruction. Both of these options will consume all remaining gas. Additionally, reverting an EVM execution means that all changes, including LOGs, are lost and there is no way to convey a reason for aborting an EVM execution.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;On blocks with &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, the &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction is introduced at &lt;code&gt;0xfd&lt;&#x2F;code&gt;. It expects two stack items, the top item is the &lt;code&gt;memory_offset&lt;&#x2F;code&gt; followed by &lt;code&gt;memory_length&lt;&#x2F;code&gt;. It does not produce any stack elements because it stops execution.&lt;&#x2F;p&gt;
&lt;p&gt;The semantics of &lt;code&gt;REVERT&lt;&#x2F;code&gt; with respect to memory and memory cost are identical to those of &lt;code&gt;RETURN&lt;&#x2F;code&gt;. The sequence of bytes given by &lt;code&gt;memory_offset&lt;&#x2F;code&gt; and &lt;code&gt;memory_length&lt;&#x2F;code&gt; is called &quot;error message&quot; in the following.&lt;&#x2F;p&gt;
&lt;p&gt;The effect of &lt;code&gt;REVERT&lt;&#x2F;code&gt; is that execution is aborted, considered as failed, and state changes are rolled back. The error message will be available to the caller in the returndata buffer and will also be copied to the output area, i.e. it is handled in the same way as the regular return data is handled.&lt;&#x2F;p&gt;
&lt;p&gt;The cost of the &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction equals to that of the &lt;code&gt;RETURN&lt;&#x2F;code&gt; instruction, i.e. the rollback itself does not consume all gas, the contract only has to pay for memory.&lt;&#x2F;p&gt;
&lt;p&gt;In case there is not enough gas left to cover the cost of &lt;code&gt;REVERT&lt;&#x2F;code&gt; or there is a stack underflow, the effect of the &lt;code&gt;REVERT&lt;&#x2F;code&gt; instruction will equal to that of a regular out of gas exception, i.e. it will consume all gas.&lt;&#x2F;p&gt;
&lt;p&gt;In the same way as all other failures, the calling opcode returns &lt;code&gt;0&lt;&#x2F;code&gt; on the stack following a &lt;code&gt;REVERT&lt;&#x2F;code&gt; opcode in the callee.&lt;&#x2F;p&gt;
&lt;p&gt;In case &lt;code&gt;REVERT&lt;&#x2F;code&gt; is used in the context of a &lt;code&gt;CREATE&lt;&#x2F;code&gt; or &lt;code&gt;CREATE2&lt;&#x2F;code&gt; call, no code is deployed, &lt;code&gt;0&lt;&#x2F;code&gt; is put on the stack and the error message is available in the returndata buffer.&lt;&#x2F;p&gt;
&lt;p&gt;The content of the optionally provided memory section is not defined by this EIP, but is a candidate for another Informational EIP.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;This change has no effect on contracts created in the past unless they contain &lt;code&gt;0xfd&lt;&#x2F;code&gt; as an instruction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6c726576657274656420646174616000557f726576657274206d657373616765000000000000000000000000000000000000600052600e6000fd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;should:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;return &lt;code&gt;0x726576657274206d657373616765&lt;&#x2F;code&gt; as &lt;code&gt;REVERT&lt;&#x2F;code&gt; data,&lt;&#x2F;li&gt;
&lt;li&gt;the storage at key &lt;code&gt;0x0&lt;&#x2F;code&gt; should be left as unset and&lt;&#x2F;li&gt;
&lt;li&gt;use 20024 gas in total.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128</title>
        <published>2017-02-06T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><email>vitalik@ethereum.org</email>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/197/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/197/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:197"
            label="EIP-197" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/197/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Precompiled contracts for elliptic curve pairing operations are required in order to perform zkSNARK verification within the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP suggests to add precompiled contracts for a pairing function on a specific pairing-friendly elliptic curve. This can in turn be combined with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;196&#x2F;&quot;&gt;EIP-196&lt;&#x2F;a&gt; to verify zkSNARKs in Ethereum smart contracts. The general benefit of zkSNARKs for Ethereum is that it will increase the privacy for users (because of the Zero-Knowledge property) and might also be a scalability solution (because of the succinctness and efficient verifiability property).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current smart contract executions on Ethereum are fully transparent, which makes them unsuitable for several use-cases that involve private information like the location, identity or history of past transactions. The technology of zkSNARKs could be a solution to this problem. While the Ethereum Virtual Machine can make use of zkSNARKs in theory, they are currently too expensive
to fit the block gas limit. Because of that, this EIP proposes to specify certain parameters for some elementary primitives that enable zkSNARKs so that they can be implemented more efficiently and the gas cost be reduced.&lt;&#x2F;p&gt;
&lt;p&gt;Note that fixing these parameters will in no way limit the use-cases for zkSNARKs, it will even allow for incorporating some advances in zkSNARK research without the need for a further hard fork.&lt;&#x2F;p&gt;
&lt;p&gt;Pairing functions can be used to perform a limited form of multiplicatively homomorphic operations, which are necessary for current zkSNARKs. This precompile can be used to run such computations within the block gas limit. This precompiled contract only specifies a certain check, and not an evaluation of a pairing function. The reason is that the codomain of a pairing function is a rather complex field which could provide encoding problems and all known uses of pairing function in zkSNARKs only require the specified check.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;For blocks where &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, add a precompiled contracts for a bilinear function on groups on the elliptic curve &quot;alt_bn128&quot;. We will define the precompiled contract in terms of a discrete logarithm. The discrete logarithm is of course assumed to be hard to compute, but we will give an equivalent specification that makes use of elliptic curve pairing functions which can be efficiently computed below.&lt;&#x2F;p&gt;
&lt;p&gt;Address: 0x8&lt;&#x2F;p&gt;
&lt;p&gt;For a cyclic group &lt;code&gt;G&lt;&#x2F;code&gt; (written additively) of prime order &lt;code&gt;q&lt;&#x2F;code&gt; let &lt;code&gt;log_P: G -&amp;gt; F_q&lt;&#x2F;code&gt; be the discrete logarithm on this group with respect to a generator &lt;code&gt;P&lt;&#x2F;code&gt;, i.e. &lt;code&gt;log_P(x)&lt;&#x2F;code&gt; is the smallest non-negative integer &lt;code&gt;n&lt;&#x2F;code&gt; such that &lt;code&gt;n * P = x&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The precompiled contract is defined as follows, where the two groups &lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are defined by their generators &lt;code&gt;P_1&lt;&#x2F;code&gt; and &lt;code&gt;P_2&lt;&#x2F;code&gt; below. Both generators have the same prime order &lt;code&gt;q&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Input: (a1, b1, a2, b2, ..., ak, bk) from (G_1 x G_2)^k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Output: If the length of the input is incorrect or any of the inputs are not elements of&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        the respective group or are not encoded correctly, the call fails.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Otherwise, return one if&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        log_P1(a1) * log_P2(b1) + ... + log_P1(ak) * log_P2(bk) = 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        (in F_q) and zero else.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that &lt;code&gt;k&lt;&#x2F;code&gt; is determined from the length of the input. Following the section on the encoding below,
&lt;code&gt;k&lt;&#x2F;code&gt; is the length of the input divided by &lt;code&gt;192&lt;&#x2F;code&gt;. If the input length is not a multiple of &lt;code&gt;192&lt;&#x2F;code&gt;,
the call fails. Empty input is valid and results in returning one.&lt;&#x2F;p&gt;
&lt;p&gt;In order to check that an input is an element of &lt;code&gt;G_1&lt;&#x2F;code&gt;, verifying the encoding of the coordinates and checking that they satisfy the curve equation (or is the encoding of infinity) is sufficient. For &lt;code&gt;G_2&lt;&#x2F;code&gt;, in addition to that, the order of the element has to be checked to be equal to the group order &lt;code&gt;q = 21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;definition-of-the-groups&quot;&gt;Definition of the groups&lt;&#x2F;h3&gt;
&lt;p&gt;The groups &lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are cyclic groups of prime order &lt;code&gt;q = 21888242871839275222246405745257275088548364400416034343698204186575808495617&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The group &lt;code&gt;G_1&lt;&#x2F;code&gt; is defined on the curve &lt;code&gt;Y^2 = X^3 + 3&lt;&#x2F;code&gt; over the field &lt;code&gt;F_p&lt;&#x2F;code&gt; with &lt;code&gt;p = 21888242871839275222246405745257275088696311157297823662689037894645226208583&lt;&#x2F;code&gt; with generator &lt;code&gt;P1 = (1, 2)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The group &lt;code&gt;G_2&lt;&#x2F;code&gt; is defined on the curve &lt;code&gt;Y^2 = X^3 + 3&#x2F;(i+9)&lt;&#x2F;code&gt; over a different field &lt;code&gt;F_p^2 = F_p[i] &#x2F; (i^2 + 1)&lt;&#x2F;code&gt; (p is the same as above) with generator&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;P2 = (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  11559732032986387107991004021392285783925812861821192530917403151452391805634 * i +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  10857046999023057135944570762232829481370756359578518086990519993285655852781,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  4082367875863433681332203403145435568316851327593401208105741076214120093531 * i +&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  8495653923123431417604973247489272438418190587263600148770280649306958101930&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that &lt;code&gt;G_2&lt;&#x2F;code&gt; is the only group of order &lt;code&gt;q&lt;&#x2F;code&gt; of that elliptic curve over the field &lt;code&gt;F_p^2&lt;&#x2F;code&gt;. Any other generator of order &lt;code&gt;q&lt;&#x2F;code&gt; instead of &lt;code&gt;P2&lt;&#x2F;code&gt; would define the same &lt;code&gt;G_2&lt;&#x2F;code&gt;. However, the concrete value of &lt;code&gt;P2&lt;&#x2F;code&gt; is useful for skeptical readers who doubt the existence of a group of order &lt;code&gt;q&lt;&#x2F;code&gt;. They can be instructed to compare the concrete values of &lt;code&gt;q * P2&lt;&#x2F;code&gt; and &lt;code&gt;P2&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Elements of &lt;code&gt;F_p&lt;&#x2F;code&gt; are encoded as 32 byte big-endian numbers. An encoding value of &lt;code&gt;p&lt;&#x2F;code&gt; or larger is invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Elements &lt;code&gt;a * i + b&lt;&#x2F;code&gt; of &lt;code&gt;F_p^2&lt;&#x2F;code&gt; are encoded as two elements of &lt;code&gt;F_p&lt;&#x2F;code&gt;, &lt;code&gt;(a, b)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Elliptic curve points are encoded as a Jacobian pair &lt;code&gt;(X, Y)&lt;&#x2F;code&gt; where the point at infinity is encoded as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Note that the number &lt;code&gt;k&lt;&#x2F;code&gt; is derived from the input length.&lt;&#x2F;p&gt;
&lt;p&gt;The length of the returned data is always exactly 32 bytes and encoded as a 32 byte big-endian number.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;p&gt;The gas costs of the precompiled contract are &lt;code&gt;80 000 * k + 100 000&lt;&#x2F;code&gt;, where &lt;code&gt;k&lt;&#x2F;code&gt; is the number of
points or, equivalently, the length of the input divided by 192.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specific curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; was chosen because it is particularly well-suited for zkSNARKs, or, more specifically their verification building block of pairing functions. Furthermore, by choosing this curve, we can use synergy effects with ZCash and re-use some of their components and artifacts.&lt;&#x2F;p&gt;
&lt;p&gt;The feature of adding curve and field parameters to the inputs was considered but ultimately rejected since it complicates the specification; the gas costs are much harder to determine and it would be possible to call the contracts on something which is not an actual elliptic curve or does not admit an efficient pairing implementation.&lt;&#x2F;p&gt;
&lt;p&gt;A non-compact point encoding was chosen since it still allows to perform some operations in the smart contract itself (inclusion of the full y coordinate) and two encoded points can be compared for equality (no third projective coordinate).&lt;&#x2F;p&gt;
&lt;p&gt;The encoding of field elements in &lt;code&gt;F_p^2&lt;&#x2F;code&gt; was chosen in this order to be in line with the big endian encoding of the elements themselves.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As with the introduction of any precompiled contract, contracts that already use the given addresses will change their semantics. Because of that, the addresses are taken from the &quot;reserved range&quot; below 256.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;To be written.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;The precompiled contract can be implemented using elliptic curve pairing functions, more specifically, an optimal ate pairing on the alt_bn128 curve, which can be implemented efficiently. In order to see that, first note that a pairing function &lt;code&gt;e: G_1 x G_2 -&amp;gt; G_T&lt;&#x2F;code&gt; fulfills the following properties (&lt;code&gt;G_1&lt;&#x2F;code&gt; and &lt;code&gt;G_2&lt;&#x2F;code&gt; are written additively, &lt;code&gt;G_T&lt;&#x2F;code&gt; is written multiplicatively):&lt;&#x2F;p&gt;
&lt;p&gt;(1) &lt;code&gt;e(m * P1, n * P2) = e(P1, P2)^(m * n)&lt;&#x2F;code&gt;
(2) &lt;code&gt;e&lt;&#x2F;code&gt; is non-degenerate&lt;&#x2F;p&gt;
&lt;p&gt;Now observe that&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;log_P1(a1) * log_P2(b1) + ... + log_P1(ak) * log_P2(bk) = 0 (in F_q)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;if and only if&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e(P1, P2)^(log_P1(a1) * log_P2(b1) + ... + log_P1(ak) * log_P2(bk)) = 1 (in G_T)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Furthermore, the left hand side of this equation is equal to&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;e(log_P1(a1) * P1, log_P2(b1) * P2) * ... * e(log_P1(ak) * P1, log_P2(bk) * P2)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;= e(a1, b1) * ... * e(ak, bk)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;And thus, the precompiled contract can be implemented by verifying that
&lt;code&gt;e(a1, b1) * ... * e(ak, bk) = 1&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Implementations are available here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&#x2F;blob&#x2F;master&#x2F;libff&#x2F;algebra&#x2F;curves&#x2F;alt_bn128&#x2F;alt_bn128_g1.hpp&quot;&gt;libff&lt;&#x2F;a&gt; (C++)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zcash&#x2F;bn&#x2F;blob&#x2F;master&#x2F;src&#x2F;groups&#x2F;mod.rs&quot;&gt;bn&lt;&#x2F;a&gt; (Rust)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py_pairing&#x2F;blob&#x2F;master&#x2F;py_ecc&#x2F;bn128&#x2F;bn128_pairing.py&quot;&gt;Python&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128</title>
        <published>2017-02-02T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christian Reitwiessner</name><email>chris@ethereum.org</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/196/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/196/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:196"
            label="EIP-196" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/196/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;Precompiled contracts for elliptic curve operations are required in order to perform zkSNARK verification within the block gas limit.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP suggests to add precompiled contracts for addition and scalar multiplication on a specific pairing-friendly elliptic curve. This can in turn be combined with &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;197&#x2F;&quot;&gt;EIP-197&lt;&#x2F;a&gt; to verify zkSNARKs in Ethereum smart contracts. The general benefit of zkSNARKs for Ethereum is that it will increase the privacy for users (because of the Zero-Knowledge property) and might also be a scalability solution (because of the succinctness and efficient verifiability property).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Current smart contract executions on Ethereum are fully transparent, which makes them unsuitable for several use-cases that involve private information like the location, identity or history of past transactions. The technology of zkSNARKs could be a solution to this problem. While the Ethereum Virtual Machine can make use of zkSNARKs in theory, they are currently too expensive
to fit the block gas limit. Because of that, this EIP proposes to specify certain parameters for some elementary primitives that enable zkSNARKs so that they can be implemented more efficiently and the gas cost be reduced.&lt;&#x2F;p&gt;
&lt;p&gt;Note that while fixing these parameters might look like limiting the use-cases for zkSNARKs, the primitives are so basic that they can be combined in ways that are flexible enough so that it should even be possible to allow future advances in zkSNARK research without the need for a further hard fork.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, add precompiled contracts for point addition (ADD)  and scalar multiplication (MUL) on the elliptic curve &quot;alt_bn128&quot;.&lt;&#x2F;p&gt;
&lt;p&gt;Address of ADD: 0x6
Address for MUL: 0x7&lt;&#x2F;p&gt;
&lt;p&gt;The curve is defined by:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Y^2 = X^3 + 3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;over the field F_p with&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;p = 21888242871839275222246405745257275088696311157297823662689037894645226208583&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;encoding&quot;&gt;Encoding&lt;&#x2F;h3&gt;
&lt;p&gt;Field elements and scalars are encoded as 32 byte big-endian numbers. Curve points are encoded as two field elements &lt;code&gt;(x, y)&lt;&#x2F;code&gt;, where the point at infinity is encoded as &lt;code&gt;(0, 0)&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Tuples of objects are encoded as their concatenation.&lt;&#x2F;p&gt;
&lt;p&gt;For both precompiled contracts, if the input is shorter than expected, it is assumed to be virtually padded with zeros at the end (i.e. compatible with the semantics of the &lt;code&gt;CALLDATALOAD&lt;&#x2F;code&gt; opcode). If the input is longer than expected, surplus bytes at the end are ignored.&lt;&#x2F;p&gt;
&lt;p&gt;The length of the returned data is always as specified (i.e. it is not &quot;unpadded&quot;).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exact-semantics&quot;&gt;Exact semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Invalid input: For both contracts, if any input point does not lie on the curve or any of the field elements (point coordinates) is equal or larger than the field modulus p, the contract fails. The scalar can be any number between &lt;code&gt;0&lt;&#x2F;code&gt; and &lt;code&gt;2**256-1&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;add&quot;&gt;ADD&lt;&#x2F;h4&gt;
&lt;p&gt;Input: two curve points &lt;code&gt;(x, y)&lt;&#x2F;code&gt;.
Output: curve point &lt;code&gt;x + y&lt;&#x2F;code&gt;, where &lt;code&gt;+&lt;&#x2F;code&gt; is point addition on the elliptic curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; specified above.
Fails on invalid input and consumes all gas provided.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;mul&quot;&gt;MUL&lt;&#x2F;h4&gt;
&lt;p&gt;Input: curve point and scalar &lt;code&gt;(x, s)&lt;&#x2F;code&gt;.
Output: curve point &lt;code&gt;s * x&lt;&#x2F;code&gt;, where &lt;code&gt;*&lt;&#x2F;code&gt; is the scalar multiplication on the elliptic curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; specified above.
Fails on invalid input and consumes all gas.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gas-costs&quot;&gt;Gas costs&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Gas cost for &lt;code&gt;ECADD&lt;&#x2F;code&gt;: 500&lt;&#x2F;li&gt;
&lt;li&gt;Gas cost for &lt;code&gt;ECMUL&lt;&#x2F;code&gt;: 40000&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;The specific curve &lt;code&gt;alt_bn128&lt;&#x2F;code&gt; was chosen because it is particularly well-suited for zkSNARKs, or, more specifically their verification building block of pairing functions. Furthermore, by choosing this curve, we can use synergy effects with ZCash and re-use some of their components and artifacts.&lt;&#x2F;p&gt;
&lt;p&gt;The feature of adding curve and field parameters to the inputs was considered but ultimately rejected since it complicates the specification: The gas costs are much harder to determine and it would be possible to call the contracts on something which is not an actual elliptic curve.&lt;&#x2F;p&gt;
&lt;p&gt;A non-compact point encoding was chosen since it still allows to perform some operations in the smart contract itself (inclusion of the full y coordinate) and two encoded points can be compared for equality (no third projective coordinate).&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;As with the introduction of any precompiled contract, contracts that already use the given addresses will change their semantics. Because of that, the addresses are taken from the &quot;reserved range&quot; below 256.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;p&gt;Inputs to test:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Curve points which would be valid if the numbers were taken mod p (should fail).&lt;&#x2F;li&gt;
&lt;li&gt;Both contracts should succeed on empty input.&lt;&#x2F;li&gt;
&lt;li&gt;Truncated input that results in a valid curve point.&lt;&#x2F;li&gt;
&lt;li&gt;Points not on curve (but valid otherwise).&lt;&#x2F;li&gt;
&lt;li&gt;Multiply point with scalar that lies between the order of the group and the field (should succeed).&lt;&#x2F;li&gt;
&lt;li&gt;Multiply point with scalar that is larger than the field order (should succeed).&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation of these primitives are available here:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;scipr-lab&#x2F;libff&#x2F;blob&#x2F;master&#x2F;libff&#x2F;algebra&#x2F;curves&#x2F;alt_bn128&#x2F;alt_bn128_g1.cpp&quot;&gt;libff&lt;&#x2F;a&gt; (C++)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;zcash&#x2F;bn&#x2F;blob&#x2F;master&#x2F;src&#x2F;groups&#x2F;mod.rs&quot;&gt;bn&lt;&#x2F;a&gt; (Rust)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;In both codebases, a specific group on the curve alt_bn128 is used and is called G1.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;py_pairing&#x2F;blob&#x2F;master&#x2F;py_ecc&#x2F;bn128&#x2F;bn128_curve.py&quot;&gt;Python&lt;&#x2F;a&gt; - probably most self-contained and best readable.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Big integer modular exponentiation</title>
        <published>2017-01-30T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/198/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/198/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:198"
            label="EIP-198" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/198/">&lt;h1 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;GQUADDIVISOR: 20&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;At address 0x00......05, add a precompile that expects input in the following format:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;&amp;lt;length_of_BASE&amp;gt; &amp;lt;length_of_EXPONENT&amp;gt; &amp;lt;length_of_MODULUS&amp;gt; &amp;lt;BASE&amp;gt; &amp;lt;EXPONENT&amp;gt; &amp;lt;MODULUS&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where every length is a 32-byte left-padded integer representing the number of bytes to be taken up by the next value. Call data is assumed to be infinitely right-padded with zero bytes, and excess data is ignored. Consumes &lt;code&gt;floor(mult_complexity(max(length_of_MODULUS, length_of_BASE)) * max(ADJUSTED_EXPONENT_LENGTH, 1) &#x2F; GQUADDIVISOR)&lt;&#x2F;code&gt; gas, and if there is enough gas, returns an output &lt;code&gt;(BASE**EXPONENT) % MODULUS&lt;&#x2F;code&gt; as a byte array with the same length as the modulus.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;ADJUSTED_EXPONENT_LENGTH&lt;&#x2F;code&gt; is defined as follows.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;length_of_EXPONENT &amp;lt;= 32&lt;&#x2F;code&gt;, and all bits in &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; are 0, return 0&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;length_of_EXPONENT &amp;lt;= 32&lt;&#x2F;code&gt;, then return the index of the highest bit in &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; (eg. 1 -&amp;gt; 0, 2 -&amp;gt; 1, 3 -&amp;gt; 1, 255 -&amp;gt; 7, 256 -&amp;gt; 8).&lt;&#x2F;li&gt;
&lt;li&gt;If &lt;code&gt;length_of_EXPONENT &amp;gt; 32&lt;&#x2F;code&gt;, then return &lt;code&gt;8 * (length_of_EXPONENT - 32)&lt;&#x2F;code&gt; plus the index of the highest bit in the first 32 bytes of &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; (eg. if &lt;code&gt;EXPONENT = \x00\x00\x01\x00.....\x00&lt;&#x2F;code&gt;, with one hundred bytes, then the result is 8 * (100 - 32) + 253 = 797). If all of the first 32 bytes of &lt;code&gt;EXPONENT&lt;&#x2F;code&gt; are zero, return exactly &lt;code&gt;8 * (length_of_EXPONENT - 32)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;mult_complexity&lt;&#x2F;code&gt; is a function intended to approximate the difficulty of Karatsuba multiplication (used in all major bigint libraries) and is defined as follows.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;def mult_complexity(x):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    if x &amp;lt;= 64: return x ** 2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    elif x &amp;lt;= 1024: return x ** 2 &#x2F;&#x2F; 4 + 96 * x - 3072&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    else: return x ** 2 &#x2F;&#x2F; 16 + 480 * x - 199680&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;For example, the input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Represents the exponent &lt;code&gt;3**(2**256 - 2**32 - 978) % (2**256 - 2**32 - 977)&lt;&#x2F;code&gt;. By Fermat&#x27;s little theorem, this equals 1, so the result is:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Returned as 32 bytes because the modulus length was 32 bytes. The &lt;code&gt;ADJUSTED_EXPONENT_LENGTH&lt;&#x2F;code&gt; would be 255, and the gas cost would be &lt;code&gt;mult_complexity(32) * 255 &#x2F; 20 = 13056&lt;&#x2F;code&gt; gas (note that this is ~8 times the cost of using the EXP opcode to compute a 32-byte exponent). A 4096-bit RSA exponentiation would cost &lt;code&gt;mult_complexity(512) * 4095 &#x2F; 100 = 22853376&lt;&#x2F;code&gt; gas in the worst case, though RSA verification in practice usually uses an exponent of 3 or 65537, which would reduce the gas consumption to 5580 or 89292, respectively.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2e&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would be parsed as a base of 0, exponent of &lt;code&gt;2**256 - 2**32 - 978&lt;&#x2F;code&gt; and modulus of &lt;code&gt;2**256 - 2**32 - 977&lt;&#x2F;code&gt;, and so would return 0. Notice how if the length_of_BASE is 0, then it does not interpret &lt;em&gt;any&lt;&#x2F;em&gt; data as the base, instead immediately interpreting the next 32 bytes as EXPONENT.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would parse a base length of 0, an exponent length of 32, and a modulus length of &lt;code&gt;2**256 - 1&lt;&#x2F;code&gt;, where the base is empty, the exponent is &lt;code&gt;2**256 - 2&lt;&#x2F;code&gt; and the modulus is &lt;code&gt;(2**256 - 3) * 256**(2**256 - 33)&lt;&#x2F;code&gt; (yes, that&#x27;s a really big number). It would then immediately fail, as it&#x27;s not possible to provide enough gas to make that computation.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;8000000000000000000000000000000000000000000000000000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;07&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would parse as a base of 3, an exponent of 65535, and a modulus of &lt;code&gt;2**255&lt;&#x2F;code&gt;, and it would ignore the remaining 0x07 byte.&lt;&#x2F;p&gt;
&lt;p&gt;This input data:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000001&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000002&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0000000000000000000000000000000000000000000000000000000000000020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;03&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;ffff&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;80&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Would also parse as a base of 3, an exponent of 65535 and a modulus of &lt;code&gt;2**255&lt;&#x2F;code&gt;, as it attempts to grab 32 bytes for the modulus starting from 0x80 - but there is no further data, so it right-pads it with 31 zero bytes.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;This allows for efficient RSA verification inside of the EVM, as well as other forms of number theory-based cryptography. Note that adding precompiles for addition and subtraction is not required, as the in-EVM algorithm is efficient enough, and multiplication can be done through this precompile via &lt;code&gt;a * b = ((a + b)**2 - (a - b)**2) &#x2F; 4&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The bit-based exponent calculation is done specifically to fairly charge for the often-used exponents of 2 (for multiplication) and 3 and 65537 (for RSA verification).&lt;&#x2F;p&gt;
&lt;h1 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h1&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Subroutines and Static Jumps for the EVM</title>
        <published>2016-12-10T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Greg Colvin</name><email>greg@colvin.org</email>
	</author>
	
	<author>
		<name>Brooklyn Zelenka</name><uri>https://github.com/expede</uri>
	</author>
	
	<author>
		<name>Paweł Bylica</name><uri>https://github.com/chfast</uri>
	</author>
	
	<author>
		<name>Christian Reitwiessner</name><uri>https://github.com/chriseth</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/615/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://ethereum-magicians.org/t/eip-615-subroutines-and-static-jumps-for-the-evm-last-call/3472" />
        

        <id>https://wg-eips.ritovision.com/615/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:615"
            label="EIP-615" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/615/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;In the 21st century, on a blockchain circulating billions of ETH, formal specification and verification are an essential tool against loss. Yet the design of the EVM makes this unnecessarily difficult. Further, the design of the EVM makes near-linear-time compilation to machine code difficult. We propose to move forward with proposals to resolve these problems by tightening EVM security guarantees and reducing barriers to performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;EVM code is currently difficult to statically analyze, hobbling critical tools for preventing the many expensive bugs our blockchain has experienced. Further, none of the current implementations of the Ethereum Virtual Machine—including the compilers—are sufficiently performant to reduce the need for precompiles and otherwise meet the network&#x27;s long-term demands.  This proposal identifies dynamic jumps as a major reason for these issues, and proposes changes to the EVM specification to address the problem, making further efforts towards a safer and more performant the EVM possible.&lt;&#x2F;p&gt;
&lt;p&gt;We also propose to validate—in near-linear time—that EVM contracts correctly use subroutines, avoid misuse of the stack, and meet other safety conditions &lt;em&gt;before&lt;&#x2F;em&gt; placing them on the blockchain.  Validated code precludes most runtime exceptions and the need to test for them.  And well-behaved control flow and use of the stack makes life easier for interpreters, compilers, formal analysis, and other tools.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Currently the EVM supports only dynamic jumps, where the address to jump to is an argument on the stack.  Worse, the EVM fails to provide ordinary, alternative control flow facilities like subroutines and switches provided by Wasm and most CPUs.  So dynamic jumps cannot be avoided, yet they obscure the structure of the code and thus mostly inhibit control- and data-flow analysis.  This puts the quality and speed of optimized compilation fundamentally at odds.  Further, since many jumps can potentially be to any jump destination in the code, the number of possible paths through the code can go up as the product of the number of jumps by the number of destinations, as does the time complexity of static analysis.  Many of these cases are undecidable at deployment time, further inhibiting static and formal analyses.&lt;&#x2F;p&gt;
&lt;p&gt;However, given Ethereum&#x27;s security requirements, &lt;strong&gt;near-linear&lt;&#x2F;strong&gt; &lt;strong&gt;&lt;code&gt;n log n&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt; &lt;strong&gt;time complexity&lt;&#x2F;strong&gt; is essential.  Otherwise, Contracts can be crafted or discovered with quadratic complexity to use as denial of service attack vectors against validations and optimizations.&lt;&#x2F;p&gt;
&lt;p&gt;But absent dynamic jumps code can be statically analyzed in linear time.  That allows for &lt;em&gt;linear time validation&lt;&#x2F;em&gt;.  It also allows for code generation and such optimizations as can be done in &lt;code&gt;log n&lt;&#x2F;code&gt; time to comprise an &lt;em&gt;&lt;code&gt;n log n&lt;&#x2F;code&gt;&lt;&#x2F;em&gt; &lt;em&gt;time compiler&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;And absent dynamic jumps, and with proper subroutines the EVM is a better target for code generation from other languages, including&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Solidity&lt;&#x2F;li&gt;
&lt;li&gt;Vyper&lt;&#x2F;li&gt;
&lt;li&gt;LLVM IR
&lt;ul&gt;
&lt;li&gt;front ends include C, C++, Common Lisp, D, Fortran, Haskell, Java, Javascript, Kotlin, Lua, Objective-C, Pony, Pure, Python, Ruby, Rust, Scala, Scheme, and Swift&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The result is that all of the following validations and optimizations can be done at deployment time with near-linear &lt;code&gt;(n log n)&lt;&#x2F;code&gt; time complexity.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The absence of most exceptional halting states can be validated.&lt;&#x2F;li&gt;
&lt;li&gt;The maximum use of resources can be sometimes be calculated.&lt;&#x2F;li&gt;
&lt;li&gt;Bytecode can be compiled to machine code in near-linear time.&lt;&#x2F;li&gt;
&lt;li&gt;Compilation can more effectively optimize use of smaller registers.&lt;&#x2F;li&gt;
&lt;li&gt;Compilation can more effectively optimize injection of gas metering.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;dependencies&quot;&gt;Dependencies&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1702&#x2F;&quot;&gt;EIP-1702&lt;&#x2F;a&gt;. Generalized Account Versioning Scheme.&lt;&#x2F;strong&gt; This proposal needs a versioning scheme to allow for its bytecode (and eventually eWasm bytecode) to be deployed with existing bytecode on the same blockchain.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h3 id=&quot;proposal&quot;&gt;Proposal&lt;&#x2F;h3&gt;
&lt;p&gt;We propose to deprecate two existing instructions—&lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt;—and propose new instructions to support their legitimate uses.  In particular, it must remain possible to compile Solidity and Vyper code to EVM bytecode, with no significant loss of performance or increase in gas price.&lt;&#x2F;p&gt;
&lt;p&gt;Especially important is efficient translation to and from &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ewasm&#x2F;design&quot;&gt;eWasm&lt;&#x2F;a&gt; and to machine code.  To that end we maintain a close correspondence between &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;webassembly.github.io&#x2F;spec&#x2F;core&#x2F;_download&#x2F;WebAssembly.pdf&quot;&gt;Wasm&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.intel.com&#x2F;content&#x2F;dam&#x2F;www&#x2F;public&#x2F;us&#x2F;en&#x2F;documents&#x2F;manuals&#x2F;64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf&quot;&gt;x86&lt;&#x2F;a&gt;, &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;static.docs.arm.com&#x2F;100076&#x2F;0100&#x2F;arm_instruction_set_reference_guide_100076_0100_00_en.pdf&quot;&gt;ARM&lt;&#x2F;a&gt; and proposed EVM instructions.&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;EIP-615&lt;&#x2F;th&gt;&lt;th&gt;Wasm&lt;&#x2F;th&gt;&lt;th&gt;x86&lt;&#x2F;th&gt;&lt;th&gt;ARM&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;JUMPTO&lt;&#x2F;td&gt;&lt;td&gt;br&lt;&#x2F;td&gt;&lt;td&gt;JMP&lt;&#x2F;td&gt;&lt;td&gt;B&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPIF&lt;&#x2F;td&gt;&lt;td&gt;br_if&lt;&#x2F;td&gt;&lt;td&gt;JE&lt;&#x2F;td&gt;&lt;td&gt;BEQ&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPV&lt;&#x2F;td&gt;&lt;td&gt;br_table&lt;&#x2F;td&gt;&lt;td&gt;JMP&lt;&#x2F;td&gt;&lt;td&gt;TBH&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPSUB&lt;&#x2F;td&gt;&lt;td&gt;call&lt;&#x2F;td&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;BL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;JUMPSUBV&lt;&#x2F;td&gt;&lt;td&gt;call_indirect&lt;&#x2F;td&gt;&lt;td&gt;CALL&lt;&#x2F;td&gt;&lt;td&gt;BL&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;RETURN&lt;&#x2F;td&gt;&lt;td&gt;return&lt;&#x2F;td&gt;&lt;td&gt;RET&lt;&#x2F;td&gt;&lt;td&gt;RET&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;GETLOCAL&lt;&#x2F;td&gt;&lt;td&gt;local.get&lt;&#x2F;td&gt;&lt;td&gt;POP&lt;&#x2F;td&gt;&lt;td&gt;POP&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;PUTLOCAL&lt;&#x2F;td&gt;&lt;td&gt;local.put&lt;&#x2F;td&gt;&lt;td&gt;PUSH&lt;&#x2F;td&gt;&lt;td&gt;PUSH&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BEGINSUB&lt;&#x2F;td&gt;&lt;td&gt;func&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;BEGINDATA&lt;&#x2F;td&gt;&lt;td&gt;tables&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h4 id=&quot;preliminaries&quot;&gt;Preliminaries&lt;&#x2F;h4&gt;
&lt;p&gt;These forms&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;INSTRUCTION&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;INSTRUCTION x&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&lt;code&gt;INSTRUCTION x, y&lt;&#x2F;code&gt;&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;name an &lt;em&gt;&lt;code&gt;INSTRUCTION&lt;&#x2F;code&gt;&lt;&#x2F;em&gt; with no, one and two arguments, respectively. An instruction is represented in the bytecode as a single-byte opcode. Any arguments are laid out as immediate data bytes following the opcode inline, interpreted as fixed length, MSB-first, two&#x27;s-complement, two-byte positive integers. (Negative values are reserved for extensions.)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;branches-and-subroutines&quot;&gt;Branches and Subroutines&lt;&#x2F;h4&gt;
&lt;p&gt;The two most important uses of &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; are static jumps and return jumps. Conditional and unconditional static jumps are the mainstay of control flow.  Return jumps are implemented as a dynamic jump to a return address pushed on the stack.  With the combination of a static jump and a dynamic return jump you can—and Solidity does—implement subroutines.  The problem is that static analysis cannot tell the one place the return jump is going, so it must analyze every possibility (a heavy analysis).&lt;&#x2F;p&gt;
&lt;p&gt;Static jumps are provided by&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPTO jump_target&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;JUMPIF jump_target&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;which are the same as &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; except that they jump to an immediate &lt;code&gt;jump_target&lt;&#x2F;code&gt; rather than an address on the stack.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;To support subroutines, &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;, &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt;, and &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; are provided.  Brief descriptions follow, and full semantics are given below.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;BEGINSUB n_args, n_results&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;marks the &lt;strong&gt;single&lt;&#x2F;strong&gt; entry to a subroutine.  &lt;code&gt;n_args&lt;&#x2F;code&gt; items are taken off of the stack at entry to, and &lt;code&gt;n_results&lt;&#x2F;code&gt; items are placed on the stack at return from the subroutine.   The subroutine ends at the next &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; instruction (or &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt;, below) or at the end of the bytecode.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPSUB jump_target&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;jumps to an immediate subroutine address.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;returns from the current subroutine to the instruction following the JUMPSUB that entered it.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;switches-callbacks-and-virtual-functions&quot;&gt;Switches, Callbacks, and Virtual Functions&lt;&#x2F;h4&gt;
&lt;p&gt;Dynamic jumps are also used for &lt;code&gt;O(1)&lt;&#x2F;code&gt; indirection: an address to jump to is selected to push on the stack and be jumped to.  So we also propose two more instructions to provide for constrained indirection.  We support these with vectors of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; or &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; offsets stored inline, which can be selected with an index on the stack.  That constrains validation to a specified subset of all possible destinations.  The danger of quadratic blow up is avoided because it takes as much space to store the jump vectors as it does to code the worst case exploit.&lt;&#x2F;p&gt;
&lt;p&gt;Dynamic jumps to a &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; are used to implement &lt;code&gt;O(1)&lt;&#x2F;code&gt; jumptables, which are useful for dense switch statements.  Wasm and most CPUs provide similar instructions.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPV n, jump_targets&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;jumps to one of a vector of &lt;code&gt;n&lt;&#x2F;code&gt; &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; offsets via a zero-based index on the stack.  The vector is stored inline at the &lt;code&gt;jump_targets&lt;&#x2F;code&gt; offset after the BEGINDATA bytecode as MSB-first, two&#x27;s-complement, two-byte positive integers.  If the index is greater than or equal to &lt;code&gt;n - 1&lt;&#x2F;code&gt; the last (default) offset is used.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Dynamic jumps to a &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; are used to implement &lt;code&gt;O(1)&lt;&#x2F;code&gt; virtual functions and callbacks, which take at most two pointer dereferences on most CPUs.   Wasm provides a similar instruction.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;JUMPSUBV n, jump_targets&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;jumps to one of a vector of &lt;code&gt;n&lt;&#x2F;code&gt; &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; offsets via a zero-based index on the stack.  The vector is stored inline at the &lt;code&gt;jump_targets&lt;&#x2F;code&gt; offset after the DATA bytecode, as MSB-first, two&#x27;s-complement, two-byte positive integers.  If the index is greater than or equal to &lt;code&gt;n - 1&lt;&#x2F;code&gt; the last (default) offset is used.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;variable-access&quot;&gt;Variable Access&lt;&#x2F;h4&gt;
&lt;p&gt;These operations provide convenient access to subroutine parameters and local variables at fixed stack offsets within a subroutine.  Otherwise only sixteen variables can be directly addressed.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;PUTLOCAL n&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pops the stack to the local variable &lt;code&gt;n&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;GETLOCAL n&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Pushes the local variable &lt;code&gt;n&lt;&#x2F;code&gt; onto the stack.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Local variable &lt;code&gt;n&lt;&#x2F;code&gt; is the nth stack item below the frame pointer, &lt;code&gt;FP[-n]&lt;&#x2F;code&gt;, as defined below.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data&quot;&gt;Data&lt;&#x2F;h4&gt;
&lt;p&gt;There needs to be a way to place unreachable data into the bytecode that will be skipped over and not validated.  Indirect jump vectors will not be valid code.  Initialization code must create runtime code from data that might not be valid code.  And unreachable data might prove useful to programs for other purposes.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;BEGINDATA&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;specifies that all of the following bytes to the end of the bytecode are data, and not reachable code.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h4 id=&quot;structure&quot;&gt;Structure&lt;&#x2F;h4&gt;
&lt;p&gt;Valid EIP-615 EVM bytecode begins with a valid header.  This is the magic number  ‘\0evm’ followed by the semantic versioning number &#x27;\1\5\0&#x27;.  (For Wasm the header is &#x27;\0asm\1&#x27;).&lt;&#x2F;p&gt;
&lt;p&gt;Following the header is the BEGINSUB opcode for the &lt;em&gt;main&lt;&#x2F;em&gt; routine.  It takes no arguments and returns no values.  Other subroutines may follow the &lt;em&gt;main&lt;&#x2F;em&gt; routine, and an optional BEGINDATA opcode may mark the start of a data section.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;semantics&quot;&gt;Semantics&lt;&#x2F;h3&gt;
&lt;p&gt;Jumps to and returns from subroutines are described here in terms of&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The EVM data stack, (as defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;) usually just called “the stack.”&lt;&#x2F;li&gt;
&lt;li&gt;A return stack of &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; offsets.&lt;&#x2F;li&gt;
&lt;li&gt;A frame stack of frame pointers.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We will adopt the following conventions to describe the machine state:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;program counter&lt;&#x2F;em&gt; &lt;code&gt;PC&lt;&#x2F;code&gt; is (as usual) the byte offset of the currently executing instruction.&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;stack pointer&lt;&#x2F;em&gt; &lt;code&gt;SP&lt;&#x2F;code&gt; corresponds to the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;&#x27;s substate &lt;code&gt;s&lt;&#x2F;code&gt; of the machine state.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;SP[0]&lt;&#x2F;code&gt; is where a new item is can be pushed on the stack.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;SP[1]&lt;&#x2F;code&gt; is the first item on the stack, which can be popped off the stack.&lt;&#x2F;li&gt;
&lt;li&gt;The stack grows towards lower addresses.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;The &lt;em&gt;frame pointer&lt;&#x2F;em&gt; &lt;code&gt;FP&lt;&#x2F;code&gt; is set to &lt;code&gt;SP + n_args&lt;&#x2F;code&gt; at entry to the currently executing subroutine.
&lt;ul&gt;
&lt;li&gt;The &lt;em&gt;stack items&lt;&#x2F;em&gt; between the frame pointer and the current stack pointer are called the &lt;em&gt;frame&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;The current number of items in the frame, &lt;code&gt;FP - SP&lt;&#x2F;code&gt;, is the &lt;em&gt;frame size&lt;&#x2F;em&gt;.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;&#x2F;strong&gt;: Defining the frame pointer so as to include the arguments is unconventional, but better fits our stack semantics and simplifies the remainder of the proposal.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;The frame pointer and return stacks are internal to the subroutine mechanism, and not directly accessible to the program.  This is necessary to prevent the program from modifying its own state in ways that could be invalid.&lt;&#x2F;p&gt;
&lt;p&gt;Execution of EVM bytecode begins with the &lt;em&gt;main&lt;&#x2F;em&gt; routine with no arguments, &lt;code&gt;SP&lt;&#x2F;code&gt; and &lt;code&gt;FP&lt;&#x2F;code&gt; set to 0, and with one value on the return stack—&lt;code&gt;code_size - 1&lt;&#x2F;code&gt;. (Executing the virtual byte of 0 after this offset causes an EVM to stop.  Thus executing a &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; with no prior &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; or &lt;code&gt;JUMBSUBV&lt;&#x2F;code&gt;—that is, in the &lt;em&gt;main&lt;&#x2F;em&gt; routine—executes a &lt;code&gt;STOP&lt;&#x2F;code&gt;.)&lt;&#x2F;p&gt;
&lt;p&gt;Execution of a subroutine begins with &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; or &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt;, which&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;pushes &lt;code&gt;PC&lt;&#x2F;code&gt; on the return stack,&lt;&#x2F;li&gt;
&lt;li&gt;pushes &lt;code&gt;FP&lt;&#x2F;code&gt; on the frame stack
&lt;ul&gt;
&lt;li&gt;thus suspending execution of the current subroutine,&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;FP&lt;&#x2F;code&gt; to &lt;code&gt;SP + n_args&lt;&#x2F;code&gt;, and&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;PC&lt;&#x2F;code&gt; to the specified &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; address
&lt;ul&gt;
&lt;li&gt;thus beginning execution of the new subroutine.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Execution of a subroutine is suspended during and resumed after execution of nested subroutines, and ends upon encountering a &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt;, which&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;sets &lt;code&gt;FP&lt;&#x2F;code&gt; to the top of the virtual frame stack and pops the stack,&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;SP&lt;&#x2F;code&gt; to &lt;code&gt;FP + n_results&lt;&#x2F;code&gt;,&lt;&#x2F;li&gt;
&lt;li&gt;sets &lt;code&gt;PC&lt;&#x2F;code&gt; to top of the return stack and pops the stack, and&lt;&#x2F;li&gt;
&lt;li&gt;advances &lt;code&gt;PC&lt;&#x2F;code&gt; to the next instruction&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;thus resuming execution of the enclosing subroutine or &lt;em&gt;main&lt;&#x2F;em&gt; routine.  A &lt;code&gt;STOP&lt;&#x2F;code&gt; or &lt;code&gt;RETURN&lt;&#x2F;code&gt; also ends the execution of a subroutine.&lt;&#x2F;p&gt;
&lt;p&gt;For example, starting from this stack,&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_________________&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      20 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |             21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and after pushing two arguments and branching with &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; to a &lt;code&gt;BEGINSUB 2, 3&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 10&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;JUMPSUB beginsub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and initializing three local variables&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 99&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PUSH 97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;the stack looks like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;__________________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | arguments   10 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |___________  11&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      99&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             98&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  97&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;After some amount of computation the stack could look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;__________________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | returns     44 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |___________  42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      13&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  14&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and after &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; would look like this&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;_________________&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | locals      20 &amp;lt;- FP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             21&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;frame |___________  22&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      | returns     44&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;      |             43&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;______|___________  42&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                       &amp;lt;- SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;validity&quot;&gt;Validity&lt;&#x2F;h3&gt;
&lt;p&gt;We would like to consider EVM code valid iff no execution of the program can lead to an exceptional halting state, but we must validate code in linear time. So our validation does not consider the code’s data and computations, only its control flow and stack use.  This means we will reject programs with invalid code paths, even if those paths are not reachable.  Most conditions can be validated, and will not need to be checked at runtime; the exceptions are sufficient gas and sufficient stack.  As such, static analysis may yield false negatives belonging to well-understood classes of code requiring runtime checks.  Aside from those cases, we can validate large classes at validation time and with linear complexity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;Execution&lt;&#x2F;em&gt; is as defined in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum.github.io&#x2F;yellowpaper&#x2F;paper.pdf&quot;&gt;Yellow Paper&lt;&#x2F;a&gt;—a sequence of changes in the EVM state.  The conditions on valid code are preserved by state changes.  At runtime, if execution of an instruction would violate a condition the execution is in an exceptional halting state.  The Yellow Paper defines five such states.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1&lt;&#x2F;strong&gt;  Insufficient gas&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2&lt;&#x2F;strong&gt;  More than 1024 stack items&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;3&lt;&#x2F;strong&gt;  Insufficient stack items&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4&lt;&#x2F;strong&gt;  Invalid jump destination&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;5&lt;&#x2F;strong&gt;  Invalid instruction&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We propose to expand and extend the Yellow Paper conditions to handle the new instructions we propose.&lt;&#x2F;p&gt;
&lt;p&gt;To handle the return stack we expand the conditions on stack size:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2a&lt;&#x2F;strong&gt;  The size of the data stack does not exceed 1024.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2b&lt;&#x2F;strong&gt;  The size of the return stack does not exceed 1024.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Given our more detailed description of the data stack we restate condition 3—stack underflow—as&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;3&lt;&#x2F;strong&gt;  &lt;code&gt;SP&lt;&#x2F;code&gt; must be less than or equal to &lt;code&gt;FP&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Since the various &lt;code&gt;DUP&lt;&#x2F;code&gt; and &lt;code&gt;SWAP&lt;&#x2F;code&gt; operations—as well as &lt;code&gt;PUTLOCAL&lt;&#x2F;code&gt; and &lt;code&gt;GETLOCAL&lt;&#x2F;code&gt;—are defined as taking items off the stack and putting them back on, this prevents them from accessing data below the frame pointer, since taking too many items off of the stack would mean that &lt;code&gt;SP&lt;&#x2F;code&gt; is less than &lt;code&gt;FP&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;To handle the new jump instructions and subroutine boundaries, we expand the conditions on jumps and jump destinations.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4a&lt;&#x2F;strong&gt;  &lt;code&gt;JUMPTO&lt;&#x2F;code&gt;, &lt;code&gt;JUMPIF&lt;&#x2F;code&gt;, and &lt;code&gt;JUMPV&lt;&#x2F;code&gt; address only &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; instructions.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4b&lt;&#x2F;strong&gt;  &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; address only &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt; instructions.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;4c&lt;&#x2F;strong&gt;  &lt;code&gt;JUMP&lt;&#x2F;code&gt; instructions do not address instructions outside of the subroutine they occur in.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;We have two new conditions on execution to ensure consistent use of the stack by subroutines:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;6&lt;&#x2F;strong&gt;  For &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; the frame size is at least the &lt;code&gt;n_args&lt;&#x2F;code&gt; of the &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;(s) to jump to.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;7&lt;&#x2F;strong&gt;  For &lt;code&gt;RETURNSUB&lt;&#x2F;code&gt; the frame size is equal to the &lt;code&gt;n_results&lt;&#x2F;code&gt; of the enclosing &lt;code&gt;BEGINSUB&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Finally, we have one condition that prevents pathological uses of the stack:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;8&lt;&#x2F;strong&gt;  For every instruction in the code the frame size is constant.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;In practice, we must test at runtime for conditions 1 and 2—sufficient gas and sufficient stack.  We don’t know how much gas there will be, we don’t know how deep a recursion may go, and analysis of stack depth even for non-recursive programs is nontrivial.&lt;&#x2F;p&gt;
&lt;p&gt;All of the remaining conditions we validate statically.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;costs-codes&quot;&gt;Costs &amp;amp; Codes&lt;&#x2F;h4&gt;
&lt;p&gt;All of the instructions are &lt;code&gt;O(1)&lt;&#x2F;code&gt; with a small constant, requiring just a few machine operations each, whereas a &lt;code&gt;JUMP&lt;&#x2F;code&gt; or &lt;code&gt;JUMPI&lt;&#x2F;code&gt; typically does an &lt;code&gt;O(log n)&lt;&#x2F;code&gt; binary search of an array of &lt;code&gt;JUMPDEST&lt;&#x2F;code&gt; offsets before every jump. With the cost of &lt;code&gt;JUMPI&lt;&#x2F;code&gt; being &lt;em&gt;high&lt;&#x2F;em&gt; and the cost of &lt;code&gt;JUMP&lt;&#x2F;code&gt; being &lt;em&gt;mid&lt;&#x2F;em&gt;, we suggest the cost of &lt;code&gt;JUMPV&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; should be &lt;em&gt;mid&lt;&#x2F;em&gt;, &lt;code&gt;JUMPSUB&lt;&#x2F;code&gt; and &lt;code&gt;JUMPIF&lt;&#x2F;code&gt; should be &lt;em&gt;low&lt;&#x2F;em&gt;, and&lt;code&gt;JUMPTO&lt;&#x2F;code&gt; and the rest should be &lt;em&gt;verylow&lt;&#x2F;em&gt;.  Measurement will tell.&lt;&#x2F;p&gt;
&lt;p&gt;We suggest the following opcodes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb0 JUMPTO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb1 JUMPIF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb2 JUMPV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb3 JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb4 JUMPSUBV&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb5 BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb6 BEGINDATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb7 RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb8 PUTLOCAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xb9 GETLOCAL&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;These changes would need to be implemented in phases at decent intervals:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1.&lt;&#x2F;strong&gt;  If this EIP is accepted, invalid code should be deprecated. Tools should stop generating invalid code, users should stop writing it, and clients should warn about loading it.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;2.&lt;&#x2F;strong&gt;  A later hard fork would require clients to place only valid code on the block chain.  Note that despite the fork old EVM code will still need to be supported indefinitely; older contracts will continue to run, and to create new contracts.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;If desired, the period of deprecation can be extended indefinitely by continuing to accept code not versioned as new—but without validation.  That is, by delaying or canceling phase 2.&lt;&#x2F;p&gt;
&lt;p&gt;Regardless, we will need a versioning scheme like &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;1702&#x2F;&quot;&gt;EIP-1702&lt;&#x2F;a&gt; to allow current code and EIP-615 code to coexist on the same blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;This design was highly constrained by the existing EVM semantics, the requirement for eWasm compatibility, and the security demands of the Ethereum environment.  It was also informed by the lead author&#x27;s previous work implementing Java and Scheme interpreters.  As such there was very little room for alternative designs.&lt;&#x2F;p&gt;
&lt;p&gt;As described above, the approach was simply to deprecate the problematic dynamic jumps, then ask what opcodes were necessary to provide for the features they supported.  These needed to include those provided by eWasm, which themselves were modeled after typical hardware.  The only real innovation was to move the frame pointer and the return pointer to their own stacks, so as to prevent any possibility of overwriting them. (Although Forth also uses a return stack.)  This allowed for treating subroutine arguments as local variables, and facilitated the return of multiple values.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;Implementation of this proposal need not be difficult.  At the least, interpreters can simply be extended with the new opcodes and run unchanged otherwise.  The new opcodes require only stacks for the frame pointers and return offsets and the few pushes, pops, and assignments described above. The bulk of the effort is the validator, which in most languages can almost be transcribed from the pseudocode above.&lt;&#x2F;p&gt;
&lt;p&gt;A lightly tested C++ reference implementation is available in &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;gcolvin&#x2F;aleth&#x2F;tree&#x2F;master&#x2F;libaleth-interpreter&quot;&gt;Greg Colvin&#x27;s Aleth fork.&lt;&#x2F;a&gt;  This version required circa 110 lines of new interpreter code and a well-commented, 178-line validator.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;appendix-a&quot;&gt;Appendix A&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;validation&quot;&gt;Validation&lt;&#x2F;h3&gt;
&lt;p&gt;Validation comprises two tasks:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Check that jump destinations are correct and instructions valid.&lt;&#x2F;li&gt;
&lt;li&gt;Check that subroutines satisfy the conditions on control flow and stack use.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;We sketch out these two validation functions in pseudo-C below.  To simplify the presentation only the five primitives are handled (&lt;code&gt;JUMPV&lt;&#x2F;code&gt; and &lt;code&gt;JUMPSUBV&lt;&#x2F;code&gt; would just add more complexity to loop over their vectors), we assume helper functions for extracting instruction arguments from immediate data and managing the stack pointer and program counter, and some optimizations are forgone.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validating-jumps&quot;&gt;Validating Jumps&lt;&#x2F;h4&gt;
&lt;p&gt;Validating that jumps are to valid addresses takes two sequential passes over the bytecode—one to build sets of jump destinations and subroutine entry points, another to check that addresses jumped to are in the appropriate sets.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytecode[code_size]   &#x2F;&#x2F; contains EVM bytecode to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_sub[code_size]     &#x2F;&#x2F; is there a BEGINSUB at PC?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    is_dest[code_size]    &#x2F;&#x2F; is there a JUMPDEST at PC?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sub_for_pc[code_size] &#x2F;&#x2F; which BEGINSUB is PC in?&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bool validate_jumps(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current_sub = PC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; build sets of BEGINSUBs and JUMPDESTs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (PC = 0; instruction = bytecode[PC]; PC = advance_pc(PC))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is invalid&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINDATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                break;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                is_sub[PC] = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                current_sub = PC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sub_for_pc[PC] = current_sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPDEST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                is_dest[PC] = true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            sub_for_pc[PC] = current_sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; check that targets are in subroutine&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        for (PC = 0; instruction = bytecode[PC]; PC = advance_pc(PC))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINDATA&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                break;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                current_sub = PC&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if is_sub[jump_target(PC)] is false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPTO or JUMPIF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if is_dest[jump_target(PC)] is false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if sub_for_pc[PC] is not current_sub&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;       return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Note that code like this is already run by EVMs to check dynamic jumps, including building the jump destination set every time a contract is run, and doing a lookup in the jump destination set before every jump.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;subroutine-validation&quot;&gt;Subroutine Validation&lt;&#x2F;h4&gt;
&lt;p&gt;This function can be seen as a symbolic execution of a subroutine in the EVM code, where only the effect of the instructions on the state being validated is computed.  Thus the structure of this function is very similar to an EVM interpreter.  This function can also be seen as an acyclic traversal of the directed graph formed by taking instructions as vertices and sequential and branching connections as edges, checking conditions along the way.  The traversal is accomplished via recursion, and cycles are broken by returning when a vertex which has already been visited is reached.  The time complexity of this traversal is &lt;code&gt;O(|E|+|V|)&lt;&#x2F;code&gt;: The sum of the number of edges and number of vertices in the graph.&lt;&#x2F;p&gt;
&lt;p&gt;The basic approach is to call &lt;code&gt;validate_subroutine(i, 0, 0)&lt;&#x2F;code&gt;, for &lt;code&gt;i&lt;&#x2F;code&gt; equal to the first instruction in the EVM code through each &lt;code&gt;BEGINDATA&lt;&#x2F;code&gt; offset.  &lt;code&gt;validate_subroutine()&lt;&#x2F;code&gt; traverses instructions sequentially, recursing when &lt;code&gt;JUMP&lt;&#x2F;code&gt; and &lt;code&gt;JUMPI&lt;&#x2F;code&gt; instructions are encountered.  When a destination is reached that has been visited before it returns, thus breaking cycles.  It returns true if the subroutine is valid, false otherwise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    bytecode[code_size]     &#x2F;&#x2F; contains EVM bytecode to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    frame_size[code_size ]  &#x2F;&#x2F; is filled with -1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; we validate each subroutine individually, as if at top level&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * PC is the offset in the code to start validating at&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * return_pc is the top PC on return stack that RETURNSUB returns to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * at top level FP = SP = 0 is both the frame size and the stack size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    &#x2F;&#x2F; * as items are pushed SP get more negative, so the stack size is -SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    validate_subroutine(PC, return_pc, SP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; traverse code sequentially, recurse for jumps&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        while true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            instruction = bytecode[PC]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; if frame size set we have been here before&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if frame_size[PC] &amp;gt;= 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; check for constant frame size&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if instruction is JUMPDEST&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    if -SP != frame_size[PC]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                        return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; return to break cycle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            frame_size[PC] = -SP&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; effect of instruction on stack&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n_removed = removed_items(instructions)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n_added = added_items(instruction)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; check for stack underflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if -SP &amp;lt; n_removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; net effect of removing and adding stack items&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            SP += n_removed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            SP -= n_added&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; check for stack overflow&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if -SP &amp;gt; 1024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is STOP, RETURN, or SUICIDE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; violates single entry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is BEGINSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                 return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; return to top or from recursion to JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is RETURNSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPSUB&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                &#x2F;&#x2F; check for enough arguments&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                sub_pc = jump_target(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if -SP &amp;lt; n_args(sub_pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; reset PC to destination of jump&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPTO&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                PC = jump_target(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                continue&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; recurse to jump to code to validate&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            if instruction is JUMPIF&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                if not validate_subroutine(jump_target(PC), return_pc, SP)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                    return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            &#x2F;&#x2F; advance PC according to instruction&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            PC = advance_pc(PC)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        &#x2F;&#x2F; check for right number of results&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if (-SP != n_results(return_pc)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return false&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        return true&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;appendix-b&quot;&gt;Appendix B&lt;&#x2F;h2&gt;
&lt;h3 id=&quot;evm-analysis&quot;&gt;EVM Analysis&lt;&#x2F;h3&gt;
&lt;p&gt;There is a large and growing ecosystem of researchers, authors, teachers, auditors, and analytic tools--providing software and services focused on the correctness and security of EVM code.  A small sample is given here.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;some-tools&quot;&gt;Some Tools&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;contract-library.com&#x2F;&quot;&gt;Contract Library&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;ethereumj&quot;&gt;EthereumJ&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;exthereum&#x2F;blockchain&quot;&gt;Exthereum&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ether-camp&#x2F;ethereum-harmony&quot;&gt;Harmony&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.pnfsoftware.com&#x2F;blog&#x2F;ethereum-smart-contract-decompiler&#x2F;&quot;&gt;JEB&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ConsenSys&#x2F;mythril&quot;&gt;Mythril&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;eth-sri&#x2F;securify&quot;&gt;Securify&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.skalelabs.com&#x2F;&quot;&gt;Skale&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;status.im&#x2F;&quot;&gt;Status&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;some-papers&quot;&gt;Some Papers&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.google.com&#x2F;url?q=http:&#x2F;&#x2F;fsl.cs.illinois.edu&#x2F;FSL&#x2F;papers&#x2F;2018&#x2F;park-zhang-saxena-daian-rosu-2018-fse&#x2F;park-zhang-saxena-daian-rosu-2018-fse-public.pdf&quot;&gt;A Formal Verification Tool for Ethereum VM Bytecode&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;pirapira&#x2F;eth-isabelle&quot;&gt;A Lem formalization of EVM and some Isabelle&#x2F;HOL proofs&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;1007.pdf&quot;&gt;A survey of attacks on Ethereum smart contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.google.com&#x2F;url?q=http:&#x2F;&#x2F;fc17.ifca.ai&#x2F;wtsc&#x2F;Defining%2520the%2520Ethereum%2520Virtual%2520Machine%2520for%2520Interactive%2520Theorem%2520Provers.pdf&quot;&gt;Defining the Ethereum Virtual Machine for Interactive Theorem Provers&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;eth2.0-specs&quot;&gt;Ethereum 2.0 Specifications&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.cs.umd.edu&#x2F;~aseem&#x2F;solidetherplas.pdf&quot;&gt;Formal Verification of Smart Contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;jellopaper.org&#x2F;&quot;&gt;JelloPaper: Human Readable Semantics of EVM in K&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.ideals.illinois.edu&#x2F;items&#x2F;102260&quot;&gt;KEVM: A Complete Semantics of the Ethereum Virtual Machine.&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;eprint.iacr.org&#x2F;2016&#x2F;633.pdf&quot;&gt;Making Smart Contracts Smarter&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;arxiv.org&#x2F;pdf&#x2F;1806.01143.pdf&quot;&gt;Securify: Practical Security Analysis of Smart Contracts&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;docs.thundercore.com&#x2F;thunder-whitepaper.pdf&quot;&gt;The Thunder Protocol&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;trustworthy.systems&#x2F;publications&#x2F;full_text&#x2F;Amani_BBS_18.pdf&quot;&gt;Towards Verifying Ethereum Smart Contract Bytecode in Isabelle&#x2F;HOL&lt;&#x2F;a&gt;
*&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;seed&#x2F;eth-isabelle&#x2F;tree&#x2F;evm15&quot;&gt;A Lem formalization of EVM 1.5&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Contract code size limit</title>
        <published>2016-11-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/170/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/170/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:170"
            label="EIP-170" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/170/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt;: &lt;code&gt;0x6000&lt;&#x2F;code&gt; (&lt;code&gt;2**14 + 2**13&lt;&#x2F;code&gt;)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1 (Mainnet)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, then if contract creation initialization returns data with length of &lt;strong&gt;more than&lt;&#x2F;strong&gt; &lt;code&gt;MAX_CODE_SIZE&lt;&#x2F;code&gt; bytes, contract creation fails with an out of gas error.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, there remains one slight quadratic vulnerability in Ethereum: when a contract is called, even though the call takes a constant amount of gas, the call can trigger O(n) cost in terms of reading the code from disk, preprocessing the code for VM execution, and also adding O(n) data to the Merkle proof for the block&#x27;s proof-of-validity. At current gas levels, this is acceptable even if suboptimal. At the higher gas levels that could be triggered in the future, possibly very soon due to dynamic gas limit rules, this would become a greater concern—not nearly as serious as recent denial of service attacks, but still inconvenient especially for future light clients verifying proofs of validity or invalidity. The solution is to put a hard cap on the size of an object that can be saved to the blockchain, and do so non-disruptively by setting the cap at a value slightly higher than what is feasible with current gas limits.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP-170 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;170&lt;&#x2F;li&gt;
&lt;li&gt;pyethereum implementation: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;5217294871283d8dc4fb3ca9d8a78c7d416490e8&#x2F;ethereum&#x2F;messages.py#L397&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State trie clearing (invariant-preserving alternative)</title>
        <published>2016-10-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Gavin Wood</name><uri>https://github.com/gavofyork</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/161/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/161/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:161"
            label="EIP-161" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/161/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1 (Mainnet)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;a. Account creation transactions and the &lt;code&gt;CREATE&lt;&#x2F;code&gt; operation SHALL, prior to the execution of the initialisation code, &lt;strong&gt;increment&lt;&#x2F;strong&gt; the &lt;strong&gt;nonce&lt;&#x2F;strong&gt; over and above its normal starting value by &lt;strong&gt;one&lt;&#x2F;strong&gt; (for normal networks, this will be simply 1, however test-nets with non-zero default starting nonces will be different).&lt;&#x2F;p&gt;
&lt;p&gt;b. Whereas &lt;code&gt;CALL&lt;&#x2F;code&gt; and &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; would charge 25,000 gas when the destination is non-existent, now the charge SHALL &lt;strong&gt;only&lt;&#x2F;strong&gt; be levied if the operation transfers &lt;strong&gt;more than zero value&lt;&#x2F;strong&gt; and the destination account is &lt;em&gt;dead&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;c. No account may &lt;em&gt;change state&lt;&#x2F;em&gt; from non-existent to existent-but-&lt;em&gt;empty&lt;&#x2F;em&gt;. If an operation would do this, the account SHALL instead remain non-existent.&lt;&#x2F;p&gt;
&lt;p&gt;d. &lt;em&gt;At the end of the transaction&lt;&#x2F;em&gt;, any account &lt;em&gt;touched&lt;&#x2F;em&gt; by the execution of that transaction which is now &lt;em&gt;empty&lt;&#x2F;em&gt; SHALL instead become non-existent (i.e. &lt;strong&gt;deleted&lt;&#x2F;strong&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;Where:&lt;&#x2F;p&gt;
&lt;p&gt;An account is considered to be &lt;em&gt;touched&lt;&#x2F;em&gt; when it is involved in any potentially &lt;em&gt;state-changing&lt;&#x2F;em&gt; operation. This includes, but is not limited to, being the recipient of a &lt;strong&gt;transfer of zero value&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An account is considered &lt;em&gt;empty&lt;&#x2F;em&gt; when it has &lt;strong&gt;no code&lt;&#x2F;strong&gt; and &lt;strong&gt;zero nonce&lt;&#x2F;strong&gt; and &lt;strong&gt;zero balance&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;An account is considered &lt;em&gt;dead&lt;&#x2F;em&gt; when either it is non-existent or it is &lt;em&gt;empty&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;At the end of the transaction&lt;&#x2F;em&gt; is immediately following the execution of the suicide list, prior to the determination of the state trie root for receipt population.&lt;&#x2F;p&gt;
&lt;p&gt;An account &lt;em&gt;changes state&lt;&#x2F;em&gt; when:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;it is the target or refund of a &lt;code&gt;SUICIDE&lt;&#x2F;code&gt; operation for &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value;&lt;&#x2F;li&gt;
&lt;li&gt;it is the source or destination of a &lt;code&gt;CALL&lt;&#x2F;code&gt; operation or message-call transaction transferring &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value;&lt;&#x2F;li&gt;
&lt;li&gt;it is the source or creation of a &lt;code&gt;CREATE&lt;&#x2F;code&gt; operation or contract-creation transaction endowing &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value;&lt;&#x2F;li&gt;
&lt;li&gt;as the block author (&quot;miner&quot;) it is the recipient of block-rewards or transaction-fees of &lt;strong&gt;zero or more&lt;&#x2F;strong&gt; value.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;notes&quot;&gt;Notes&lt;&#x2F;h4&gt;
&lt;p&gt;In the present Ethereum protocol, it should be noted that very few state changes can ultimately result in accounts that are empty following the execution of the transaction. In fact there are only four contexts that current implementations need track:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;an empty account has zero value transferred to it through &lt;code&gt;CALL&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;an empty account has zero value transferred to it through &lt;code&gt;SUICIDE&lt;&#x2F;code&gt;;&lt;&#x2F;li&gt;
&lt;li&gt;an empty account has zero value transferred to it through a message-call transaction;&lt;&#x2F;li&gt;
&lt;li&gt;an empty account has zero value transferred to it through a zero-gas-price fees transfer.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Same as #158 except that several edge cases are avoided since we do not break invariants:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;del&gt;that an account can go from having code and storage to not having code or storage mid-way through the execution of a transaction;&lt;&#x2F;del&gt; [corrected]&lt;&#x2F;li&gt;
&lt;li&gt;that a newly created account cannot be deleted prior to being deployed.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;code&gt;CREATE&lt;&#x2F;code&gt; avoids zero in the nonce to avoid any suggestion of the oddity of &lt;code&gt;CREATE&lt;&#x2F;code&gt;d accounts being reaped half-way through their creation.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;addendum-2017-08-15&quot;&gt;Addendum (2017-08-15)&lt;&#x2F;h3&gt;
&lt;p&gt;On 2016-11-24, a consensus bug occurred due to two implementations having different behavior in the case of state reverts.[3] The specification was amended to clarify that empty account deletions are reverted when the state is reverted.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP-158 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;158&lt;&#x2F;li&gt;
&lt;li&gt;EIP-161 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;161&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;blog.ethereum.org&#x2F;2016&#x2F;11&#x2F;25&#x2F;security-alert-11242016-consensus-bug-geth-v1-4-19-v1-5-2&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;Details: Geth was failing to revert empty account deletions when the transaction causing the deletions of empty accounts ended with an out-of-gas exception. An additional issue was found in Parity, where the Parity client incorrectly failed to revert empty account deletions in a more limited set of contexts involving out-of-gas calls to precompiled contracts; the new Geth behavior matches Parity’s, and empty accounts will cease to be a source of concern in general in about one week once the state clearing process finishes.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>EXP cost increase</title>
        <published>2016-10-20T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/160/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/160/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:160"
            label="EIP-160" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/160/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, increase the gas cost of EXP from 10 + 10 per byte in the exponent to 10 + 50 per byte in the exponent.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Benchmarks suggest that EXP is currently underpriced by a factor of about 4–8.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP-160 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;160&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>State clearing</title>
        <published>2016-10-16T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/158/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/158/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:158"
            label="EIP-158" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/158/">&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;For all blocks where &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; (TBA):&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In all cases where a state change is made to an account, and this state change results in the account state being saved with nonce = 0, balance = 0, code empty, storage empty (hereinafter &quot;empty account&quot;), the account is instead deleted.&lt;&#x2F;li&gt;
&lt;li&gt;If an address is &quot;touched&quot; and that address contains an empty account, then it is deleted. A &quot;touch&quot; is defined as any situation where if the account at the given address were nonexistent it would be created.&lt;&#x2F;li&gt;
&lt;li&gt;Whenever the EVM checks if an account exists, emptiness is treated as equivalent to nonexistence. Particularly, note that this implies that, once this change is enabled, there is no longer a meaningful difference between emptiness and nonexistence from the point of view of EVM execution.&lt;&#x2F;li&gt;
&lt;li&gt;Zero-value calls and zero-value suicides no longer consume the 25000 account creation gas cost in any circumstance&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;The cases where a &quot;touch&quot; takes place can be enumerated as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zero-value-bearing CALLs&lt;&#x2F;li&gt;
&lt;li&gt;CREATEs (if the code that is ultimately saved is empty and there is no ether remaining in the account when it is saved)&lt;&#x2F;li&gt;
&lt;li&gt;Zero-value-bearing SUICIDEs&lt;&#x2F;li&gt;
&lt;li&gt;Transaction recipients&lt;&#x2F;li&gt;
&lt;li&gt;Contracts created in contract creation transactions&lt;&#x2F;li&gt;
&lt;li&gt;Miners receiving transaction fees (note the case where the gasprice is zero, and the account does not yet exist because it only receives the block&#x2F;uncle&#x2F;nephew rewards &lt;em&gt;after&lt;&#x2F;em&gt; processing every transaction)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification-1b&quot;&gt;Specification (1b)&lt;&#x2F;h3&gt;
&lt;p&gt;When the EVM checks for emptiness (for the purpose of possibly applying the 25000 gas cost), emptiness is defined by &lt;code&gt;is_empty(acct): return get_balance(acct) == 0 and get_code(acct) == &quot;&quot; and get_nonce(acct) == 0&lt;&#x2F;code&gt;; emptiness of storage does not matter. This simplifies client implementation because there is no need to add extra complexity to make caches enumerable in the correct way and does not significantly affect the intended result, as the cases where balance&#x2F;code&#x2F;nonce are empty but storage is nonempty where this change would lead to an extra 25000 gas being paid are pathological and have no real use value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification-1c&quot;&gt;Specification (1c)&lt;&#x2F;h3&gt;
&lt;p&gt;Do not implement point 2 above (ie. no new empty accounts can be created, but existing ones are not automatically destroyed unless their state is actually &lt;em&gt;changed&lt;&#x2F;em&gt;). Instead, during each block starting from (and including) N and ending when there are no null accounts left, select the 1000 null accounts that are left-most in order of sha3(address), and delete them (ordering by hash is necessary so as to allow the accounts to be easily found by iterating the tree).&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;This removes a large number of empty accounts that have been put in the state at very low cost due to flaws in earlier versions of the Ethereum protocol, thereby greatly reducing state size and hence both reducing the hard disk load of a full client and reducing the time for a fast sync. Additionally, it simplifies the protocol in the long term, as once all &quot;empty&quot; objects are cleared out there is no longer any meaningful distinction between an account being empty and being nonexistent, and indeed one can simply view nonexistence as a compact representation of emptiness.&lt;&#x2F;p&gt;
&lt;p&gt;Note that this proposal does introduce a &lt;strong&gt;temporary&lt;&#x2F;strong&gt; breaking of existing guarantees, in that by repeatedly zero-value-calling already existing empty accounts one can create a state change at a cost of 700 gas per account instead of the usual 5000 per gas minimum (with SUICIDE refunds this goes down further to 350 gas per account). Allowing such a large number of state writes per block will lead to heightened block processing times and increase uncle rates in the short term while the existing empty accounts are being cleared, and eventually once all empty accounts are cleared this issue will no longer exist.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;references&quot;&gt;References&lt;&#x2F;h1&gt;
&lt;ol&gt;
&lt;li&gt;EIP-158 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;158&lt;&#x2F;li&gt;
&lt;li&gt;EIP-161 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;161&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Simple replay attack protection</title>
        <published>2016-10-14T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/155/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/155/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:155"
            label="EIP-155" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/155/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;607&#x2F;&quot;&gt;Spurious Dragon&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;FORK_BLKNUM&lt;&#x2F;code&gt;: 2,675,000&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;: 1 (main net)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; and &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; is available, then when computing the hash of a transaction for the purposes of signing, instead of hashing only six rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data)&lt;&#x2F;code&gt;, you &lt;strong&gt;SHOULD&lt;&#x2F;strong&gt; hash nine rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data, chainid, 0, 0)&lt;&#x2F;code&gt;.  If you do, then the &lt;code&gt;v&lt;&#x2F;code&gt; of the signature &lt;strong&gt;MUST&lt;&#x2F;strong&gt; be set to &lt;code&gt;{0,1} + CHAIN_ID * 2 + 35&lt;&#x2F;code&gt; where &lt;code&gt;{0,1}&lt;&#x2F;code&gt; is the parity of the &lt;code&gt;y&lt;&#x2F;code&gt; value of the curve point for which &lt;code&gt;r&lt;&#x2F;code&gt; is the x-value in the secp256k1 signing process.  If you choose to only hash 6 values, then &lt;code&gt;v&lt;&#x2F;code&gt; continues to be set to &lt;code&gt;{0,1} + 27&lt;&#x2F;code&gt; as previously.&lt;&#x2F;p&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt; and &lt;code&gt;v = CHAIN_ID * 2 + 35&lt;&#x2F;code&gt; or &lt;code&gt;v = CHAIN_ID * 2 + 36&lt;&#x2F;code&gt;, then when computing the hash of a transaction for purposes of recovering, instead of hashing six rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data)&lt;&#x2F;code&gt;, hash nine rlp encoded elements &lt;code&gt;(nonce, gasprice, startgas, to, value, data, chainid, 0, 0)&lt;&#x2F;code&gt;. The currently existing signature scheme using &lt;code&gt;v = 27&lt;&#x2F;code&gt; and &lt;code&gt;v = 28&lt;&#x2F;code&gt; remains valid and continues to operate under the same rules as it did previously.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example&quot;&gt;Example&lt;&#x2F;h3&gt;
&lt;p&gt;Consider a transaction with &lt;code&gt;nonce = 9&lt;&#x2F;code&gt;, &lt;code&gt;gasprice = 20 * 10**9&lt;&#x2F;code&gt;, &lt;code&gt;startgas = 21000&lt;&#x2F;code&gt;, &lt;code&gt;to = 0x3535353535353535353535353535353535353535&lt;&#x2F;code&gt;, &lt;code&gt;value = 10**18&lt;&#x2F;code&gt;, &lt;code&gt;data=&#x27;&#x27;&lt;&#x2F;code&gt; (empty).&lt;&#x2F;p&gt;
&lt;p&gt;The &quot;signing data&quot; becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xec098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a764000080018080&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The &quot;signing hash&quot; becomes:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xdaf5a779ae972f972197303d7b574746c7ef83eadac0f2791ad23db92e4c8e53&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If the transaction is signed with the private key &lt;code&gt;0x4646464646464646464646464646464646464646464646464646464646464646&lt;&#x2F;code&gt;, then the v,r,s values become:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;(37, 18515461264373351373200002665853028612451056578545711640558177340181847433846, 46948507304638947509940763649030358759909902576025900602547168820602576006531)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Notice the use of 37 instead of 27. The signed tx would become:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;0xf86c098504a817c800825208943535353535353535353535353535353535353535880de0b6b3a76400008025a028ef61340bd939bc2195fe537567866003e1a15d3c71ff63e1590620aa636276a067cbe9d8997f761aecb703304b3800ccf555c9f3dc64214b297fb1966a3b6d83&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This would provide a way to send transactions that work on Ethereum without working on ETC or the Morden testnet. ETC is encouraged to adopt this EIP but replacing &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; with a different value, and all future testnets, consortium chains and alt-etherea are encouraged to adopt this EIP replacing &lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt; with a unique value.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;list-of-chain-id-s&quot;&gt;List of Chain ID&#x27;s:&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;&lt;code&gt;CHAIN_ID&lt;&#x2F;code&gt;&lt;&#x2F;th&gt;&lt;th&gt;Chain(s)&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Ethereum mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;Morden (disused), Expanse mainnet&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;Ropsten&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;Rinkeby&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;Goerli&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;42&lt;&#x2F;td&gt;&lt;td&gt;Kovan&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;1337&lt;&#x2F;td&gt;&lt;td&gt;Geth private chains (default)&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;Find more chain ID&#x27;s on &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;chainid.network&quot;&gt;chainid.network&lt;&#x2F;a&gt; and contribute to &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum-lists&#x2F;chains&quot;&gt;ethereum-lists&#x2F;chains&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Add BLAKE2 compression function `F` precompile</title>
        <published>2016-10-04T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Tjaden Hess</name><email>tah83@cornell.edu</email>
	</author>
	
	<author>
		<name>Matt Luongo</name><uri>https://github.com/mhluongo</uri>
	</author>
	
	<author>
		<name>Piotr Dyraga</name><uri>https://github.com/pdyraga</uri>
	</author>
	
	<author>
		<name>James Hancock</name><uri>https://github.com/MadeOfTin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/152/" type="text/html"/>
        
        
        <link rel="replies" type="text/html" href="https://github.com/ethereum/EIPs/issues/152" />
        

        <id>https://wg-eips.ritovision.com/152/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:152"
            label="EIP-152" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/152/">&lt;h2 id=&quot;simple-summary&quot;&gt;Simple Summary&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP will enable the BLAKE2b hash function and other higher-round 64-bit BLAKE2 variants to run cheaply on the EVM, allowing easier interoperability between Ethereum and Zcash as well as other Equihash-based PoW coins.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h2&gt;
&lt;p&gt;This EIP introduces a new precompiled contract which implements the compression function &lt;code&gt;F&lt;&#x2F;code&gt; used in the BLAKE2 cryptographic hashing algorithm, for the purpose of allowing interoperability between the EVM and Zcash, as well as introducing more flexible cryptographic hash primitives to the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h2&gt;
&lt;p&gt;Besides being a useful cryptographic hash function and SHA3 finalist, BLAKE2 allows for efficient verification of the Equihash PoW used in Zcash, making a BTC Relay - style SPV client possible on Ethereum. A single verification of an Equihash PoW verification requires 512 iterations of the hash function, making verification of Zcash block headers prohibitively expensive if a Solidity implementation of BLAKE2 is used.&lt;&#x2F;p&gt;
&lt;p&gt;BLAKE2b, the common 64-bit BLAKE2 variant, is highly optimized and faster than MD5 on modern processors.&lt;&#x2F;p&gt;
&lt;p&gt;Interoperability with Zcash could enable contracts like trustless atomic swaps between the chains, which could provide a much needed aspect of privacy to the very public Ethereum blockchain.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h2&gt;
&lt;p&gt;We propose adding a precompiled contract at address &lt;code&gt;0x09&lt;&#x2F;code&gt; wrapping the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7693#section-3.2&quot;&gt;BLAKE2 &lt;code&gt;F&lt;&#x2F;code&gt; compression function&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile requires 6 inputs tightly encoded, taking exactly 213 bytes, as explained below. The encoded inputs are corresponding to the ones specified in the &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7693#section-3.2&quot;&gt;BLAKE2 RFC Section 3.2&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rounds&lt;&#x2F;code&gt; - the number of rounds - 32-bit unsigned big-endian word&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;h&lt;&#x2F;code&gt; - the state vector - 8 unsigned 64-bit little-endian words&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;m&lt;&#x2F;code&gt; - the message block vector - 16 unsigned 64-bit little-endian words&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;t_0, t_1&lt;&#x2F;code&gt; - offset counters - 2 unsigned 64-bit little-endian words&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;f&lt;&#x2F;code&gt; - the final block indicator flag - 8-bit word&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[4 bytes for rounds][64 bytes for h][128 bytes for m][8 bytes for t_0][8 bytes for t_1][1 byte for f]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The boolean &lt;code&gt;f&lt;&#x2F;code&gt; parameter is considered as &lt;code&gt;true&lt;&#x2F;code&gt; if set to &lt;code&gt;1&lt;&#x2F;code&gt;.
The boolean &lt;code&gt;f&lt;&#x2F;code&gt; parameter is considered as &lt;code&gt;false&lt;&#x2F;code&gt; if set to &lt;code&gt;0&lt;&#x2F;code&gt;.
All other values yield an invalid encoding of &lt;code&gt;f&lt;&#x2F;code&gt; error.&lt;&#x2F;p&gt;
&lt;p&gt;The precompile should compute the &lt;code&gt;F&lt;&#x2F;code&gt; function as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7693#section-3.2&quot;&gt;specified in the RFC&lt;&#x2F;a&gt; and return the updated state vector &lt;code&gt;h&lt;&#x2F;code&gt; with unchanged encoding (little-endian).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;example-usage-in-solidity&quot;&gt;Example Usage in Solidity&lt;&#x2F;h3&gt;
&lt;p&gt;The precompile can be wrapped easily in Solidity to provide a more development-friendly interface to &lt;code&gt;F&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;solidity&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;uint32&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; rounds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bytes8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; args &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; abi&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;encodePacked&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rounds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  assembly&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    if&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; iszero&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;staticcall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;not&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x09&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;args&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0xd5&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0x40&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;      revert&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span&gt; output&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;function&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; callF&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; public&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; view&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; returns&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  uint32&lt;&#x2F;span&gt;&lt;span&gt; rounds &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 12&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  h&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes32&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;6162630000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  m&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;3&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000000000000000000000000000000000000000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bytes8&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; memory&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0300000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  t&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; hex&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;&amp;quot;0000000000000000&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-support&quot;&gt;  bool&lt;&#x2F;span&gt;&lt;span&gt; f &lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; true&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Expected output:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-comment&quot;&gt;  &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; 7d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;  return&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt; F&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;rounds&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; m&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; f&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;gas-costs-and-benchmarks&quot;&gt;Gas costs and benchmarks&lt;&#x2F;h3&gt;
&lt;p&gt;Each operation will cost &lt;code&gt;GFROUND * rounds&lt;&#x2F;code&gt; gas, where &lt;code&gt;GFROUND = 1&lt;&#x2F;code&gt;. Detailed benchmarks are presented in the benchmarks appendix section.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h2&gt;
&lt;p&gt;BLAKE2 is an excellent candidate for precompilation. BLAKE2 is heavily optimized for modern 64-bit CPUs, specifically utilizing 24 and 63-bit rotations to allow parallelism through SIMD instructions and little-endian arithmetic. These characteristics provide exceptional speed on native CPUs: 3.08 cycles per byte, or 1 gibibyte per second on an Intel i5.&lt;&#x2F;p&gt;
&lt;p&gt;In contrast, the big-endian 32 byte semantics of the EVM are not conducive to efficient implementation of BLAKE2, and thus the gas cost associated with computing the hash on the EVM is disproportionate to the true cost of computing the function natively.&lt;&#x2F;p&gt;
&lt;p&gt;An obvious implementation would be a direct BLAKE2b hash function precompile. At first glance, a BLAKE2b precompile satisfies most hashing and interoperability requirements on the EVM. Once we started digging in, however, it became clear that any BLAKE2b implementation would need specific features and internal modifications based on different projects&#x27; requirements and libraries.&lt;&#x2F;p&gt;
&lt;p&gt;A &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;152#issuecomment-499240310&quot;&gt;thread with the Zcash team&lt;&#x2F;a&gt; makes the issue clear.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;The minimal thing that is necessary for a working ZEC-ETH relay is an implementation of BLAKE2b Compression F in a precompile.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;A BLAKE2b Compression Function F precompile would also suffice for the Filecoin and Handshake interop goals.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;A full BLAKE2b precompile would suffice for a ZEC-ETH relay, provided that the implementation provided the parts of the BLAKE2 API that we need (personalization, maybe something else—I&#x27;m not sure).&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;I&#x27;m not 100% certain if a full BLAKE2b precompile would also suffice for the Filecoin and Handshake goals. It almost certainly could, provided that it supports all the API that they need.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;BLAKE2s — whether the Compression Function F or the full hash — is only a nice-to-have for the purposes of a ZEC-ETH relay.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;From this and other conversations with teams in the space, we believe we should focus first on the &lt;code&gt;F&lt;&#x2F;code&gt; precompile as a strictly necessary piece for interoperability projects. A BLAKE2b precompile is a nice-to-have, and we support any efforts to add one-- but it&#x27;s unclear whether complete requirements and a flexible API can be found in time for Istanbul.&lt;&#x2F;p&gt;
&lt;p&gt;Implementation of only the core F compression function also allows substantial flexibility and extensibility while keeping changes at the protocol level to a minimum. This will allow functions like tree hashing, incremental hashing, and keyed, salted, and personalized hashing as well as variable length digests, none of which are currently available on the EVM.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h2&gt;
&lt;p&gt;There is very little risk of breaking backwards-compatibility with this EIP, the sole issue being if someone were to build a contract relying on the address at &lt;code&gt;0x09&lt;&#x2F;code&gt; being empty. The likelihood of this is low, and should specific instances arise, the address could be chosen to be any arbitrary value with negligible risk of collision.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;test-cases&quot;&gt;Test Cases&lt;&#x2F;h2&gt;
&lt;h4 id=&quot;test-vector-0&quot;&gt;Test vector 0&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input: (empty)&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;input length for BLAKE2 F precompile should be exactly 213 bytes&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-1&quot;&gt;Test vector 1&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;00000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;input length for BLAKE2 F precompile should be exactly 213 bytes&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-2&quot;&gt;Test vector 2&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;000000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;input length for BLAKE2 F precompile should be exactly 213 bytes&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-3&quot;&gt;Test vector 3&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000002&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: error &quot;incorrect final block indicator flag&quot;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-4&quot;&gt;Test vector 4&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000048c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;08c9bcf367e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d282e6ad7f520e511f6c3e2b8c68059b9442be0454267ce079217e1319cde05b&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-5&quot;&gt;Test vector 5&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output: &lt;code&gt;ba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-6&quot;&gt;Test vector 6&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000c48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;75ab69d3190a562c51aef8d88f1c2775876944407270c42c9844252c26d2875298743e7f6d5ea2f2d3e8d226039cd31b4e426ac4f2d3d666a610c2116fde4735&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-7&quot;&gt;Test vector 7&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;0000000148c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;b63a380cb2897d521994a85234ee2c181b5f844d2c624c002677e9703449d2fba551b3a8333bcdf5f2f7e08993d53923de3d64fcc68c034e717b9293fed7a421&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;test-vector-8&quot;&gt;Test vector 8&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;input:
&lt;code&gt;ffffffff48c9bdf267e6096a3ba7ca8485ae67bb2bf894fe72f36e3cf1361d5f3af54fa5d182e6ad7f520e511f6c3e2b8c68059b6bbd41fbabd9831f79217e1319cde05b61626300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;output:
&lt;code&gt;fc59093aafa9ab43daae0e914c57635c5402d8e3d2130eb9b3cc181de7f0ecf9b22bf99a7815ce16419e200e01846e6b5df8cc7703041bbceb571de6631d2615&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h2&gt;
&lt;p&gt;An initial implementation of the &lt;code&gt;F&lt;&#x2F;code&gt; function in Go, adapted from the standard library, can be found in our &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;keep-network&#x2F;blake2-f&quot;&gt;Golang BLAKE2 library fork&lt;&#x2F;a&gt;. There&#x27;s also an implementation of the precompile in our fork of &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;keep-network&#x2F;go-ethereum&#x2F;pull&#x2F;4&quot;&gt;go-ethereum&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;p&gt;For reference, further discussion on this EIP also occurred in the following PRs and issues&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;152&quot;&gt;Original Issue&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;ethereum-magicians.org&#x2F;t&#x2F;blake2b-f-precompile&#x2F;3157&quot;&gt;Ethereum Magicians&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;pull&#x2F;2129&quot;&gt;PR 2129&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;appendix-benchmarks&quot;&gt;Appendix - benchmarks&lt;&#x2F;h2&gt;
&lt;p&gt;Assuming ecRecover precompile is perfectly priced, we executed a set of benchmarks comparing Blake2b F compression function precompile with ecRecover precompile. For benchmarks, we used 3.1 GHz Intel Core i7 64-bit machine.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; sysctl&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; machdep.cpu.brand_string&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;Intel(R&lt;&#x2F;span&gt;&lt;span&gt;) Core(&lt;&#x2F;span&gt;&lt;span class=&quot;z-entity z-name&quot;&gt;TM&lt;&#x2F;span&gt;&lt;span&gt;) i7-7920HQ CPU @ 3.10GHz&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;12-rounds&quot;&gt;12 rounds&lt;&#x2F;h3&gt;
&lt;p&gt;An average gas price of F precompile call with 12 rounds compared to ecRecover should have been &lt;code&gt;6.74153&lt;&#x2F;code&gt; and it gives &lt;code&gt;0.5618&lt;&#x2F;code&gt; gas per round.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name                                         Gascost         Time (ns)     MGas&#x2F;S    Gasprice for 10MGas&#x2F;S    Gasprice for ECDSA eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------  ---------  ----------------  ---------  -----------------------  -----------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledEcrecover&#x2F;                           3000  152636              19.6546                 1526.36               3000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_0               12     338              35.503                     3.38                  6.64326&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_3               12     336              35.7143                    3.36                  6.60395&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_70              12     362              33.1492                    3.62                  7.11497&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_140             12     339              35.3982                    3.39                  6.66291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_230             12     339              35.3982                    3.39                  6.66291&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_300             12     343              34.9854                    3.43                  6.74153&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_370             12     336              35.7143                    3.36                  6.60395&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_440             12     337              35.6083                    3.37                  6.6236&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_510             12     345              34.7826                    3.45                  6.78084&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_580             12     355              33.8028                    3.55                  6.97738&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Columns&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;MGas&#x2F;S&lt;&#x2F;code&gt; - Shows what MGas per second was measured on that machine at that time&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Gasprice for 10MGas&#x2F;S&lt;&#x2F;code&gt; shows what the gasprice should have been, in order to reach 10 MGas&#x2F;second&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;Gasprice for ECDSA eq&lt;&#x2F;code&gt; shows what the gasprice should have been, in order to have the same cost&#x2F;cycle as ecRecover&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;1200-rounds&quot;&gt;1200 rounds&lt;&#x2F;h3&gt;
&lt;p&gt;An average gas price of F precompile call with 1200 rounds compared to ecRecover should have been &lt;code&gt;436.1288&lt;&#x2F;code&gt; and it gives &lt;code&gt;0.3634&lt;&#x2F;code&gt; gas per round.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name                                         Gascost         Time (ns)     MGas&#x2F;S    Gasprice for 10MGas&#x2F;S    Gasprice for ECDSA eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------  ---------  ----------------  ---------  -----------------------  -----------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledEcrecover&#x2F;                           3000  156152              19.212                  1561.52               3000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_0             1200   22642              52.9989                  226.42                434.999&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_3             1200   22885              52.4361                  228.85                439.668&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_70            1200   22737              52.7774                  227.37                436.824&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_140           1200   22602              53.0926                  226.02                434.231&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_230           1200   22501              53.331                   225.01                432.29&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_300           1200   22435              53.4879                  224.35                431.022&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_370           1200   22901              52.3995                  229.01                439.975&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_440           1200   23134              51.8717                  231.34                444.452&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_510           1200   22608              53.0786                  226.08                434.346&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_580           1200   22563              53.1844                  225.63                433.481&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;1-round&quot;&gt;1 round&lt;&#x2F;h3&gt;
&lt;p&gt;An average gas price of F precompile call with 1 round compared to ecRecover should have been &lt;code&gt;2.431701&lt;&#x2F;code&gt;. However, in this scenario the call cost would totally overshadow the dynamic cost anyway.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Name                                         Gascost         Time (ns)      MGas&#x2F;S    Gasprice for 10MGas&#x2F;S    Gasprice for ECDSA eq&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;-----------------------------------------  ---------  ----------------  ----------  -----------------------  -----------------------&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledEcrecover&#x2F;                           3000  157544              19.0423                  1575.44               3000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_0                1     126               7.93651                    1.26                  2.39933&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_3                1     127               7.87402                    1.27                  2.41837&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_70               1     128               7.8125                     1.28                  2.43741&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_140              1     125               8                          1.25                  2.38029&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_230              1     128               7.8125                     1.28                  2.43741&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_300              1     127               7.87402                    1.27                  2.41837&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_370              1     131               7.63359                    1.31                  2.49454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_440              1     129               7.75194                    1.29                  2.45646&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_510              1     125               8                          1.25                  2.38029&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;PrecompiledBlake2F&#x2F;testVectors2bX_580              1     131               7.63359                    1.31                  2.49454&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h2 id=&quot;copyright&quot;&gt;Copyright&lt;&#x2F;h2&gt;
&lt;p&gt;Copyright and related rights waived via &lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;license&#x2F;&quot;&gt;CC0&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas cost changes for IO-heavy operations</title>
        <published>2016-09-24T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/150/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/150/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:150"
            label="EIP-150" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/150/">&lt;h3 id=&quot;meta-reference&quot;&gt;Meta reference&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;608&#x2F;&quot;&gt;Tangerine Whistle&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;FORK_BLKNUM&lt;&#x2F;th&gt;&lt;th&gt;CHAIN_ID&lt;&#x2F;th&gt;&lt;th&gt;CHAIN_NAME&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;2,463,000&lt;&#x2F;td&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;Main net&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= FORK_BLKNUM&lt;&#x2F;code&gt;, then:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Increase the gas cost of EXTCODESIZE to 700 (from 20).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the base gas cost of EXTCODECOPY to 700 (from 20).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of BALANCE to 400 (from 20).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of SLOAD to 200 (from 50).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of CALL, DELEGATECALL, CALLCODE to 700 (from 40).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the gas cost of SELFDESTRUCT to 5000 (from 0).&lt;&#x2F;li&gt;
&lt;li&gt;If SELFDESTRUCT hits a newly created account, it triggers an additional gas cost of 25000 (similar to CALLs).&lt;&#x2F;li&gt;
&lt;li&gt;Increase the recommended gas limit target to 5.5 million.&lt;&#x2F;li&gt;
&lt;li&gt;Define &quot;all but one 64th&quot; of &lt;code&gt;N&lt;&#x2F;code&gt; as &lt;code&gt;N - floor(N &#x2F; 64)&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;If a call asks for more gas than the maximum allowed amount (i.e. the total amount of gas remaining in the parent after subtracting the gas cost of the call and memory expansion), do not return an OOG error; instead, if a call asks for more gas than all but one 64th of the maximum allowed amount, call with all but one 64th of the maximum allowed amount of gas (this is equivalent to a version of EIP-90&lt;sup&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;90&quot;&gt;1&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt; plus EIP-114&lt;sup&gt;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;114&quot;&gt;2&lt;&#x2F;a&gt;&lt;&#x2F;sup&gt;). CREATE only provides all but one 64th of the parent gas to the child call.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;That is, substitute:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        extra_gas = (not ext.account_exists(to)) * opcodes.GCALLNEWACCOUNT + \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (value &amp;gt; 0) * opcodes.GCALLVALUETRANSFER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if compustate.gas &amp;lt; gas + extra_gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return vm_exception(&amp;#39;OUT OF GAS&amp;#39;, needed=gas+extra_gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        submsg_gas = gas + opcodes.GSTIPEND * (value &amp;gt; 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;With:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        def max_call_gas(gas):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;          return gas - (gas &#x2F;&#x2F; 64)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        extra_gas = (not ext.account_exists(to)) * opcodes.GCALLNEWACCOUNT + \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            (value &amp;gt; 0) * opcodes.GCALLVALUETRANSFER&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if compustate.gas &amp;lt; extra_gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            return vm_exception(&amp;#39;OUT OF GAS&amp;#39;, needed=extra_gas)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        if compustate.gas &amp;lt; gas + extra_gas:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            gas = min(gas, max_call_gas(compustate.gas - extra_gas))&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        submsg_gas = gas + opcodes.GSTIPEND * (value &amp;gt; 0)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Recent denial-of-service attacks have shown that opcodes that read the state tree are under-priced relative to other opcodes. There are software changes that have been made, are being made and can be made in order to mitigate the situation; however, the fact will remain that such opcodes will be by a substantial margin the easiest known mechanism to degrade network performance via transaction spam. The concern arises because it takes a long time to read from disk, and is additionally a risk to future sharding proposals as the &quot;attack transactions&quot; that have so far been most successful in degrading network performance would also require tens of megabytes to provide Merkle proofs for. This EIP increases the cost of storage reading opcodes to address this concern. The costs have been derived from an updated version of the calculation table used to generate the 1.0 gas costs: https:&#x2F;&#x2F;docs.google.com&#x2F;spreadsheets&#x2F;d&#x2F;15wghZr-Z6sRSMdmRmhls9dVXTOpxKy8Y64oy9MvDZEQ&#x2F;edit#gid=0; the rules attempt to target a limit of 8 MB of data that needs to be read in order to process a block, and include an estimate of 500 bytes for a Merkle proof for SLOAD and 1000 for an account.&lt;&#x2F;p&gt;
&lt;p&gt;This EIP aims to be simple, and adds a flat penalty of 300 gas on top of the costs calculated in this table to account for the cost of loading the code (~17–21 kb in the worst case).&lt;&#x2F;p&gt;
&lt;p&gt;The EIP 90 gas mechanic is introduced because without it, all current contracts that make calls would stop working as they use an expression like &lt;code&gt;msg.gas - 40&lt;&#x2F;code&gt; to determine how much gas to make a call with, relying on the gas cost of calls being 40. Additionally, EIP 114 is introduced because, given that we are making the cost of a call higher and less predictable, we have an opportunity to do it at no extra cost to currently available guarantees, and so we also achieve the benefit of replacing the call stack depth limit with a &quot;softer&quot; gas-based restriction, thereby eliminating call stack depth attacks as a class of attack that contract developers have to worry about and hence increasing contract programming safety. Note that with the given parameters, the de-facto maximum call stack depth is limited to ~340 (down from ~1024), mitigating the harm caused by any further potential quadratic-complexity DoS attacks that rely on calls.&lt;&#x2F;p&gt;
&lt;p&gt;The gas limit increase is recommended so as to preserve the de-facto transactions-per-second processing capability of the system for average contracts.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;&#x2F;h2&gt;
&lt;ol&gt;
&lt;li&gt;EIP-90, https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;90&lt;&#x2F;li&gt;
&lt;li&gt;EIP-114, https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;114&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Change difficulty adjustment to target mean block time including uncles</title>
        <published>2016-04-28T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/100/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/100/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:100"
            label="EIP-100" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/100/">&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;Currently, the formula to compute the difficulty of a block includes the following logic:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;adj_factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;99&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;child_diff&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt;max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;difficulty&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; BLOCK_DIFF_FACTOR&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; adj_factor&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;difficulty&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; MIN_DIFF&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= BYZANTIUM_FORK_BLKNUM&lt;&#x2F;code&gt;, we change the first line to the following:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;adj_factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; if&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;uncles&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; else&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;99&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This new formula ensures that the difficulty adjustment algorithm targets a constant average rate of blocks produced including uncles, and so ensures a highly predictable issuance rate that cannot be manipulated upward by manipulating the uncle rate. A formula that accounts for the exact number of included uncles:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;adj_factor&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; max&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-support&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;uncles&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; parent&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;timestamp&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 9&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;99&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;can be fairly easily seen to be (to within a tolerance of ~3&#x2F;4194304) mathematically equivalent to assuming that a block with &lt;code&gt;k&lt;&#x2F;code&gt; uncles is equivalent to a sequence of &lt;code&gt;k+1&lt;&#x2F;code&gt; blocks that all appear with the exact same timestamp, and this is likely the simplest possible way to accomplish the desired effect. But since the exact formula depends on the full block and not just the header, we are instead using an approximate formula that accomplishes almost the same effect but has the benefit that it depends only on the block header (as you can check the uncle hash against the blank hash).&lt;&#x2F;p&gt;
&lt;p&gt;Changing the denominator from 10 to 9 ensures that the block time remains roughly the same (in fact, it should decrease by ~3% given the current uncle rate of 7%).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;EIP 100 issue and discussion: https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;100&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;bitslog.wordpress.com&#x2F;2016&#x2F;04&#x2F;28&#x2F;uncle-mining-an-ethereum-consensus-protocol-flaw&#x2F;&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Gas Usage for `RETURN` and `CALL*`</title>
        <published>2015-11-22T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Christian Reitwiessner</name><email>c@ethdev.com</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/5/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/5/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        

        
        <category
            term="tag:eip:5"
            label="EIP-5" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/5/">&lt;h3 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h3&gt;
&lt;p&gt;This EIP makes it possible to call functions that return strings and other dynamically-sized arrays.
Currently, when another contract &#x2F; function is called from inside the Ethereum Virtual Machine,
the size of the output has to be specified in advance. It is of course possible to give a larger
size, but gas also has to be paid for memory that is not written to, which makes returning
dynamically-sized data both costly and inflexible to the extent that it is actually unusable.&lt;&#x2F;p&gt;
&lt;p&gt;The solution proposed in this EIP is to charge gas only for memory that is actually written to at
the time the &lt;code&gt;CALL&lt;&#x2F;code&gt; returns.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;The gas and memory semantics for &lt;code&gt;CALL&lt;&#x2F;code&gt;, &lt;code&gt;CALLCODE&lt;&#x2F;code&gt; and &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; (called later as &lt;code&gt;CALL*&lt;&#x2F;code&gt;)
are changed in the following way (&lt;code&gt;CREATE&lt;&#x2F;code&gt; does not write to memory and is thus unaffected):&lt;&#x2F;p&gt;
&lt;p&gt;Suppose the arguments to &lt;code&gt;CALL*&lt;&#x2F;code&gt; are &lt;code&gt;gas, address, value, input_start, input_size, output_start, output_size&lt;&#x2F;code&gt;,
then, at the beginning of the opcode, gas for growing memory is only charged for &lt;code&gt;input_start + input_size&lt;&#x2F;code&gt;, but not
for &lt;code&gt;output_start + output_size&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;If the called contract returns data of size &lt;code&gt;n&lt;&#x2F;code&gt;, the memory of the calling contract is grown to
&lt;code&gt;output_start + min(output_size, n)&lt;&#x2F;code&gt; (and the calling contract is charged gas for that) and the
output is written to the area &lt;code&gt;[output_start, output_start + min(n, output_size))&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;The calling contract can run out of gas both at the beginning of the opcode and at the end
of the opcode.&lt;&#x2F;p&gt;
&lt;p&gt;After the call, the &lt;code&gt;MSIZE&lt;&#x2F;code&gt; opcode should return the size the memory was actually grown to.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h3&gt;
&lt;p&gt;In general, it is good practice to reserve a certain memory area for the output of a call,
because letting a subroutine write to arbitrary areas in memory might be dangerous. On the
other hand, it is often hard to know the output size of a call prior to performing the call:
The data could be in the storage of another contract which is generally inaccessible and
determining its size would require another call to that contract.&lt;&#x2F;p&gt;
&lt;p&gt;Furthermore, charging gas for areas of memory that are not actually written to is unnecessary.&lt;&#x2F;p&gt;
&lt;p&gt;This proposal tries to solve both problems: A caller can choose to provide a gigantic area of
memory at the end of their memory area. The callee can &quot;write&quot; to it by returning and the
caller is only charged for the memory area that is actually written.&lt;&#x2F;p&gt;
&lt;p&gt;This makes it possible to return dynamic data like strings and dynamically-sized arrays
in a very flexible way. It is even possible to determine the size of the returned data:
If the caller uses &lt;code&gt;output_start = MSIZE&lt;&#x2F;code&gt; and &lt;code&gt;output_size = 2**256-1&lt;&#x2F;code&gt;, the area of
memory that was actually written to is &lt;code&gt;(output_start, MSIZE)&lt;&#x2F;code&gt; (here, &lt;code&gt;MSIZE&lt;&#x2F;code&gt; as evaluated
after the call). This is important because it allows &quot;proxy&quot; contracts
which call other contracts whose interface they do not know and just return their output,
i.e. they both forward the input and the output. For this, it is important that the caller
(1) does not need to know the size of the output in advance and (2) can determine the
size of the output after the call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This way of dealing with the problem requires a minimal change to the Ethereum Virtual Machine.
Other means of achieving a similar goal would have changed the opcodes themselves or
the number of their arguments. Another possibility would have been to only change the
gas mechanics if &lt;code&gt;output_size&lt;&#x2F;code&gt; is equal to &lt;code&gt;2**256-1&lt;&#x2F;code&gt;. Since the main difficulty in the
implementation is that memory has to be enlarged at two points in the code around &lt;code&gt;CALL&lt;&#x2F;code&gt;,
this would not have been a simplification.&lt;&#x2F;p&gt;
&lt;p&gt;At an earlier stage, it was proposed to also add the size of the returned data on the stack,
but the &lt;code&gt;MSIZE&lt;&#x2F;code&gt; mechanism described above should be sufficient and is much better
backwards compatible.&lt;&#x2F;p&gt;
&lt;p&gt;Some comments are available at https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;EIPs&#x2F;issues&#x2F;8&lt;&#x2F;p&gt;
&lt;h3 id=&quot;backwards-compatibility&quot;&gt;Backwards Compatibility&lt;&#x2F;h3&gt;
&lt;p&gt;This proposal changes the semantics of contracts because contracts can access the gas counter
and the size of memory.&lt;&#x2F;p&gt;
&lt;p&gt;On the other hand, it is unlikely that existing contracts will suffer from this change due to
the following reasons:&lt;&#x2F;p&gt;
&lt;p&gt;Gas:&lt;&#x2F;p&gt;
&lt;p&gt;The VM will not charge more gas than before. Usually, contracts are written in a way such
that their semantics do not change if they use up less gas. If more gas were used, contracts
might go out-of-gas if they perform a tight estimation for gas needed by sub-calls. Here,
contracts might only return more gas to their callers.&lt;&#x2F;p&gt;
&lt;p&gt;Memory size:&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;code&gt;MSIZE&lt;&#x2F;code&gt; opcode is typically used to allocate memory at a previously unused spot.
The change in semantics affects existing contracts in two ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Overlaps in allocated memory. By using &lt;code&gt;CALL&lt;&#x2F;code&gt;, a contract might have wanted to allocate
a certain slice of memory, even if that is not written to by the called contract.
Subsequent uses of &lt;code&gt;MSIZE&lt;&#x2F;code&gt; to allocate memory might overlap with this slice that is
now smaller than before the change. It is, though, unlikely that such contracts exist.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Memory addresses change. Rather general, if memory is allocated using &lt;code&gt;MSIZE&lt;&#x2F;code&gt;, the
addresses of objects in memory will be different after the change. Contracts should
all be written in a way, though, such that objects in memory are &lt;em&gt;relocatable&lt;&#x2F;em&gt;,
i.e. their absolute position in memory and their relative position to other
objects does not matter. This is of course not the case for arrays, but they
are allocated in a single allocation and not with an intermediate &lt;code&gt;CALL&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;VM implementers should take care not to grow the memory until the end of the call and after a check that sufficient
gas is still available. Typical uses of the EIP include &quot;reserving&quot; &lt;code&gt;2**256-1&lt;&#x2F;code&gt; bytes of memory for the output.&lt;&#x2F;p&gt;
&lt;p&gt;Python implementation:&lt;&#x2F;p&gt;
&lt;p&gt;old: http:&#x2F;&#x2F;vitalik.ca&#x2F;files&#x2F;old.py
new: http:&#x2F;&#x2F;vitalik.ca&#x2F;files&#x2F;new.py&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Addition of CALLDEPTH opcode</title>
        <published>2015-11-19T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Martin Holst Swende</name><email>martin@swende.se</email>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/3/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/3/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="withdrawn"
                label="Withdrawn" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:3"
            label="EIP-3" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/3/">&lt;h1 id=&quot;abstract&quot;&gt;Abstract&lt;&#x2F;h1&gt;
&lt;p&gt;This is a proposal to add a new opcode, &lt;code&gt;CALLDEPTH&lt;&#x2F;code&gt;. The &lt;code&gt;CALLDEPTH&lt;&#x2F;code&gt; opcode would return the remaining available call stack depth.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;motivation&quot;&gt;Motivation&lt;&#x2F;h1&gt;
&lt;p&gt;There is a limit specifying how deep contracts can call other contracts; the call stack. The limit is currently &lt;code&gt;256&lt;&#x2F;code&gt;. If a contract invokes another contract (either via &lt;code&gt;CALL&lt;&#x2F;code&gt; or &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;), the operation will fail if the call stack depth limit has been reached.&lt;&#x2F;p&gt;
&lt;p&gt;This behaviour makes it possible to subject a contract to a &quot;call stack attack&quot; [1]. In such an attack, an attacker first creates a suitable depth of the stack, e.g. by recursive calls. After this step, the attacker invokes the targeted contract. If the targeted calls another contract, that call will fail. If the return value is not properly checked to see if the call was successful, the consequences could be damaging.&lt;&#x2F;p&gt;
&lt;p&gt;Example:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Contract &lt;code&gt;A&lt;&#x2F;code&gt; wants to be invoked regularly, and pays Ether to the invoker in every block.&lt;&#x2F;li&gt;
&lt;li&gt;When contract &lt;code&gt;A&lt;&#x2F;code&gt; is invoked, it calls contracts &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;C&lt;&#x2F;code&gt;, which consumes a lot of gas. After invocation, contract &lt;code&gt;A&lt;&#x2F;code&gt; pays Ether to the caller.&lt;&#x2F;li&gt;
&lt;li&gt;Malicious user &lt;code&gt;X&lt;&#x2F;code&gt; ensures that the stack depth is shallow before invoking A. Both calls to &lt;code&gt;B&lt;&#x2F;code&gt; and &lt;code&gt;C&lt;&#x2F;code&gt; fail, but &lt;code&gt;X&lt;&#x2F;code&gt; can still collect the reward.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It is possible to defend against this in two ways:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Check return value after invocation.&lt;&#x2F;li&gt;
&lt;li&gt;Check call stack depth experimentally. A library [2] by Piper Merriam exists for this purpose. This method is quite costly in gas.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;[1] a.k.a &quot;shallow stack attack&quot; and &quot;stack attack&quot;. However, to be precise, the word &#x27;&#x27;stack&#x27;&#x27; has a different meaning within the EVM, and is not to be confused with the &#x27;&#x27;call stack&#x27;&#x27;.&lt;&#x2F;p&gt;
&lt;p&gt;[2] https:&#x2F;&#x2F;github.com&#x2F;pipermerriam&#x2F;ethereum-stack-depth-lib&lt;&#x2F;p&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;The opcode &lt;code&gt;CALLDEPTH&lt;&#x2F;code&gt; should return the remaining call stack depth. A value of &lt;code&gt;0&lt;&#x2F;code&gt; means that the call stack is exhausted, and no further calls can be made.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;The actual call stack depth, as well as the call stack depth limit, are present in the EVM during execution, but just not available within the EVM. The implementation should be fairly simple and would provide a cheap and way to protect against call stack attacks.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;Not implemented.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Serenity Currency and Crypto Abstraction</title>
        <published>2015-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/101/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/101/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="stagnant"
                label="Stagnant" />
            
        

        
        <category
            term="tag:eip:101"
            label="EIP-101" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/101/">&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Accounts now have only two fields in their RLP encoding: &lt;strong&gt;code&lt;&#x2F;strong&gt; and &lt;strong&gt;storage&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Ether is no longer stored in account objects directly; instead, at address &lt;code&gt;0&lt;&#x2F;code&gt;, we premine a contract which contains all ether holdings. The &lt;code&gt;eth.getBalance&lt;&#x2F;code&gt; command in web3 is remapped appropriately.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;msg.value&lt;&#x2F;code&gt; no longer exists as an opcode.&lt;&#x2F;li&gt;
&lt;li&gt;A transaction now only has four fields: &lt;strong&gt;to&lt;&#x2F;strong&gt;, &lt;strong&gt;startgas&lt;&#x2F;strong&gt;, &lt;strong&gt;data&lt;&#x2F;strong&gt; and &lt;strong&gt;code&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Aside from an RLP validity check, and checking that the &lt;strong&gt;to&lt;&#x2F;strong&gt; field is twenty bytes long, the &lt;strong&gt;startgas&lt;&#x2F;strong&gt; is an integer, and &lt;strong&gt;code&lt;&#x2F;strong&gt; is either empty or hashes to the &lt;strong&gt;to&lt;&#x2F;strong&gt; address, there are no other validity constraints; anything goes. However, the block gas limit remains, so miners are disincentivized from including junk.&lt;&#x2F;li&gt;
&lt;li&gt;Gas is charged for bytes in &lt;strong&gt;code&lt;&#x2F;strong&gt; at the same rate as &lt;strong&gt;data&lt;&#x2F;strong&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;When a transaction is sent, if the receiving account does not yet exist, the account is created, and its code is set to the code provided in the transaction; otherwise the code is ignored.&lt;&#x2F;li&gt;
&lt;li&gt;A &lt;code&gt;tx.gas&lt;&#x2F;code&gt; opcode is added alongside the existing &lt;code&gt;msg.gas&lt;&#x2F;code&gt; at index &lt;code&gt;0x5c&lt;&#x2F;code&gt;; this new opcode allows the transaction to access the original amount of gas allotted for the transaction&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;Note that &lt;code&gt;ECRECOVER&lt;&#x2F;code&gt;, sequence number&#x2F;nonce incrementing and ether are now nowhere in the bottom-level spec (NOTE: ether is going to continue to have a privileged role in Casper PoS). To replicate existing functionality under the new model, we do the following.&lt;&#x2F;p&gt;
&lt;p&gt;Simple user accounts can have the following default standardized code:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; We assume that data takes the following schema:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 0-31: v (ECDSA sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 32-63: r (ECDSA sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 64-95: s (ECDSA sig)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 96-127: sequence number (formerly called &amp;quot;nonce&amp;quot;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 128-159: gasprice&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 172-191: to&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; bytes 192+: data&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Get the hash for transaction signing&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;mstore&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sha3&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Call ECRECOVER contract to get the sender&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;5000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 3&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;h&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 128&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; ref&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;addr&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 32&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check sender correctness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span&gt; addr&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;82a978b3f5962a5b0957d9ee9eef472ee55b42f1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Check sequence number correctness&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;assert&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;96&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Increment sequence number&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;storage&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Make the sub-call and discard output&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;160&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 192&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment&quot;&gt;#&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment&quot;&gt; Pay for gas&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;40000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;SEND&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;coinbase&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;128&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;span&gt;tx&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; +&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 50000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 96&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This essentially implements signature and nonce checking, and if both checks pass then it uses all remaining gas minus 50000 to send the actual desired call, and then finally pays for gas.&lt;&#x2F;p&gt;
&lt;p&gt;Miners can follow the following algorithm upon receiving transactions:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Run the code for a maximum of 50000 gas, stopping if they see an operation or call that threatens to go over this limit&lt;&#x2F;li&gt;
&lt;li&gt;Upon seeing that operation, make sure that it leaves at least 50000 gas to spare (either by checking that the static gas consumption is small enough or by checking that it is a call with &lt;code&gt;msg.gas - 50000&lt;&#x2F;code&gt; as its gas limit parameter)&lt;&#x2F;li&gt;
&lt;li&gt;Pattern-match to make sure that gas payment code at the end is &lt;em&gt;exactly&lt;&#x2F;em&gt; the same as in the code above.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;This process ensures that miners &lt;em&gt;waste&lt;&#x2F;em&gt; at most 50000 gas before knowing whether or not it will be worth their while to include the transaction, and is also highly general so users can experiment with new cryptography (eg. ed25519, Lamport), ring signatures, quasi-native multisig, etc. Theoretically, one can even create an account for which the &lt;em&gt;valid signature&lt;&#x2F;em&gt; type is a valid Merkle branch of a receipt, creating a quasi-native alarm clock.&lt;&#x2F;p&gt;
&lt;p&gt;If someone wants to send a transaction with nonzero value, instead of the current &lt;code&gt;msg.sender&lt;&#x2F;code&gt; approach, we compile into a three step process:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;In the outer scope just before calling, call the ether contract to create a cheque for the desired amount&lt;&#x2F;li&gt;
&lt;li&gt;In the inner scope, if a contract uses the &lt;code&gt;msg.value&lt;&#x2F;code&gt; opcode anywhere in the function that is being called, then we have the contract cash out the cheque at the start of the function call and store the amount cashed out in a standardized address in memory&lt;&#x2F;li&gt;
&lt;li&gt;In the outer scope just after calling, send a message to the ether contract to disable the cheque if it has not yet been cashed&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;This allows for a large increase in generality, particularly in a few
areas:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;Cryptographic algorithms used to secure accounts (we could reasonably say that Ethereum is quantum-safe, as one is perfectly free to secure one&#x27;s account with Lamport signatures). The nonce-incrementing approach is now also open to revision on the part of account holders, allowing for experimentation in k-parallelizable nonce techniques, UTXO schemes, etc.&lt;&#x2F;li&gt;
&lt;li&gt;Moving ether up a level of abstraction, with the particular benefit of allowing ether and sub-tokens to be treated similarly by contracts&lt;&#x2F;li&gt;
&lt;li&gt;Reducing the level of indirection required for custom-policy accounts such as multisigs&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;It also substantially simplifies and &lt;em&gt;purifies&lt;&#x2F;em&gt; the underlying Ethereum protocol, reducing the minimal consensus implementation complexity.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h3&gt;
&lt;p&gt;Coming soon.&lt;&#x2F;p&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>Homestead Hard-fork Changes</title>
        <published>2015-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/2/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/2/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        

        
        <category
            term="tag:eip:2"
            label="EIP-2" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/2/">&lt;h3 id=&quot;meta-reference&quot;&gt;Meta reference&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;606&#x2F;&quot;&gt;Homestead&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;FORK_BLKNUM&lt;&#x2F;th&gt;&lt;th&gt;CHAIN_NAME&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1,150,000&lt;&#x2F;td&gt;&lt;td&gt;Main net&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;494,000&lt;&#x2F;td&gt;&lt;td&gt;Morden&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;0&lt;&#x2F;td&gt;&lt;td&gt;Future testnets&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h1 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h1&gt;
&lt;p&gt;If &lt;code&gt;block.number &amp;gt;= HOMESTEAD_FORK_BLKNUM&lt;&#x2F;code&gt;, do the following:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The gas cost &lt;em&gt;for creating contracts via a transaction&lt;&#x2F;em&gt; is increased from 21,000 to 53,000, i.e. if you send a transaction and the to address is the empty string, the initial gas subtracted is 53,000 plus the gas cost of the tx data, rather than 21,000 as is currently the case. Contract creation from a contract using the &lt;code&gt;CREATE&lt;&#x2F;code&gt; opcode is unaffected.&lt;&#x2F;li&gt;
&lt;li&gt;All transaction signatures whose s-value is greater than &lt;code&gt;secp256k1n&#x2F;2&lt;&#x2F;code&gt; are now considered invalid. The ECDSA recover precompiled contract remains unchanged and will keep accepting high s-values; this is useful e.g. if a contract recovers old Bitcoin signatures.&lt;&#x2F;li&gt;
&lt;li&gt;If contract creation does not have enough gas to pay for the final gas fee for adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) rather than leaving an empty contract.&lt;&#x2F;li&gt;
&lt;li&gt;Change the difficulty adjustment algorithm from the current formula: &lt;code&gt;block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * (1 if block_timestamp - parent_timestamp &amp;lt; 13 else -1) + int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt; (where the &lt;code&gt;int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt; represents the exponential difficulty adjustment component) to &lt;code&gt;block_diff = parent_diff + parent_diff &#x2F;&#x2F; 2048 * max(1 - (block_timestamp - parent_timestamp) &#x2F;&#x2F; 10, -99) + int(2**((block.number &#x2F;&#x2F; 100000) - 2))&lt;&#x2F;code&gt;, where &lt;code&gt;&#x2F;&#x2F;&lt;&#x2F;code&gt; is the integer division operator, eg. &lt;code&gt;6 &#x2F;&#x2F; 2 = 3&lt;&#x2F;code&gt;, &lt;code&gt;7 &#x2F;&#x2F; 2 = 3&lt;&#x2F;code&gt;, &lt;code&gt;8 &#x2F;&#x2F; 2 = 4&lt;&#x2F;code&gt;. The &lt;code&gt;minDifficulty&lt;&#x2F;code&gt; still defines the minimum difficulty allowed and no adjustment may take it below this.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h1 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h1&gt;
&lt;p&gt;Currently, there is an excess incentive to create contracts via transactions, where the cost is 21,000, rather than contracts, where the cost is 32,000. Additionally, with the help of suicide refunds, it is currently possible to make a simple ether value transfer using only 11,664 gas; the code for doing this is as follows:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; tester&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; from&lt;&#x2F;span&gt;&lt;span&gt; ethereum&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; utils&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; t&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;state&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; c&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;abi_contract&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt;def init():&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span class=&quot;z-string&quot;&gt; suicide(0x47e25df8822538a8596b28c637896b4d143c351e)&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable&quot;&gt; endowment&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;10&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;15&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_receipts&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;-&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas_used&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;11664&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;span&gt; s&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;block&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_balance&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;normalize_address&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt;0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;47e25df8822538a8596b28c637896b4d143c351e&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;1000000000000000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This is not a particularly serious problem, but it is nevertheless arguably a bug.&lt;&#x2F;p&gt;
&lt;p&gt;Allowing transactions with any s value with &lt;code&gt;0 &amp;lt; s &amp;lt; secp256k1n&lt;&#x2F;code&gt;, as is currently the case, opens a transaction malleability concern, as one can take any transaction, flip the s value from &lt;code&gt;s&lt;&#x2F;code&gt; to &lt;code&gt;secp256k1n - s&lt;&#x2F;code&gt;, flip the v value (&lt;code&gt;27 -&amp;gt; 28&lt;&#x2F;code&gt;, &lt;code&gt;28 -&amp;gt; 27&lt;&#x2F;code&gt;), and the resulting signature would still be valid. This is not a serious security flaw, especially since Ethereum uses addresses and not transaction hashes as the input to an ether value transfer or other transaction, but it nevertheless creates a UI inconvenience as an attacker can cause the transaction that gets confirmed in a block to have a different hash from the transaction that any user sends, interfering with user interfaces that use transaction hashes as tracking IDs. Preventing high s values removes this problem.&lt;&#x2F;p&gt;
&lt;p&gt;Making contract creation go out-of-gas if there is not enough gas to pay for the final gas fee has the benefits that:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;(i) it creates a more intuitive &quot;success or fail&quot; distinction in the result of a contract creation process, rather than the current &quot;success, fail, or empty contract&quot; trichotomy;&lt;&#x2F;li&gt;
&lt;li&gt;(ii) makes failures more easily detectable, as unless contract creation fully succeeds then no contract account will be created at all; and&lt;&#x2F;li&gt;
&lt;li&gt;(iii) makes contract creation safer in the case where there is an endowment, as there is a guarantee that either the entire initiation process happens or the transaction fails and the endowment is refunded.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The difficulty adjustment change conclusively solves a problem that the Ethereum protocol saw two months ago where an excessive number of miners were mining blocks that contain a timestamp equal to &lt;code&gt;parent_timestamp + 1&lt;&#x2F;code&gt;; this skewed the block time distribution, and so the current block time algorithm, which targets a &lt;em&gt;median&lt;&#x2F;em&gt; of 13 seconds, continued to target the same median but the mean started increasing. If 51% of miners had started mining blocks in this way, the mean would have increased to infinity. The proposed new formula is roughly based on targeting the mean; one can prove that with the formula in use, an average block time longer than 24 seconds is mathematically impossible in the long term.&lt;&#x2F;p&gt;
&lt;p&gt;The use of &lt;code&gt;(block_timestamp - parent_timestamp) &#x2F;&#x2F; 10&lt;&#x2F;code&gt; as the main input variable rather than the time difference directly serves to maintain the coarse-grained nature of the algorithm, preventing an excessive incentive to set the timestamp difference to exactly 1 in order to create a block that has slightly higher difficulty and that will thus be guaranteed to beat out any possible forks. The cap of -99 simply serves to ensure that the difficulty does not fall extremely far if two blocks happen to be very far apart in time due to a client security bug or other black-swan issue.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;implementation&quot;&gt;Implementation&lt;&#x2F;h1&gt;
&lt;p&gt;This is implemented in Python here:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;processblock.py#L130&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;processblock.py#L129&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;processblock.py#L304&lt;&#x2F;li&gt;
&lt;li&gt;https:&#x2F;&#x2F;github.com&#x2F;ethereum&#x2F;pyethereum&#x2F;blob&#x2F;d117c8f3fd93359fc641fd850fa799436f7c43b5&#x2F;ethereum&#x2F;blocks.py#L42&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
</content>
    </entry>
    <entry xml:lang="en">
        <title>DELEGATECALL</title>
        <published>2015-11-15T00:00:00+00:00</published>
        <updated>2026-02-11T14:49:27+00:00</updated>
	
	
	<author>
		<name>Vitalik Buterin</name><uri>https://github.com/vbuterin</uri>
	</author>
	
	
        <link rel="alternate" href="https://wg-eips.ritovision.com/7/" type="text/html"/>
        

        <id>https://wg-eips.ritovision.com/7/</id>
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;type&#x2F;"
                term="standards-track"
                label="Standards Track" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;category&#x2F;"
                term="core"
                label="Core" />
            
        
            
            
            
            <category
                scheme="https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;status&#x2F;"
                term="final"
                label="Final" />
            
        

        
        <category
            term="tag:eip:7"
            label="EIP-7" />
        

        
        

        
        <content type="html"  xml:base="https://wg-eips.ritovision.com/7/">&lt;h3 id=&quot;hard-fork&quot;&gt;Hard Fork&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;wg-eips.ritovision.com&#x2F;606&#x2F;&quot;&gt;Homestead&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;parameters&quot;&gt;Parameters&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;Activation:
&lt;ul&gt;
&lt;li&gt;Block &amp;gt;= 1,150,000 on Mainnet&lt;&#x2F;li&gt;
&lt;li&gt;Block &amp;gt;= 494,000 on Morden&lt;&#x2F;li&gt;
&lt;li&gt;Block &amp;gt;= 0 on future testnets&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;overview&quot;&gt;Overview&lt;&#x2F;h3&gt;
&lt;p&gt;Add a new opcode, &lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt; at &lt;code&gt;0xf4&lt;&#x2F;code&gt;, which is similar in idea to &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, except that it propagates the sender and value from the parent scope to the child scope, i.e. the call created has the same sender and value as the original call.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;specification&quot;&gt;Specification&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;code&gt;DELEGATECALL&lt;&#x2F;code&gt;: &lt;code&gt;0xf4&lt;&#x2F;code&gt;, takes 6 operands:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;gas&lt;&#x2F;code&gt;: the amount of gas the code may use in order to execute;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;to&lt;&#x2F;code&gt;: the destination address whose code is to be executed;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_offset&lt;&#x2F;code&gt;: the offset into memory of the input;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;in_size&lt;&#x2F;code&gt;: the size of the input in bytes;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;out_offset&lt;&#x2F;code&gt;: the offset into memory of the output;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;out_size&lt;&#x2F;code&gt;: the size of the scratch pad for the output.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;notes-on-gas&quot;&gt;Notes on gas&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The basic stipend is not given; &lt;code&gt;gas&lt;&#x2F;code&gt; is the total amount the callee receives.&lt;&#x2F;li&gt;
&lt;li&gt;Like &lt;code&gt;CALLCODE&lt;&#x2F;code&gt;, account creation never happens, so the upfront gas cost is always &lt;code&gt;schedule.callGas&lt;&#x2F;code&gt; + &lt;code&gt;gas&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;Unused gas is refunded as normal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;notes-on-sender&quot;&gt;Notes on sender&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CALLER&lt;&#x2F;code&gt; and &lt;code&gt;VALUE&lt;&#x2F;code&gt; behave exactly in the callee&#x27;s environment as they do in the caller&#x27;s environment.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;other-notes&quot;&gt;Other notes&lt;&#x2F;h4&gt;
&lt;ul&gt;
&lt;li&gt;The depth limit of 1024 is still preserved as normal.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;rationale&quot;&gt;Rationale&lt;&#x2F;h3&gt;
&lt;p&gt;Propagating the sender and value from the parent scope to the child scope makes it much easier for a contract to store another address as a mutable source of code and &#x27;&#x27;pass through&#x27;&#x27; calls to it, as the child code would execute in essentially the same environment (except for reduced gas and increased callstack depth) as the parent.&lt;&#x2F;p&gt;
&lt;p&gt;Use case 1: split code to get around 3m gas barrier&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatacopy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;253&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span&gt;delegate_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; $&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ADDR1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;elif&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;253&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; *&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span&gt;delegate_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-invalid z-illegal&quot;&gt; $&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;ADDR2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-constant&quot;&gt;...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Use case 2: mutable address for storing the code of a contract:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo z-code&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;if&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; &#x2F;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 2&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;**&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;224&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span class=&quot;z-storage z-type&quot;&gt; 0x&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;12345678&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; and&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;owner&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;sender&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-variable z-language&quot;&gt;    self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;delegate&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; =&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldataload&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt;4&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;else&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span&gt;delegate_call&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;msg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;gas&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; -&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language&quot;&gt; self&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;delegate&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt; ~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-keyword&quot;&gt;    ~&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;return&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;calldatasize&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant&quot;&gt; 10000&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The child functions called by these methods can now freely reference &lt;code&gt;msg.sender&lt;&#x2F;code&gt; and &lt;code&gt;msg.value&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;possible-arguments-against&quot;&gt;Possible arguments against&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;You can replicate this functionality by just sticking the sender into the first twenty bytes of the call data. However, this would mean that code would need to be specially compiled for delegated contracts, and would not be usable in delegated and raw contexts at the same time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
</content>
    </entry>
</feed>
